Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
computerlove committed Nov 8, 2023
1 parent b119566 commit 0d05881
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion docs/src/main/asciidoc/telemetry-micrometer.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,25 @@ The `@Timed` annotation will wrap the execution of a method and will emit the fo
in addition to any tags defined on the annotation itself:
class, method, and exception (either "none" or the simple class name of a detected exception).

Using annotations is limited, as you can't dynamically assign meaningful tag values.
Parameters to `@Counted` and `@Timed` can be annotated with `@MeterTag` to dynamically assign meaningful tag values.

[source,java]
----
enum Currency { USD, EUR }
// tags = type=with_enum, currency=${currency.toString()}
@Timed(value="time_something", extraTags = {"type", "with_enum"})
public Something calculateSomething(@MeterTag Currency currency) { ... }
// tags = type=with_enum, the_currency=${currency.toString()}
@Timed(value="time_something", extraTags = {"type", "with_enum"})
public Something calculateSomething(@MeterTag(key="the_currency") Currency currency) { ... }
---
`MeterTag.expression` and `MeterTag.resolver` is currently not supported.
IMPORTANT: Provided tag values MUST BE of LOW-CARDINALITY. If you fail to provide low-cardinality values, that can lead to performance issues of your metrics backend. Values should not come from the end-user since those could be high-cardinality.
Also note that many methods, e.g. REST endpoint methods or Vert.x Routes, are counted and timed by the micrometer extension out of the box.
== Support for the MicroProfile Metrics API
Expand Down

0 comments on commit 0d05881

Please sign in to comment.