How to trace call from one Grpc service to the other Grpc service?

APM Agent language and version: python 3.6

Our apm can trace Mysql queries and Redis queries. But it can not trace call between service and service. Like the pic below:

The red rectangle is the call to other Grpc service. But apm lost the information.

The guy form infrastructure team told me that elastic-apm do not support tracing between Grpc services. Is it True?

Hello @nicoplus! Welcome to the forum.

Unfortunately we don't yet support gRPC in the python agent. It's possible we support it in other languages, but since you tagged this python I assume that's what you're using?

We've thought about adding support via python interceptors but it hasn't been high on our priority list. If this is something you'd like to see happen, can you please open an issue with the request?

Thanks for your reply!

You're right. I am using python. And I will add an issue.

I've found another question, the timeline can't trace code computing.

Recently, I'd like to optimize some algorithm that there are not any network IO. My request is that monitoring the algorithm timeline. Unfortunately elastic-apm lost the information, like the gRPC trace.

Is it a request not added?

You may be able to use our API to begin and end custom transactions around the pieces of code that you want to instrument.

Our Java agent supports tracing methods, though it is turned off by default because of performance concerns. We've considered adding something similar for Python but it's not on our immediate roadmap.

1 Like

There's also the capture_span decorator / context manager to manually instrument functions or blocks of code. These will then appear as a span if they are called during a transaction (e.g. a web request).

It is well suited to trace a certain function call which then executes your algorithm, but it's not a great fit for instrumenting hot paths inside your implementation (e.g. in a for loop that will be executed many times). For optimizing an algorithm that you know to be slow, a profiler like pyinstrument, py-spy or pyflame is usually the better fit.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.