Skip to content

Add handler.type OpenTelemetry tag for handlers and HTTP endpoints#2424

Merged
jeremydmiller merged 1 commit intomainfrom
2416-handler-type-otel-tag
Apr 3, 2026
Merged

Add handler.type OpenTelemetry tag for handlers and HTTP endpoints#2424
jeremydmiller merged 1 commit intomainfrom
2416-handler-type-otel-tag

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Summary

Closes #2416

Tags the current System.Diagnostics.Activity with the handler type name during both message processing and HTTP request handling, providing per-handler tracing visibility in OpenTelemetry backends (Jaeger, Zipkin, Honeycomb, etc.).

  • handler.type tag added to activity spans for both message handlers and Wolverine.HTTP endpoints
  • message.handler tag retained on message handlers for backward compatibility (same value as handler.type)
  • Tag values are memoized as string literals in Wolverine's generated code — zero runtime cost per request
  • New TagHttpHandlerPolicy (IHttpPolicy) registered as a built-in policy in WolverineHttpOptions
  • 3 integration tests using ActivityListener to verify tags are set correctly
  • Documentation added to the "Instrumentation and Metrics" guide

Example tags

Message handler activity:

handler.type = "MyApp.Handlers.OrderPlacedHandler"
message.handler = "MyApp.Handlers.OrderPlacedHandler"

HTTP endpoint activity:

handler.type = "MyApp.Endpoints.OrderEndpoint"

Test plan

  • 3 new tests in CoreTests.Runtime.handler_type_activity_tagging — all passing
  • Verify HTTP endpoint tagging in Wolverine.Http.Tests

🤖 Generated with Claude Code

…oints

Tag the current Activity with the handler type name during message
processing and HTTP request handling, providing per-handler tracing
visibility in OpenTelemetry backends. The tag value is memoized as a
string literal in generated code.

Closes #2416

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verify OpenTelemetry Activity is tagged with handler name

1 participant