grpc-spring icon indicating copy to clipboard operation
grpc-spring copied to clipboard

Expose properties for Metric tag names

Open pluttrell opened this issue 3 years ago • 2 comments

Please consider adding properties that users can easily customize for the metric tag names: service, method, method.type, status.code.

pluttrell avatar Jun 14 '22 06:06 pluttrell

Please also report/request that feature there as we will eventually switch to that one. https://github.com/micrometer-metrics/micrometer/tree/main/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/grpc

ST-DDT avatar Jun 14 '22 07:06 ST-DDT

A Micrometer PR has been added to enable customization of the classes in Micrometer itself.

For this PR (in this starter repo), I'm hoping we can add configurable Spring Boot properties to configure these. I wonder if something like the following might make sense:

grpc:
  server:
    metrics:
      processing-duration:
        meter-id: grpc.server.processing.duration
        tags:
          service-name: service
          method-name: rpc
          method-type: rpc.type
          status-code: status.code

pluttrell avatar Jun 15 '22 07:06 pluttrell

Since we are going to replace our implementation with the micrometer one in the next version please use the following feature in the meantime: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#actuator.metrics.customizing

@Bean
public MeterFilter renameRegionTagMeterFilter() {
   return MeterFilter.renameTag("com.example", "mytag.region", "mytag.area");
}

ST-DDT avatar Aug 25 '22 13:08 ST-DDT