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