Tracing in controllers and operators

Hi, We just introduce tracing for controllers and operators
Feedback will be appreciated, hope it is interesting.

Kind to explain what is the purpose of using the context? Thanks.


The context is how you propagate the tracing ids in your program. It’s how Opentracing does in the go library and AFAIK they decided to use it because it’s the way the go std lib passes “non standard data” between different components in programs.

Opentracing gives you the required methods to extract and inject spans context in the context.Context data so it’s safe for the user as it doesn’t need to deal with keys (key typos, keys not being set, key changes between versions…).

For example you will receive a context that may have an span (injected by your callers), you would create a new child span from these context and pass the context updated with your just created span to the ones you call it, and they will do the same again and again, this way you propagate the trace inside your program.

Or you could just ignore the context and do nothing with the context. It’s up to the receiver.

More information here:



Thanks for your post.

It might be a silly question, but please answer: so is the context use in one program (just for tracking an object in that program), or is it propagated around between apps, tracing each place an object has been?

I don’t know if I understood correctly the question, I will try to explain what I think I understood :slight_smile:

The context object is only to propagate the trace IDs around the program (in this case the controller), this is known as IPC (inter-process communication), when you call another program (RPC, remote procedure call) you need to inject this trace IDs in a specific format, imagine that is an HTTP request to a REST API, you would extract from your context the trace IDs and inject the ids in the opentracing way for HTTP request (this is in defined headers, in the case if you use jaeger implementation is uber-trace-id header).

The other program (REST API) that received the request, will extract the trace ID from the headers of the request and inject them somewhere to propagate the trace IDs around the app, if it’s written in Go it will use a context.Context for example.