dotnet-sdk icon indicating copy to clipboard operation
dotnet-sdk copied to clipboard

[FEATURE] Add support for spans instead of span events

Open beeme1mr opened this issue 2 months ago • 2 comments

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

beeme1mr avatar Oct 03 '25 20:10 beeme1mr

I believe this is a duplicate of #541.

What are your thoughts @beeme1mr and @WeihanLi ?

askpt avatar Oct 06 '25 08:10 askpt

It doesn't look like #541 is the same as this ticket. However, the improvements suggested by @WeihanLi make sense to me.

beeme1mr avatar Oct 06 '25 16:10 beeme1mr