Skip to content

Commit

Permalink
Merge branch '1.12.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
shakuzen committed Apr 1, 2024
2 parents 420b3e0 + 612b996 commit 58d72bd
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/modules/ROOT/pages/implementations/prometheus.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,24 @@ The following example shows a Prometheus query to plot the duration of a long ta

.Simulated back-to-back long tasks with a fixed alert threshold.
image::implementations/prometheus-long-task-timer.png[Grafana-rendered Prometheus long task timer]

== Limitation on same name with different set of tag keys

The `PrometheusMeterRegistry` doesn't allow to create meters having the same name with a different set of tag keys, so you should guarantee that meters having the same name have the same set of tag keys.
Otherwise, subsequent meters having the same name with a different set of tag keys will not be registered silently by default.
You can change the default behavior by registering a meter registration failed listener.
For example, you can register a meter registration failed listener that throws an exception as follows:

[source,java]
----
registry.config().onMeterRegistrationFailed((id, reason) -> {
throw new IllegalArgumentException(reason);
});
----

Actually, the `PrometheusMeterRegistry` has a shortcut for this, so you can do the following to achieve the same:

[source,java]
----
registry.throwExceptionOnRegistrationFailure();
----

0 comments on commit 58d72bd

Please sign in to comment.