opentracing / specification

A place to document (and discuss) the OpenTracing specification. 🛑 This project is DEPRECATED! https://github.com/opentracing/specification/issues/163
http://opentracing.io/spec
Apache License 2.0
1.18k stars 182 forks source link

"ParentOf" reference type and way to add new references to existing spans? #74

Open cce opened 7 years ago

cce commented 7 years ago

I'm curious if there would be interest in adding a "ParentOf" reference type for modeling cases where context is propagated upstream from a child to a parent span, rather than from parent to child as "ChildOf" models.

This line of thought comes from discussions we had at the last distributed tracing workshop with @JonathanMace about comparing the OpenTracing model to his research on event-based models like X-Trace that support a wider array of reference types like fan-in, spans that are batched together, etc.

You could imagine using "ParentOf" to capture context that was propagated upstream in response headers, using Inject/Extract as with request headers. (This could also open the possibility of propagating baggage upstream as well.)

To do it, I believe you would need a way to add references to an existing span, which I don't see in the spec — I only see a way to add references when you start a new span. The spec does say this though about future reference types:

In the future, OpenTracing may also support reference types for Spans with non-causal relationships (e.g., Spans that are batched together, Spans that are stuck in the same queue, etc).

I could imagine that to support a future reference types for spans that are batched together, you might also want to be able to call Span.AddReference() to add references after a span has already been created, e.g. if you don't have the whole batch of references available when creating the new span, or need to iterate over them.

Loosely-related ticket proposing a reference type between traces: #51

cce commented 7 years ago

@JonathanMace pointed out that during the DT workshop in February he already opened tickets for adding a reference partway through (#42) as well as a response-path reference type (#43), so this ticket is redundant.

cce commented 7 years ago

Jonathan also has a cool picture in https://github.com/opentracing/specification/issues/42#issuecomment-281665745