Skip to content

otel.name attribute should apply to events as well as spans #217

Open
@shaylew

Description

@shaylew

Feature Request

Motivation

Currently there's a special/reserved attribute otel.name that can be used to send a dynamic value as the name of a span, which is supported just fine in opentelemetry but not otherwise a thing in the broader tracing environment.

This only works for spans, not for events, which is a little surprising. The use cases for dynamic event names are more or less the same as for dynamic span names, and I imagine the implementation would look similar too.

Proposal

The otel.name field, when used on a span, should set the name of the resulting span (overriding whatever static name is present). The other otel.xxx attributes don't make any sense on events and should continue not to apply.

Docs should probably mention for completeness that otel.name works on events as well as spans, though maybe that's less of a priority -- it's easy to assume it works the same, the surprise is that it currently does not.

Alternatives

Just making otel.name work for both seems like the approach that's most concordant with the existing API. I suppose there could be a separate namespace for span and event magic attributes, but that horse has more or less already flown with otel.name being un-namespaced.

I have been asked by coworkers "hey, what on earth is that otel.name doing", and perhaps exporting the attribute names which have special meanings as constants would be a chance to attach more discoverable documentation to them and distinguish the span- and event-applicable ones without any breaking change, but that's really orthogonal to the main issue of getting dynamic names on events working some way or other.

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