Skip to content

[FEATURE] Add support for spans instead of span events #595

@beeme1mr

Description

@beeme1mr

Requirements

Currently, the TraceEnricherHook hook creates a span event on the active span. This is in line with the OpenTelemetry semantic convention. However, in some cases, it's preferred to have a span instead of a span event. The hook should take an optional configuration that allows users to opt into a span instead of a span event. The default behavior should remain a span event but this would provide additional flexibility without minimal maintenance effort.

Proposal

  • Add an option to the TraceEnricherHook hook that allows users to choose between span events or spans. It must default to span events if unspecified.
  • If spans are selected:
    • a span is started in the before hook and passed via hook data.
    • the span is fetched from hook data, attributes are added, and the span is closed
  • If span events are selected:
    • a span is NOT created in the before hook
    • a span event is added to the current span

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: sdkThis issue or pull request relates to an SDKarea: telemetry-hooksImprovements or bugs to telemetry hookstype: featNew feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions