Skip to content

Document span events <-> log-based events conversion #4393

@lmolkova

Description

@lmolkova

The long term vision for events is to leverage log based events instead of span events.

There are different (not mutually-exclusive) migration strategies we could use:

  1. Producers may switch to logs API gradually following Span Events API deprecation
  2. SDK may start converting span events to log-based events (based on the opt-in feature flag)
  3. OTel (or vendors) may provide SDK and collector processors that perform conversion
  4. Backends can handle span events and log-based events in a similar way on the ingestion side
    ...

span event -> log event conversion is as trivial as:

Span event property Log event property
Name EventName
Timestamp (if provided) Timestamp
Attributes Attributes
Span context Span context
Severity: not provided
Body: not provided

With the only challenge being getting access to Logs SDK pipeline from Trace SDK


log events -> span events is more complicated.

The motivation to define this conversion is to support

  • backends such as Jaeger that support traces and not logs
  • provide backward compatibility for other possible cases
Log event property Span event property
EventName Name if EventName is provided, define convention otherwise - e.g. otel.log
Timestamp (if provided) Timestamp
Observed timestamp (if Timestamp not provided) Timestamp
Attributes (standard) Attributes
Attributes (extended) Drop, flatten, or serialize extended attributes
Span context Attach to current span or drop if there is no current span.
Severity Number (if provided) Define semantic convention (log.record.severity.number)
Severity Text (if provided) Define semantic convention (log.record.severity.text)
Body Drop, flatten, or serialize to log.record.body

We should document translation rules to have consistency across languages. Implementation would remain optional and done as a part of contrib repos, but this might change depending on the migration path.

Related:

Metadata

Metadata

Assignees

No one assigned

    Labels

    sig-issueA specific SIG should look into this before discussing at the specspec:logsRelated to the specification/logs directory

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions