@@ -1360,95 +1360,152 @@ end}.
1360
1360
%% that are overly busy. Processes with large heaps or that take a
1361
1361
%% long time to garbage collect will count toward this threshold.
1362
1362
{mapping, "sysmon_handler.thresholds.busy_processes", "sysmon_handler.process_limit", [
1363
- {default, 30},
1364
- {datatype, integer},
1365
- hidden
1363
+ {datatype, integer},
1364
+ hidden
1366
1365
]}.
1367
1366
1367
+ {translation, "sysmon_handler.process_limit",
1368
+ fun(Conf) ->
1369
+ case cuttlefish:conf_get("sysmon_handler.thresholds.busy_processes", Conf, undefined) of
1370
+ undefined ->
1371
+ cuttlefish:unset();
1372
+ Int when is_integer(Int) ->
1373
+ Int;
1374
+ _ ->
1375
+ cuttlefish:invalid("should be a non-negative integer")
1376
+ end
1377
+ end
1378
+ }.
1379
+
1368
1380
%% @doc The threshold at which to warn about the number of ports that
1369
1381
%% are overly busy. Ports with full input buffers count toward this
1370
1382
%% threshold.
1371
1383
{mapping, "sysmon_handler.thresholds.busy_ports", "sysmon_handler.port_limit", [
1372
- {default, 2},
1373
1384
{datatype, integer},
1374
1385
hidden
1375
1386
]}.
1376
1387
1388
+ {translation, "sysmon_handler.port_limit",
1389
+ fun(Conf) ->
1390
+ case cuttlefish:conf_get("sysmon_handler.thresholds.busy_ports", Conf, undefined) of
1391
+ undefined ->
1392
+ cuttlefish:unset();
1393
+ Int when is_integer(Int) ->
1394
+ Int;
1395
+ _ ->
1396
+ cuttlefish:invalid("should be a non-negative integer")
1397
+ end
1398
+ end
1399
+ }.
1400
+
1377
1401
%% @doc A process will become busy when it exceeds this amount of time
1378
1402
%% doing garbage collection.
1379
- %%
1380
- %% NOTE: Enabling this setting can cause performance problems on
1381
- %% multi-core systems.
1382
1403
%% @see sysmon_handler.thresholds.busy_processes
1383
1404
{mapping, "sysmon_handler.triggers.process.garbage_collection", "sysmon_handler.gc_ms_limit", [
1384
- {default, off},
1385
1405
{datatype, [{atom, off},
1386
1406
{duration, ms}]},
1387
1407
hidden
1388
1408
]}.
1389
1409
1390
1410
{translation, "sysmon_handler.gc_ms_limit",
1391
- fun(Conf) ->
1392
- case cuttlefish:conf_get("sysmon_handler.triggers.process.garbage_collection", Conf) of
1393
- off -> 0;
1394
- Int -> Int
1395
- end
1396
- end}.
1411
+ fun(Conf) ->
1412
+ case cuttlefish:conf_get("sysmon_handler.triggers.process.garbage_collection", Conf, undefined) of
1413
+ undefined ->
1414
+ cuttlefish:unset();
1415
+ off ->
1416
+ 0;
1417
+ Int when is_integer(Int) ->
1418
+ Int;
1419
+ _ ->
1420
+ cuttlefish:invalid("should be a non-negative integer")
1421
+ end
1422
+ end
1423
+ }.
1397
1424
1398
1425
%% @doc A process will become busy when it exceeds this amount of time
1399
1426
%% during a single process scheduling & execution cycle.
1400
1427
{mapping, "sysmon_handler.triggers.process.long_scheduled_execution", "sysmon_handler.schedule_ms_limit", [
1401
- {default, off},
1402
1428
{datatype, [{atom, off},
1403
1429
{duration, ms}]},
1404
1430
hidden
1405
1431
]}.
1406
1432
1407
1433
{translation, "sysmon_handler.schedule_ms_limit",
1408
- fun(Conf) ->
1409
- case cuttlefish:conf_get("sysmon_handler.triggers.process.long_scheduled_execution", Conf) of
1410
- off -> 0;
1411
- Int -> Int
1412
- end
1413
- end}.
1434
+ fun(Conf) ->
1435
+ case cuttlefish:conf_get("sysmon_handler.triggers.process.long_scheduled_execution", Conf, undefined) of
1436
+ undefined ->
1437
+ cuttlefish:unset();
1438
+ off ->
1439
+ 0;
1440
+ Int when is_integer(Int) ->
1441
+ Int;
1442
+ _ ->
1443
+ cuttlefish:invalid("should be a non-negative integer")
1444
+ end
1445
+ end
1446
+ }.
1414
1447
1415
1448
%% @doc A process will become busy when its heap exceeds this size.
1416
1449
%% @see sysmon_handler.thresholds.busy_processes
1417
1450
{mapping, "sysmon_handler.triggers.process.heap_size", "sysmon_handler.heap_word_limit", [
1418
- {default, "160444000" },
1419
- {datatype, [bytesize, {atom, off} ]},
1451
+ {datatype, [{atom, off },
1452
+ bytesize ]},
1420
1453
hidden
1421
1454
]}.
1422
1455
1423
1456
{translation, "sysmon_handler.heap_word_limit",
1424
- fun(Conf) ->
1425
- case cuttlefish:conf_get("sysmon_handler.triggers.process.heap_size", Conf) of
1426
- off -> 0;
1427
- Bytes ->
1428
- WordSize = erlang:system_info(wordsize),
1429
- Bytes div WordSize
1457
+ fun(Conf) ->
1458
+ case cuttlefish:conf_get("sysmon_handler.triggers.process.heap_size", Conf, undefined) of
1459
+ undefined ->
1460
+ cuttlefish:unset();
1461
+ off ->
1462
+ 0;
1463
+ Bytes when is_integer(Bytes) ->
1464
+ WordSize = erlang:system_info(wordsize),
1465
+ Bytes div WordSize;
1466
+ _ ->
1467
+ cuttlefish:invalid("should be a non-negative integer")
1468
+ end
1430
1469
end
1431
- end }.
1470
+ }.
1432
1471
1433
1472
%% @doc Whether ports with full input buffers will be counted as
1434
1473
%% busy. Ports can represent open files or network sockets.
1435
1474
%% @see sysmon_handler.thresholds.busy_ports
1436
1475
{mapping, "sysmon_handler.triggers.port", "sysmon_handler.busy_port", [
1437
- {default, on},
1438
1476
{datatype, flag},
1439
1477
hidden
1440
1478
]}.
1441
1479
1480
+ {translation, "sysmon_handler.busy_port",
1481
+ fun(Conf) ->
1482
+ case cuttlefish:conf_get("sysmon_handler.triggers.port", Conf, undefined) of
1483
+ undefined ->
1484
+ cuttlefish:unset();
1485
+ Val -> Val
1486
+ end
1487
+ end
1488
+ }.
1489
+
1442
1490
%% @doc Whether distribution ports with full input buffers will be
1443
1491
%% counted as busy. Distribution ports connect Erlang nodes within a
1444
1492
%% single cluster.
1445
1493
%% @see sysmon_handler.thresholds.busy_ports
1446
1494
{mapping, "sysmon_handler.triggers.distribution_port", "sysmon_handler.busy_dist_port", [
1447
- {default, on},
1448
1495
{datatype, flag},
1449
1496
hidden
1450
1497
]}.
1451
1498
1499
+ {translation, "sysmon_handler.busy_dist_port",
1500
+ fun(Conf) ->
1501
+ case cuttlefish:conf_get("sysmon_handler.triggers.distribution_port", Conf, undefined) of
1502
+ undefined ->
1503
+ cuttlefish:unset();
1504
+ Val -> Val
1505
+ end
1506
+ end
1507
+ }.
1508
+
1452
1509
% ===============================
1453
1510
% Validators
1454
1511
% ===============================
0 commit comments