You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
+semver:minor - feat: add Activity tracing for OpenTelemetry support (thomhurst#4844)
* feat: add System.Diagnostics.Activity tracing for OpenTelemetry-compatible instrumentation
Add first-party trace spans at every level of the test lifecycle (session,
assembly, class, test) using System.Diagnostics.ActivitySource. Users get
OpenTelemetry-compatible tracing automatically when they configure an exporter.
Zero cost when no listener is attached.
- Add TUnitActivitySource singleton with StartActivity/RecordException/StopActivity helpers
- Add Activity property to Context base class (inherited by all context types)
- Start/stop session, assembly, class spans in HookExecutor
- Start/stop test spans in TestExecutor with result/skip/retry tags
- Stop failed attempt Activity on retry in RetryHelper
- All Activity code behind #if NET (ActivitySource requires .NET 5+)
- Explicit ActivityContext parenting for parallel safety
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: align activity tracing with OpenTelemetry semantic conventions
- Span names: use verb+object pattern (test session, test assembly, test suite, test case)
- Use OTel test.* namespace: test.case.name, test.case.result.status, test.suite.name
- Result values: lowercase per OTel (pass/fail/skipped instead of Passed/Failed/Skipped)
- Status codes: leave Unset on success (not Ok) per instrumentation library conventions
- Add error.type tag alongside exception events per OTel recording-errors spec
- Categories: pass as string[] array instead of comma-joined string
- Remove redundant HasListeners() guard (StartActivity returns null natively)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add OpenTelemetry tracing integration guide
Covers ActivitySource subscription, span hierarchy, attribute reference
tables, status conventions, retry behavior, and exporter setup examples.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* perf: guard StartActivity call sites with HasListeners() check
Wrap all 4 StartActivity call sites with TUnitActivitySource.Source.HasListeners()
so that tag collection expressions, string.Join, and ToArray allocations are
never evaluated when no listener is attached. This ensures true zero-cost
when tracing is disabled, per CLAUDE.md Rule 4 (Performance First).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
0 commit comments