diff --git a/doc/configuration/instrumentation.md b/doc/configuration/instrumentation.md index 91709eee9c3..9f34fa26664 100644 --- a/doc/configuration/instrumentation.md +++ b/doc/configuration/instrumentation.md @@ -92,7 +92,7 @@ In case both `prefix` and `env_prefix` are defined, it will be placed before the ## Log handler options ### `instrumentation.log.level` -* **Syntax:** string, one of `"none"`, `"emergency"`, `"alert"`, `"critical"`, `"error"`, `"warning"`, `"notice"`, `"info"`, `"debug"`, `"all"`. +* **Syntax:** string, one of `"emergency"`, `"alert"`, `"critical"`, `"error"`, `"warning"`, `"notice"`, `"info"`, `"debug"`, `"all"`. * **Default:** `"debug"` * **Example:** `loglevel = "error"` @@ -107,10 +107,10 @@ Note that for some events, the level may be different, and this option overridde ## Example Prometheus configuration -This configuration enables `prometheus`, and `log` handlers: +This configuration enables `prometheus`, and `log` handlers, setting the periodic measurement (probe) interval to 60 seconds: ```toml [instrumentation] - probe_interval = 10_000 + probe_interval = 60 [instrumentation.prometheus] diff --git a/doc/migrations/6.2.1_x.x.x.md b/doc/migrations/6.2.1_x.x.x.md index 08e5e797d15..aac70bc2cc2 100644 --- a/doc/migrations/6.2.1_x.x.x.md +++ b/doc/migrations/6.2.1_x.x.x.md @@ -36,9 +36,6 @@ Exometer is no longer configured through [`app.config`](../configuration/configu Example configuration that is equivalent to the old example configuration provided in `app.config`: ```toml -[instrumentation] - probe_interval = 60000 - [[instrumentation.exometer.report.graphite]] host = "127.0.0.1" port = 2003 diff --git a/src/config/mongoose_config_validator.erl b/src/config/mongoose_config_validator.erl index fd20ceb780a..2286348b5df 100644 --- a/src/config/mongoose_config_validator.erl +++ b/src/config/mongoose_config_validator.erl @@ -46,6 +46,7 @@ validate(V, atom, module) -> validate_module(V); validate(V, atom, {module, Prefix}) -> validate_module(list_to_atom(atom_to_list(Prefix) ++ "_" ++ atom_to_list(V))); validate(V, atom, loglevel) -> validate_loglevel(V); +validate(V, atom, instrumentation_loglevel) -> validate_instrumentation_loglevel(V); validate(V, atom, pool_name) -> validate_non_empty_atom(V); validate(V, atom, shaper) -> validate_non_empty_atom(V); validate(V, atom, access_rule) -> validate_non_empty_atom(V); @@ -64,6 +65,12 @@ validate_section([_|_], non_empty) -> ok; validate_section(L, any) when is_list(L) -> ok. %% validators +%% +validate_instrumentation_loglevel(none) -> + error(#{what => validate_instrumentation_loglevel_failed, + value => none}); +validate_instrumentation_loglevel(Level) -> + validate_loglevel(Level). validate_loglevel(Level) -> mongoose_logs:loglevel_keyword_to_number(Level). diff --git a/src/instrument/mongoose_instrument_log.erl b/src/instrument/mongoose_instrument_log.erl index 13ef08f5318..754f3f35b8b 100644 --- a/src/instrument/mongoose_instrument_log.erl +++ b/src/instrument/mongoose_instrument_log.erl @@ -9,7 +9,7 @@ -spec config_spec() -> mongoose_config_spec:config_section(). config_spec() -> - #section{items = #{<<"level">> => #option{type = atom, validate = loglevel}}, + #section{items = #{<<"level">> => #option{type = atom, validate = instrumentation_loglevel}}, defaults = #{<<"level">> => debug}}. -spec set_up(mongoose_instrument:event_name(), mongoose_instrument:labels(), diff --git a/test/config_parser_SUITE.erl b/test/config_parser_SUITE.erl index 77f1171ae19..f9bfe4ae7de 100644 --- a/test/config_parser_SUITE.erl +++ b/test/config_parser_SUITE.erl @@ -2961,6 +2961,7 @@ instrumentation_log(_Config) -> T = fun(Opts) -> #{<<"instrumentation">> => #{<<"log">> => Opts}} end, ?cfg(P, default_config(P), T(#{})), ?cfg(P ++ [level], info, T(#{<<"level">> => <<"info">>})), + ?err(T(#{<<"level">> => <<"none">>})), ?err(T(#{<<"level">> => <<"insane">>})). instrumentation_exometer(_Config) ->