Skip to content

encoding of context flags in otlp messages #382

@blumamir

Description

@blumamir

The spec for tracing includes a trace flags in the context:

TraceFlags contain details about the trace. Unlike TraceState values, TraceFlags are present in all traces. The current version of the specification only supports a single flag called sampled.

However, the otlp proto message has no appropriate proto field to store the flags for message Span and message Link.

I think the flags are important to be encoded in the otlp format for the following reasons:

  • It is handy that when holding a link, to be able to tell if it points on a sampled or non sampled span. For example in messaging specification, a consumer may link to a producer span, but it is possible and common that the consumer is sampled and the producer is not. Currently, consumer links just store trace_id, span_id and trace_state. If someone tries to follow the link and cannot find the source span, there is no way to tell if it was not sampled (valid) or simply missing (lost - invalid). It is can also be expensive to follow a link (query to db) - and by knowing if a link is sampled or not one can skip this operation for processing and visualization purposes. There can also be UI value in presenting a link when it is not sampled vs sampled link.
  • OTLP can be handy for storing spans, not only for transmitting them. For transmitting spans from SDKs to collector, we do not anticipate any non-sampled spans. However, someone might need to serialize and deserialize non-sampled spans (for example - to debug) in which case this data will currently be lost. I think protocol should support this kind of use-cases
  • Even though flags currently only support single "sampled" flag, they can be extended in the future to hold new values. We cannot anticipate the use of these future values, and having them in the otlp model will allow using it always.

Does it make sense to add "trace_flags" field to Span and Link messages in proto? or are there any good reasons why no to include them?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions