Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
shreyb opened this issue Jan 26, 2024 · 0 comments
Assignees

Comments

@shreyb
Copy link
Contributor

shreyb commented Jan 26, 2024

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.

@namrathaurs namrathaurs self-assigned this Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants