@@ -1360,95 +1360,152 @@ end}.
13601360%% that are overly busy. Processes with large heaps or that take a
13611361%% long time to garbage collect will count toward this threshold.
13621362{mapping, "sysmon_handler.thresholds.busy_processes", "sysmon_handler.process_limit", [
1363- {default, 30},
1364- {datatype, integer},
1365- hidden
1363+ {datatype, integer},
1364+ hidden
13661365]}.
13671366
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+
13681380%% @doc The threshold at which to warn about the number of ports that
13691381%% are overly busy. Ports with full input buffers count toward this
13701382%% threshold.
13711383{mapping, "sysmon_handler.thresholds.busy_ports", "sysmon_handler.port_limit", [
1372- {default, 2},
13731384 {datatype, integer},
13741385 hidden
13751386]}.
13761387
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+
13771401%% @doc A process will become busy when it exceeds this amount of time
13781402%% doing garbage collection.
1379- %%
1380- %% NOTE: Enabling this setting can cause performance problems on
1381- %% multi-core systems.
13821403%% @see sysmon_handler.thresholds.busy_processes
13831404{mapping, "sysmon_handler.triggers.process.garbage_collection", "sysmon_handler.gc_ms_limit", [
1384- {default, off},
13851405 {datatype, [{atom, off},
13861406 {duration, ms}]},
13871407 hidden
13881408]}.
13891409
13901410{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+ }.
13971424
13981425%% @doc A process will become busy when it exceeds this amount of time
13991426%% during a single process scheduling & execution cycle.
14001427{mapping, "sysmon_handler.triggers.process.long_scheduled_execution", "sysmon_handler.schedule_ms_limit", [
1401- {default, off},
14021428 {datatype, [{atom, off},
14031429 {duration, ms}]},
14041430 hidden
14051431]}.
14061432
14071433{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+ }.
14141447
14151448%% @doc A process will become busy when its heap exceeds this size.
14161449%% @see sysmon_handler.thresholds.busy_processes
14171450{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 ]},
14201453 hidden
14211454]}.
14221455
14231456{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
14301469 end
1431- end }.
1470+ }.
14321471
14331472%% @doc Whether ports with full input buffers will be counted as
14341473%% busy. Ports can represent open files or network sockets.
14351474%% @see sysmon_handler.thresholds.busy_ports
14361475{mapping, "sysmon_handler.triggers.port", "sysmon_handler.busy_port", [
1437- {default, on},
14381476 {datatype, flag},
14391477 hidden
14401478]}.
14411479
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+
14421490%% @doc Whether distribution ports with full input buffers will be
14431491%% counted as busy. Distribution ports connect Erlang nodes within a
14441492%% single cluster.
14451493%% @see sysmon_handler.thresholds.busy_ports
14461494{mapping, "sysmon_handler.triggers.distribution_port", "sysmon_handler.busy_dist_port", [
1447- {default, on},
14481495 {datatype, flag},
14491496 hidden
14501497]}.
14511498
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+
14521509% ===============================
14531510% Validators
14541511% ===============================
0 commit comments