Skip to content

Commit

Permalink
Merge branch '1.14.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatan-ivanov committed Jan 17, 2025
2 parents e8f41e5 + e163057 commit 2ba3d54
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/modules/ROOT/pages/concepts/meter-filters.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ new MeterFilter() {

This filter adds a name prefix and an additional tag conditionally to meters starting with a name of `test`.

[IMPORTANT]
.`MeterFilter` implementations of `map` should be "static"
====
The `id` parameter is the only dynamic input that changes over the lifecycle of the `MeterFilter` on which they should depend.
Use cases where dynamic behavior is desired, such as defining tags based on the context of a request etc., should be implemented in the instrumentation itself rather than in a `MeterFilter`.
For example, see `MongoMetricsCommandListener` and the `MongoCommandTagsProvider` it takes in a constructor argument as well as the default implementation `DefaultMongoCommandTagsProvider`.
See also xref:../observation/components.adoc#micrometer-observation-predicates-filters[ObservationFilter] which allows dynamic implementations.
====

=== Convenience Methods

`MeterFilter` provides convenience builders for many common transformation cases:

* `commonTags(Iterable<Tag>)`: Adds a set of tags to all metrics. Adding common tags for application name, host, region, and others is a highly recommended practice.
Expand Down

0 comments on commit 2ba3d54

Please sign in to comment.