@@ -1363,95 +1363,152 @@ end}.
13631363%% that are overly busy. Processes with large heaps or that take a
13641364%% long time to garbage collect will count toward this threshold.
13651365{mapping, "sysmon_handler.thresholds.busy_processes", "sysmon_handler.process_limit", [
1366- {default, 30},
1367- {datatype, integer},
1368- hidden
1366+ {datatype, integer},
1367+ hidden
13691368]}.
13701369
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+
13711383%% @doc The threshold at which to warn about the number of ports that
13721384%% are overly busy. Ports with full input buffers count toward this
13731385%% threshold.
13741386{mapping, "sysmon_handler.thresholds.busy_ports", "sysmon_handler.port_limit", [
1375- {default, 2},
13761387 {datatype, integer},
13771388 hidden
13781389]}.
13791390
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+
13801404%% @doc A process will become busy when it exceeds this amount of time
13811405%% doing garbage collection.
1382- %%
1383- %% NOTE: Enabling this setting can cause performance problems on
1384- %% multi-core systems.
13851406%% @see sysmon_handler.thresholds.busy_processes
13861407{mapping, "sysmon_handler.triggers.process.garbage_collection", "sysmon_handler.gc_ms_limit", [
1387- {default, off},
13881408 {datatype, [{atom, off},
13891409 {duration, ms}]},
13901410 hidden
13911411]}.
13921412
13931413{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+ }.
14001427
14011428%% @doc A process will become busy when it exceeds this amount of time
14021429%% during a single process scheduling & execution cycle.
14031430{mapping, "sysmon_handler.triggers.process.long_scheduled_execution", "sysmon_handler.schedule_ms_limit", [
1404- {default, off},
14051431 {datatype, [{atom, off},
14061432 {duration, ms}]},
14071433 hidden
14081434]}.
14091435
14101436{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+ }.
14171450
14181451%% @doc A process will become busy when its heap exceeds this size.
14191452%% @see sysmon_handler.thresholds.busy_processes
14201453{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 ]},
14231456 hidden
14241457]}.
14251458
14261459{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
14331472 end
1434- end }.
1473+ }.
14351474
14361475%% @doc Whether ports with full input buffers will be counted as
14371476%% busy. Ports can represent open files or network sockets.
14381477%% @see sysmon_handler.thresholds.busy_ports
14391478{mapping, "sysmon_handler.triggers.port", "sysmon_handler.busy_port", [
1440- {default, on},
14411479 {datatype, flag},
14421480 hidden
14431481]}.
14441482
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+
14451493%% @doc Whether distribution ports with full input buffers will be
14461494%% counted as busy. Distribution ports connect Erlang nodes within a
14471495%% single cluster.
14481496%% @see sysmon_handler.thresholds.busy_ports
14491497{mapping, "sysmon_handler.triggers.distribution_port", "sysmon_handler.busy_dist_port", [
1450- {default, on},
14511498 {datatype, flag},
14521499 hidden
14531500]}.
14541501
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+
14551512% ===============================
14561513% Validators
14571514% ===============================
0 commit comments