lidavidm commented on pull request #11920:
URL: https://github.com/apache/arrow/pull/11920#issuecomment-990250070


   CC @cpcloud, this is "automatic" instrumentation for Flight/OpenTelemetry. 
AFAIK, this isn't generally possible in gRPC/C++. [Server 
interceptors](https://grpc.github.io/grpc/cpp/classgrpc_1_1experimental_1_1_interceptor_batch_methods.html)
 have no way to pass data from the interceptor to the RPC handler. (OpenCensus 
support is achieved by hardcoding it into the library.) Also, IIRC thread 
locals (i.e. the OTel Context) are not viable because the library makes no 
guarantee about whether RPC handlers are run on the same thread as interceptors 
or not.
   
   Flight works around this because the server interceptors don't use the gRPC 
interceptor framework; instead, the Flight RPC handlers hardcode calls to the 
interceptors before handing control to the Flight application. Hence, a Span 
started in a Flight interceptor will be active during the application's RPC 
handler.
   
   The OpenTelemetry/gRPC 
[example](https://github.com/open-telemetry/opentelemetry-cpp/blob/main/examples/grpc/server.cc)
 just hardcodes a call to OpenTelemetry within the RPC handler and does not try 
to implement more general instrumentation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to