Skip to content

Commit 1c891c7

Browse files
Fit docs changes to 1.14.x
See gh-5760
1 parent 3fbe6bd commit 1c891c7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

docs/modules/ROOT/pages/implementations/prometheus.adoc

+8-5
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ image::implementations/prometheus-long-task-timer.png[Grafana-rendered Prometheu
193193
== Limitation on same name with different set of tag keys
194194

195195
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.
196-
Otherwise, subsequent meters having the same name with a different set of tag keys will not be registered silently by default.
196+
Otherwise, subsequent meters having the same name with a different set of tag keys will not be registered.
197197
This means that you should not do things like:
198198

199199
[source,java]
@@ -203,17 +203,20 @@ registry.counter("test", "first", "1").increment();
203203
registry.counter("test", "second", "2").increment();
204204
----
205205

206-
Instead you can do something like this:
206+
This will result in the following warning and the second `Meter` will not be registered:
207+
[source]
208+
----
209+
WARNING: The meter (MeterId{name='test', tags=[tag(second=2)]}) registration has failed: Prometheus requires that all meters with the same name have the same set of tag keys. There is already an existing meter named 'test' containing tag keys [first]. The meter you are attempting to register has keys [second]. Note that subsequent logs will be logged at debug level.
210+
----
207211

212+
Instead you can do something like this:
208213
[source,java]
209214
----
210215
registry.counter("test", "first", "1", "second", "none").increment();
211216
registry.counter("test", "first", "none", "second", "2").increment();
212217
----
213218

214-
You can change the default behavior by registering a meter registration failed listener.
215-
For example, you can register a meter registration failed listener that throws an exception as follows:
216-
219+
You can change the default warning behavior by registering a meter registration failed listener:
217220
[source,java]
218221
----
219222
registry.config().onMeterRegistrationFailed((id, reason) -> {

0 commit comments

Comments
 (0)