Skip to content

Support metrics publishing for hooks #130

@diafour

Description

@diafour

The idea is that the hook can return a set of JSON objects and the Shell-operator will publish them as metrics.

For example:

Hook writes JSON objects to a temporary file $METRICS_PATH

{"name":"metric_gauge", "set":34.12, "labels":{"label1":"val1", ... }}
{"name":"metric_count", "add":1, "labels":{"label1":"val1", ... }}

Shell-operator parse these objects and publish them via /metrics endpoint:

metric_gauge{"hook":"hook.sh", "label1":"val1"} 34.12
metric_count{"hook":"hook.sh", "label1":"val1"} 1

Note 1: "add" operation is also available for the gauge metric.

Note 2: there are no checks for the uniqueness of the "name" value. Metric name is not prefixed with "shell_operator_".

Note 3: a developer should check, that similar metrics have a similar set of labels or an error will occur and hook will restart.

Note 4: hook label is added automatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions