question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support extra tags for each gRPC call

See original GitHub issue

Currently the tags in the gRPC MetricCollectingServerInterceptor are fixed to service, method, methodType & statusCode.

It would be great if there would be a support for a custom tags that depend on the ServerCall and Metadata as well, not only the method being invoked. This way the user would have freedom to add extra tags with values that depend on the caller.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
oehmecommented, Jun 20, 2021

For me, the main thing that’s missing from the default tags is the target address of the channel. I have an app with multiple channels that use the same service interface, connected to different hosts. If I use the same interceptor for each channel (e.g. like Micronaut does), then all the metrics end up indistinguishable. I’ve worked around this by adding a different interceptor to each channel and using the counterCustomizer/timerCustumizer to add the channel tag. It would be great if that just worked out of the box though, especially when future Micronaut versions add this as a global interceptor.

0reactions
ST-DDTcommented, Jun 17, 2021

Do you have an example for the tags that you would like to add?

The preregister methods are optional. I added them because in our applications some methods are called very rarely and I needed a way to identify them easily.

As for the protected calls. They are just a way for me to reuse code across the server and client implementation. They are based on the greatest common data avaiable for both server and client. Adding a TagProvider would render the entire abstract base class useless. Please note that you will need separate TagProvider interfaces for both server and client. ~Maybe its possible to use the same interface if we trash most of the current client implementation and potentially some of the semantics.~

I’m not against this change if it is worth it, but it may come at the price of increased complexity. Depending on the requirements, the client side may work entirely different from the server side. Especially the client side may be affected by the increase of complexity. Please ensure that it is still possible to cancel (and count) client calls, that have not been ClientCall#started due to executor constraints/workload (or at least document any new limlitations).

Please consult the grpc javadocs, regarding the limitations of the scope/thread safety of the related beans.

Read more comments on GitHub >

github_iconTop Results From Across the Web

grpc_ctxtags - Go Packages
Tags describe information about the request, and can be set and used by other middleware, or handlers. Tags are used for logging and...
Read more >
go - Add tags/prefix to gRPC method to distinguish private and ...
I would like to have some kind of tags / prefix on gRPC methods to distinguish private and public methods, so I can...
Read more >
Chapter 4, gRPC: Under the Hood - O'Reilly
In this chapter, we'll explore how the gRPC communication flow is implemented, what encoding techniques are used, how gRPC uses the underlying network ......
Read more >
refs/tags/v1.8.4 - grpc - Google Git
gRPC supports streaming semantics, where either the client or the server (or both) send a stream of messages on a single RPC call....
Read more >
Language Guide | Protocol Buffers - Google Developers
In the above example, all the fields are scalar types: two integers ... You can find out more about using the APIs for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found