Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Tag Provider #89

Closed
dtaveras opened this issue Nov 20, 2019 · 7 comments · Fixed by #124
Closed

Custom Tag Provider #89

dtaveras opened this issue Nov 20, 2019 · 7 comments · Fixed by #124
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@dtaveras
Copy link

dtaveras commented Nov 20, 2019

The generation of tags is tied to Label types. Is there a way to add a custom tag?
I do understand that there is common tags in the MeterRegistry but i was more looking for one when creating the Meter. As an example I want to tag each meter with a user

@jotak
Copy link
Contributor

jotak commented Nov 20, 2019

Hi @dtaveras ,

As you say, the MeterRegistry has common tags ; and you can get that registry to impact all registered metrics. E.g.

    MeterRegistry registry = BackendRegistries.getDefaultNow();
    registry.config().commonTags("user", "alice");

Is that not what you're looking for?

@dtaveras
Copy link
Author

dtaveras commented Nov 20, 2019

I was more interested in being able to extract more information based on the request, so having a tag provider with signature Request -> [Tag].
As example we also use https://github.com/micrometer-metrics/micrometer/blob/master/micrometer-jersey2/src/main/java/io/micrometer/jersey2/server/MetricsRequestEventListener.java which accepts a tag provider with the signature above.

public interface JerseyTagsProvider {

/**
 * Provides tags to be associated with metrics for the given {@code event}.
 *
 * @param event
 *            the request event
 * @return tags to associate with metrics recorded for the request
 */
Iterable<Tag> httpRequestTags(RequestEvent event);

/**
 * Provides tags to be associated with the
 * {@link io.micrometer.core.instrument.LongTaskTimer} which instruments the
 * given long-running {@code event}.
 *
 * @param event
 *            the request event
 * @return tags to associate with metrics recorded for the request
 */
Iterable<Tag> httpLongRequestTags(RequestEvent event);

}

@dtaveras
Copy link
Author

common tags will do for now, was just curious if i missed something.

@jotak jotak added the enhancement New feature or request label Nov 25, 2019
@jotak
Copy link
Contributor

jotak commented Nov 25, 2019

I think I get it, it seems like a good enhancement to add.

@dtaveras
Copy link
Author

Thanks, great job with this library. A ton of great features and easy to configure.

@jotak jotak added this to the 4.0.0 milestone Dec 11, 2019
@vietj vietj modified the milestones: 4.0.0, 4.1.0 Oct 19, 2020
@vietj vietj modified the milestones: 4.1.0, 4.1.1 Jun 1, 2021
@vietj
Copy link
Contributor

vietj commented Jun 3, 2021

@jotak do we have a contributor for this enhancement ?

@jotak
Copy link
Contributor

jotak commented Jun 3, 2021

@vietj not that I know. I'm going to take a look.

@jotak jotak self-assigned this Jun 3, 2021
jotak added a commit to jotak/vertx-micrometer-metrics that referenced this issue Jun 3, 2021
- Allows to implement a CustomTagsProvider interface to provide tags out
of HttpRequest objects.
- Add tests

Fixes vert-x3#89
jotak added a commit to jotak/vertx-micrometer-metrics that referenced this issue Jun 3, 2021
- Allows to implement a CustomTagsProvider interface to provide tags out
of HttpRequest objects.
- Add tests

Fixes vert-x3#89

Signed-off-by: Joel Takvorian <[email protected]>
jotak added a commit to jotak/vertx-micrometer-metrics that referenced this issue Jul 12, 2021
- Allows to implement a custom tags provider (Function: request -> Tags) to provide tags out
of HttpRequest objects.
- Add tests

Fixes vert-x3#89

Signed-off-by: Joel Takvorian <[email protected]>
jotak added a commit to jotak/vertx-micrometer-metrics that referenced this issue Jul 12, 2021
- Allows to implement a custom tags provider (Function: request -> Tags) to provide tags out
of HttpRequest objects.
- Add tests

Fixes vert-x3#89

Signed-off-by: Joel Takvorian <[email protected]>
Signed-off-by: Joel Takvorian <[email protected]>
jotak added a commit to jotak/vertx-micrometer-metrics that referenced this issue Jul 12, 2021
- Allows to implement a custom tags provider (Function: request -> Tags) to provide tags out
of HttpRequest objects.
- Add tests

Fixes vert-x3#89

Signed-off-by: Joel Takvorian <[email protected]>
jotak added a commit to jotak/vertx-micrometer-metrics that referenced this issue Jul 12, 2021
- Allows to implement a custom tags provider (Function: request -> Tags) to provide tags out
of HttpRequest objects.
- Add tests

Fixes vert-x3#89

Signed-off-by: Joel Takvorian <[email protected]>
jotak added a commit to jotak/vertx-micrometer-metrics that referenced this issue Jul 12, 2021
- Allows to implement a custom tags provider (Function: request -> Tags) to provide tags out
of HttpRequest objects.
- Add tests

Fixes vert-x3#89

Signed-off-by: Joel Takvorian <[email protected]>
jotak added a commit to jotak/vertx-micrometer-metrics that referenced this issue Jul 12, 2021
- Allows to implement a custom tags provider (Function: request -> Tags) to provide tags out
of HttpRequest objects.
- Add tests

Fixes vert-x3#89

Signed-off-by: Joel Takvorian <[email protected]>
jotak added a commit that referenced this issue Jul 23, 2021
* Implement custom tags provider for HTTP metrics

- Allows to implement a custom tags provider (Function: request -> Tags) to provide tags out
of HttpRequest objects.
- Add tests

Fixes #89

Signed-off-by: Joel Takvorian <[email protected]>

* Custom tag provider documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment