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

feat: optional id label for all metrics #154

Merged
merged 2 commits into from
Feb 22, 2024

Conversation

damiankaminski-form3
Copy link
Contributor

Metrics are exported via prometheus push gateway. Unfortunately, push gateway is only a super simple cache. It does not add any common labels, such as server, or pod name, and when metric with the same label set is provided, it overrides the latest value with a new one. That's why it's crucial to make label values unique.

With the new id label it should be a little easier. It's optional and needed only when metric entries might be not unique.

@damiankaminski-form3 damiankaminski-form3 requested a review from a team as a code owner February 22, 2024 12:48
@janakerman-form3
Copy link
Contributor

Hey @damiankaminski-form3 - a couple of questions:

  • Is the issue here that we have multiple concurrent executions of the same test overwriting each other's metrics?
  • How do you envision this new variable to be used?

@damiankaminski-form3
Copy link
Contributor Author

Is the issue here that we have multiple concurrent executions of the same test overwriting each other's metrics?

That is the exact issue.

How do you envision this new variable to be used?

It depends on the scenario. It should be a value that:

  1. makes the metric unique, so that it is never overridden
  2. is not random for every execution, as push gateway is a dumb cache, meaning that random value would stay there forever (not perfect cost and memory wise)

@janakerman-form3
Copy link
Contributor

Hmmm OK. Seems reasonable to me. I suppose the intention is to give the user more control over metrics deduplication when pushing metrics to PushGateway, which is an issue that everyone using this tool could have.

I'm wondering if we couldn't make this more flexible by renaming the new env variable to PROMETHEUS_LABEL_ID. That way, we've be able to add more flexible behaviour in the future, such as adding all labels with PROMETHEUS_LABEL_ prefix as metrics labels, without having to affect the new environment variable in a breaking way.

Of course PROMETHEUS_NAMESPACE is a lost cause. :)

@damiankaminski-form3
Copy link
Contributor Author

I'm wondering if we couldn't make this more flexible by renaming the new env variable to PROMETHEUS_LABEL_ID. That way, we've be able to add more flexible behaviour in the future, such as adding all labels with PROMETHEUS_LABEL_ prefix as metrics labels, without having to affect the new environment variable in a breaking way.

Good idea. Changed: ad760ba

Of course PROMETHEUS_NAMESPACE is a lost cause. :)

We can add a new PROMETHEUS_LABEL_NAMESPACE and then deprecate the old one some day, but not sure if it's worth it :)

Copy link
Contributor

@janakerman-form3 janakerman-form3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's easy enough to do if that functionality is ever added, so I think it's OK not to add it right now.

@damiankaminski-form3 damiankaminski-form3 merged commit e8614f6 into master Feb 22, 2024
1 check passed
@damiankaminski-form3 damiankaminski-form3 deleted the dk-run-name-label branch February 22, 2024 16:53
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

Successfully merging this pull request may close these issues.

3 participants