grpc-ecosystem / go-grpc-middleware

Golang gRPC Middlewares: interceptor chaining, auth, logging, retries and more.
Apache License 2.0
6.29k stars 693 forks source link

Prometheus metrics label value inconsistency between Go and Java #664

Open yzhangyext opened 1 year ago

yzhangyext commented 1 year ago

Hi Team, I've noticed a Prometheus label value inconsistency between Go and Java (java-grpc-prometheus): e.g. In metrics grpc_server_handled_total, For grpc_type label, Java is uppercase while go is lower case, e.g. "UNARY" vs "unary" For grpc_code label, Java is uppercase while go is camel case, e.g. "UNKNOWN" vs "Unknown" Do you think it's a good idea to have them standardized? I personally prefer the uppercase, but I would love to hear your thoughts on this.

johanbrandhorst commented 1 year ago

Hi, thanks for your issue. I don't know that we can change these now unfortunately, it might break existing users. Note that this is just a third party library and you can probably just copy one of the interceptors and change the labels (preserving the license, of course).

yzhangyext commented 11 months ago

I see. In that case, do you think it's a good idea to allow passing in an option to convert these label values to standardized form (upper case)? It would greatly help us grouping metrics between Go and Java services.

johanbrandhorst commented 11 months ago

I suppose we could consider an option. It looks like the logic for this is here: https://github.com/grpc-ecosystem/go-grpc-middleware/blob/3ade00c067599e45664a46dabe922c8d32b32ddd/providers/prometheus/reporter.go#L31 and here: https://github.com/grpc-ecosystem/go-grpc-middleware/blob/3ade00c067599e45664a46dabe922c8d32b32ddd/interceptors/reporter.go#L16. Please make a more concrete proposal for this option (a PR would do) and we can see if it fits well into the code.