Skip to content

SpanContext and Link spec/proto are not clear #1667

@dyladan

Description

@dyladan

From SpanContext spec https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#spancontext:

SpanContext contains traceId, spanId, TraceFlags, and TraceState.

From Link specification https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#specifying-links:

A Link contains a SpanContext and zero or more Attributes.

From proto definition of Link https://github.com/open-telemetry/opentelemetry-proto/blob/a17f202fdae65e828ac29fb663b5bc5b64b13290/opentelemetry/proto/trace/v1/trace.proto#L197:

Link contains trace_id, span_id, and trace_state, but does not contain TraceFlags.

Thus, if a user wants to create a Link they must first create or get a SpanContext which has a valid TraceFlags. TraceFlags are not included in the Link proto so it might be confusing to the user to have to specify flags for the link which have no effect.

I would suggest that the Link spec is modified to specifically state that only the fields included in the proto are required for a link.

This issue was originally brought to my attention by follow up from an issue @carlosalberto filed on the JS API suggesting we use SpanContext in our Link type instead of the LinkContext type we had created specifically for this purpose.

Metadata

Metadata

Assignees

Labels

area:span-relationshipsRelated to span relationshipsspec:protocolRelated to the specification/protocol directoryspec:traceRelated to the specification/trace directory

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions