Skip to content

Metrics that are declared to have labels need to have them specified at measurement time #698

@shreyb

Description

@shreyb

In src/decisionengine/framework/engine/DecisionEngine.py, there are a number of metrics that are declared like this that have labels specified, like this one:

SET_CHANNEL_LOG_LEVEL_HISTOGRAM = Histogram(

However, later on in the module, the metric is measured without a label:

@SET_SOURCE_LOG_LEVEL_HISTOGRAM.time()

@vitodb , @mambelli , and I did some tests and believe this will cause the DE to error out (probably crashing the DE) if the affected command (de-client --set_channel_log_level in this case) is run.

Please correct this and all other metrics as necessary so that if they are declared initially to have a label, that the label is set at measurement time.

Note that in some cases, this might require not using a decorator (since, for example, for the above case, you won't have the source name outside of the function, but you do INSIDE the function), and rather using the context manager as shown here:

https://prometheus.github.io/client_python/instrumenting/gauge/

Let me know if you have any questions about this issue.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions