micrometer-metrics / micrometer

An application observability facade for the most popular observability tools. Think SLF4J, but for observability.
https://micrometer.io
Apache License 2.0
4.44k stars 977 forks source link

Allow customization of tags set by the Grpc client/server interceptors #2805

Open taer opened 2 years ago

taer commented 2 years ago

Please describe the feature request. The AbstractMetricCollectingInterceptor for the Grpc metrics currently hardcodes the tags for service, method, etc. It would be nice to allow this to be overridden on construction. The current tags are here: https://github.com/micrometer-metrics/micrometer/blob/67c41db552cac463e44cd45545e5a7b8f3513f1b/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/grpc/AbstractMetricCollectingInterceptor.java#L48

Rationale The service tag used to tag the grpc service is a fairly common tag. Some metric sinks even call it "reserved": https://docs.datadoghq.com/getting_started/tagging/

Additional context It's possible to do this with a MeterFilter.renameTag call, but the metric code lives in a library. This means all consumers of the library would have to remember and perform this same rename.

shakuzen commented 2 years ago

Thank you for letting us know. We should probably take the TagsProvider approach used elsewhere for the default tags and allowing customization.

I've opened #2807 about the Datadog reserved tag keys.

taer commented 2 years ago

I made a quick TagProvider version PR. Open to any tweaks. I based it off 1.7, but it looks like it will apply to either.

marcingrzejszczak commented 8 months ago

Isn't customization possible by using the counterCustomizer and timerCustomizer ?