opentelemetry-haskell icon indicating copy to clipboard operation
opentelemetry-haskell copied to clipboard

Implement the context propagation using environment variables

Open ethercrow opened this issue 5 years ago • 2 comments

When a service A calls service B, it's common practice to put the trace and span ids into HTTP headers so that in the visualizer you can see spans of B as children of spans of A.

The idea is to do the similar thing when a program A calls program B as a subprocess. For example, stack or ghcide calls ghc and sets an environment variable "OPENTELEMETRY_CONTEXT=ot--". The callee would inspect the environment variables on startup and be aware of the trace id and parent span id. After we upload both eventlogs, we'll see spans of both programs participating in the same trace.

ethercrow avatar Apr 26 '20 10:04 ethercrow

@ethercrow , Note. I haven't found where OPENTELEMETRY_CONTEXT is used in stack/ghcide, but in python project they read from that var 1 of 2 constants, not strings like "ot-fffa23432-bedc38383" https://opentelemetry-python.readthedocs.io/en/stable/_modules/opentelemetry/context.html

yaitskov avatar May 22 '20 05:05 yaitskov

@ethercrow ,

I think the following hypothetical GHC feature would solve all problems related to this ticket

https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3382

yaitskov avatar May 28 '20 23:05 yaitskov