revise readme
This commit is contained in:
parent
938406313e
commit
8e7050acf3
2 changed files with 23 additions and 18 deletions
19
README.md
19
README.md
|
@ -2,4 +2,21 @@
|
||||||
|
|
||||||
Using Influx, Telegraf, etc.
|
Using Influx, Telegraf, etc.
|
||||||
|
|
||||||
![Monitoring](https://raw.githubusercontent.com/hannesm/monitoring-experiments/master/one.png)
|
![Monitoring](https://raw.githubusercontent.com/roburio/monitoring-experiments/master/one.png)
|
||||||
|
|
||||||
|
# Dynamic adjustments of Log level and Metrics reporting
|
||||||
|
|
||||||
|
The create function has a *listener_port* argument. If this is provided, then
|
||||||
|
on the given port TCP connections to the unikernel are possible. Each connection
|
||||||
|
can transmit a command (as text) to adjust log level and enable or disable
|
||||||
|
metrics sources:
|
||||||
|
|
||||||
|
The log level (prefix `L`) is specified, the same as the command-line argument `-l`:
|
||||||
|
- `L*:debug` all log sources are enabled on the *debug* level
|
||||||
|
- `Lmonitoring-experiments:error` the log source monitoring-experiments is set to the *error* level
|
||||||
|
- `L*:info,monitoring-experiments:debug` all log sources are enabled on the *info* level, and the log source monitoring-experiments is set to the *debug* level
|
||||||
|
|
||||||
|
The metrics (prefix `M`) sources can be enabled and disabled based on source name.
|
||||||
|
First, if present, the all command is executed, then specific sources:
|
||||||
|
- `M*:disable,memory:enable,net-solo5:enable` disables all metrics sources, and then enables *memory* and *net-solo5*
|
||||||
|
- `Mnet-solo5:disable` disables the *net-solo5* metrics source.
|
||||||
|
|
|
@ -81,34 +81,22 @@ let adjust_metrics s =
|
||||||
| [ src ; en ] ->
|
| [ src ; en ] ->
|
||||||
let* en_or_d = enable_of_str en in
|
let* en_or_d = enable_of_str en in
|
||||||
Ok (`Src src, en_or_d)
|
Ok (`Src src, en_or_d)
|
||||||
| [ "src" ; src ; en ] ->
|
|
||||||
let* en_or_d = enable_of_str en in
|
|
||||||
Ok (`Src src, en_or_d)
|
|
||||||
| [ "tag" ; src ; en ] ->
|
|
||||||
let* en_or_d = enable_of_str en in
|
|
||||||
Ok (`Tag src, en_or_d)
|
|
||||||
| _ -> Error ("couldn't decode metrics " ^ s))
|
| _ -> Error ("couldn't decode metrics " ^ s))
|
||||||
(String.split_on_char ',' s)
|
(String.split_on_char ',' s)
|
||||||
in
|
in
|
||||||
let* (all, tags, srcs) =
|
let* (all, srcs) =
|
||||||
List.fold_left (fun acc t ->
|
List.fold_left (fun acc t ->
|
||||||
let* (all, tags, srcs) = acc in
|
let* (all, srcs) = acc in
|
||||||
let* t = t in
|
let* t = t in
|
||||||
match t with
|
match t with
|
||||||
| `All, en_or_d -> Ok (Some en_or_d, tags, srcs)
|
| `All, en_or_d -> Ok (Some en_or_d, srcs)
|
||||||
| `Src s, en_or_d -> Ok (all, tags, (s, en_or_d) :: srcs)
|
| `Src s, en_or_d -> Ok (all, (s, en_or_d) :: srcs))
|
||||||
| `Tag t, en_or_d -> Ok (all, (t, en_or_d) :: tags, srcs))
|
(Ok (None, [])) ts
|
||||||
(Ok (None, [], [])) ts
|
|
||||||
in
|
in
|
||||||
(match all with
|
(match all with
|
||||||
| Some `Enable -> Metrics.enable_all ()
|
| Some `Enable -> Metrics.enable_all ()
|
||||||
| Some `Disable -> Metrics.disable_all ()
|
| Some `Disable -> Metrics.disable_all ()
|
||||||
| None -> ());
|
| None -> ());
|
||||||
List.iter
|
|
||||||
(function
|
|
||||||
| t, `Enable -> Metrics.enable_tag t
|
|
||||||
| t, `Disable -> Metrics.disable_tag t)
|
|
||||||
tags ;
|
|
||||||
List.iter (fun (src, e_or_d) ->
|
List.iter (fun (src, e_or_d) ->
|
||||||
match List.find_opt (fun s -> Metrics.Src.name s = src) (Metrics.Src.list ()), e_or_d with
|
match List.find_opt (fun s -> Metrics.Src.name s = src) (Metrics.Src.list ()), e_or_d with
|
||||||
| Some src, `Enable -> Metrics.Src.enable src
|
| Some src, `Enable -> Metrics.Src.enable src
|
||||||
|
|
Loading…
Reference in a new issue