Skip to content

Commit 83c0a15

Browse files
Merge branch '1.14.x'
2 parents 7f3c478 + 1c891c7 commit 83c0a15

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,28 +193,30 @@ 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. This means that you should not do things like:
196+
Otherwise, subsequent meters having the same name with a different set of tag keys will not be registered.
197+
This means that you should not do things like:
198+
197199
[source,java]
198200
----
199201
// Please don't do this
200202
registry.counter("test", "first", "1").increment();
201203
registry.counter("test", "second", "2").increment();
202204
----
205+
203206
This will result in the following warning and the second `Meter` will not be registered:
204207
[source]
205208
----
206209
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.
207210
----
211+
208212
Instead you can do something like this:
209213
[source,java]
210214
----
211215
registry.counter("test", "first", "1", "second", "none").increment();
212216
registry.counter("test", "first", "none", "second", "2").increment();
213217
----
214218

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

0 commit comments

Comments
 (0)