Skip to content

egse.metrics

cgse-common

This code is part of the cgse-common package.

egse.metrics

Functions:

Name Description
define_metrics

Creates a metrics dictionary from the telemetry dictionary.

update_metrics

Updates the metrics parameters with the values from the updates dictionary.

define_metrics

define_metrics(
    origin, dashboard=None, use_site=False, setup=None
)

Creates a metrics dictionary from the telemetry dictionary.

Read the metric names and their descriptions from the telemetry dictionary, and create Prometheus gauges based on this information.

If dashboard is not provided, all telemetry parameters for the given origin will be returned.

Parameters:

Name Type Description Default
origin str

Storage mnemonics for the requested metrics

required
dashboard str

Restrict the metrics selection to those that are defined for the given dashboard. You can select all dashboards with dashboard='*'.

None
use_site bool

Indicate whether the prefixes of the new HK names are TH-specific

False
setup Optional[Setup]

Setup.

None

update_metrics

update_metrics(metrics, updates)

Updates the metrics parameters with the values from the updates dictionary.

Only the metrics parameters for which the names are keys in the given updates dict are actually updated. Other metrics remain untouched.

The functions log a warning when the updates dict contains a name which is not known as a metrics parameter.

Parameters:

Name Type Description Default
metrics dict

Metrics dictionary previously defined with the define_metrics function

required
updates dict

Dictionary with key=metrics name and value is the to-be-updated value

required