-
Notifications
You must be signed in to change notification settings - Fork 10
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
Allow custom labels #165
Merged
Merged
Allow custom labels #165
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…bove throw java.lang.RuntimeException: Unable to auto detect project license
… "sbt.librarymanagement.ResolveException: Error downloading org.scalameta:semanticdb-scalac_2.13.14:4.8.10"
… Error downloading org.scalameta:semanticdb-scalac_2.13.14:4.8.10"
rossabaker
reviewed
May 24, 2024
prometheus-metrics/src/main/scala/org/http4s/metrics/prometheus/Prometheus.scala
Outdated
Show resolved
Hide resolved
prometheus-metrics/src/main/scala/org/http4s/metrics/prometheus/Prometheus.scala
Outdated
Show resolved
Hide resolved
rossabaker
approved these changes
May 28, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allow adding custom labels.
Background
In a situation where a service interacts with multiple providers, a few of them do not have a lot of traffic, so when one of these light providers is down, the alert of the service is not triggered due to the small percentage counted in the failing traffic; So we want to create alerts specific to providers, and I’m searching for ways to identify the metrics entries related to a provider.
Two options currently available:
MetricsOps
instance, but the metrics of this client will be excluded from a generic Http4S metrics dashboard;org.http4s.client.middleware.Metrics
.The second option is better than the first option, but not ideal.
What it does
This PR enables clients to pass custom labels and corresponding values when create
MetricsOps
and allow alerts targeting those label.Code refactor
There were a few configuration items (prefix, registry, sampleExemplar, responseDurationSecondsHistogramBuckets), to reduce the number of methods, converted the code to builder pattern, then added
withCustomLabelsAndValues
method.Example
Here is an example. If we create a
MetricsOps
as below and pass it to a clientMetrics
middlewareNow we can create a
Prometheus
rule as below, note, labelstatus
is set byMetrics
middleware,app
by filter, andprovider
is a custom label.