openzipkin / openzipkin.github.io

content for https://zipkin.io
https://zipkin.io
Apache License 2.0
39 stars 64 forks source link

Add insight about span recording and propagation #40

Open codefromthecrypt opened 8 years ago

codefromthecrypt commented 8 years ago

here are some notes I thought about when doing the async span investigation. https://github.com/openzipkin/zipkin/issues/1189#issuecomment-235414726

While rough, I expect these notes to be better than nothing, and can help us produce better documentation, particularly the instrumentation section. Feel free to break this apart.

Span recording is when timing information or metadata is structured and reported out to zipkin.

Span propagation is when trace identifiers are sent in-band across to the next hop. The next hop uses the trace, parent, span id, and sampled value it receives. In other words, the sender is in control. If the sender wants the next hop to log into the same span, it propagates the current span id. If the sender wants the next hop to log into a child span, it propagates a child span id.

This is important when spans that are not client-server in nature. Taking the example of Kafka, the sender isn't sending to the consumer, they are sending to Kafka. This send activity is better modeled as a separate span, so if propagating a span id, it would make sense to propagate a child span. When the consumer picks up, which might be minutes later, if at all, it resumes the child span. Modeling producer/consumer as two separate spans highlights the non-blocking activity that's taking place.