Skip to content

docs: clearer distributed tracing setup and troubleshooting#5597

Merged
thomhurst merged 1 commit intomainfrom
docs/distributed-tracing-clarity
Apr 17, 2026
Merged

docs: clearer distributed tracing setup and troubleshooting#5597
thomhurst merged 1 commit intomainfrom
docs/distributed-tracing-clarity

Conversation

@thomhurst
Copy link
Copy Markdown
Owner

Summary

  • Adds a symptom-driven Troubleshooting section to docs/examples/opentelemetry.md covering the five most common pain points reported in HTML report generation failed #5479 (mixed traces, orphan spans, propagator mismatch, missing HTTP propagation, no spans at all). Each entry leads with the symptom in plain English, gives a one-block fix, and only then explains why.
  • Adds a new Distributed Tracing guide at docs/guides/distributed-tracing.md consolidating per-backend setup (Seq, Jaeger/Tempo, Aspire, generic OTLP), correlation strategies, propagator alignment, and limitations. Surfaced in the Integrations sidebar next to the existing OpenTelemetry guide.
  • Moves the "use TestWebApplicationFactory<T>, not the vanilla WebApplicationFactory<T>" guidance into a top-of-page warning callout in docs/examples/aspnet.md so users see it before silently losing trace correlation.
  • Adds a short note to docs/guides/html-report.md explaining why the same Activity data renders differently in the HTML report vs. an OTel backend.

Cross-references the planned automation work in:

Each of those issues has a "Documentation" section listing which of these pages to revise when the automation lands, so the manual recipes added here can be trimmed in step.

Test plan

  • Build the docs site (docs/) and confirm the new page appears in the Integrations sidebar.
  • Verify all cross-page links resolve (./aspnet.md, ./distributed-tracing.md, anchors).
  • Skim render in the docs site preview to check callouts and tables.

Adds symptom-driven troubleshooting to the OpenTelemetry guide and a new
Distributed Tracing guide consolidating per-backend setup, correlation
strategies, and known limitations. Moves the "use TestWebApplicationFactory"
guidance into a top-of-page warning callout so users don't silently lose
trace correlation by inheriting from the vanilla WebApplicationFactory.

Cross-references issues #5589, #5590, #5591, #5592, #5593, #5594, #5595,
and #5596 which track the planned automation that will let later doc
revisions trim each manual recipe.
@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation Review

Overall this is well-structured, practical documentation. The symptom-driven troubleshooting format is exactly right for this kind of guide — users arrive with a problem, not a curiosity, so leading with the symptom and putting the explanation second is the correct priority order. The tag-reference tables are clear and the cross-references are tight. Good work.

A few things worth addressing:


1. TracedWebApplicationFactory<T> is documented before it exists

Both aspnet.md and opentelemetry.md present TracedWebApplicationFactory<T> as a usable escape hatch today:

var traced = new TracedWebApplicationFactory<Program>(myExistingFactory);
var client = traced.CreateClient(); // tracing + logging now wired up

But per the PR description, the actual implementation is tracked in #5594 (not yet merged). A user hitting the "My HTTP calls don't carry the test trace" symptom right now will find working-looking code that doesn't compile.

Suggested fix: Either defer those specific code blocks until #5594 ships, or wrap them in an :::caution admonition:

:::caution Coming soon
`TracedWebApplicationFactory<T>` is not yet available. Tracking: [#5594](https://github.com/thomhurst/TUnit/issues/5594). Until it ships, use `TestWebApplicationFactory<T>` directly.
:::

This is the most user-visible issue in the PR.


2. Propagator setup code is duplicated verbatim across two pages

The full CompositeTextMapPropagator block appears identically in both opentelemetry.md (troubleshooting) and distributed-tracing.md (cross-process section). If the recommended propagator set ever changes (e.g., adding B3Propagator for Zipkin compatibility), both pages drift independently.

Docusaurus supports MDX import for shared snippets:

<!-- docs/src/snippets/propagator-setup.mdx -->
```csharp
Sdk.SetDefaultTextMapPropagator(new CompositeTextMapPropagator([
    new TraceContextPropagator(),
    new BaggagePropagator(),
]));

Then in each page:
```md
import PropagatorSetup from '@site/src/snippets/propagator-setup.mdx';
<PropagatorSetup />

Not blocking, but will pay off when the propagator alignment automation (#5592) lands and changes the recommended setup.


3. Sidebar placement mixes guides/ into the Integrations category

guides/distributed-tracing is placed inside the "Integrations" sidebar category alongside examples/* entries. The project already does this (e.g., guides/performance in "Running Tests"), so it's not a new pattern, but it does mean a user browsing "Guides" in the sidebar won't find this page.

Given that this guide is explicitly about a cross-cutting concern (not a single integration), it might sit better as the last item in "Integrations" rather than sandwiched between two unrelated examples (opentelemetrydistributed-tracingfilebased-csharp). Minor, but the current position reads as if it's a sub-page of the OTel example rather than a standalone guide.


Minor

  • distributed-tracing.md links to /docs/examples/opentelemetry#spans-from-test-a-are-showing-up-under-test-b but the actual heading is "Spans from test A are showing up under test B" (with surrounding quotes). Docusaurus strips quotes for anchor generation so the link should resolve correctly, but worth verifying in the docs build.
  • The html-report.md callout note is a nice touch — exactly the kind of "same data, different view" confusion users hit and search for.

@thomhurst thomhurst merged commit 5d3df9b into main Apr 17, 2026
15 checks passed
@thomhurst thomhurst deleted the docs/distributed-tracing-clarity branch April 17, 2026 11:45
This was referenced Apr 17, 2026
This was referenced Apr 22, 2026
BenjaminMichaelis pushed a commit to IntelliTect/EssentialCSharp.Web that referenced this pull request Apr 25, 2026
Updated [TUnit](https://github.com/thomhurst/TUnit) from 1.35.2 to
1.37.10.

<details>
<summary>Release notes</summary>

_Sourced from [TUnit's
releases](https://github.com/thomhurst/TUnit/releases)._

## 1.37.10

<!-- Release notes generated using configuration in .github/release.yml
at v1.37.10 -->

## What's Changed
### Other Changes
* docs(test-filters): add migration callout for --filter →
--treenode-filter by @​johnkattenhorn in
thomhurst/TUnit#5628
* fix: re-enable RPC tests and modernize harness (#​5540) by @​thomhurst
in thomhurst/TUnit#5632
* fix(mocks): propagate [Obsolete] and null-forgiving raise dispatch
(#​5626) by @​JohnVerheij in
thomhurst/TUnit#5631
* ci: use setup-dotnet built-in NuGet cache by @​thomhurst in
thomhurst/TUnit#5635
* feat(playwright): propagate W3C trace context into browser contexts by
@​thomhurst in thomhurst/TUnit#5636
### Dependencies
* chore(deps): update tunit to 1.37.0 by @​thomhurst in
thomhurst/TUnit#5625

## New Contributors
* @​johnkattenhorn made their first contribution in
thomhurst/TUnit#5628
* @​JohnVerheij made their first contribution in
thomhurst/TUnit#5631

**Full Changelog**:
thomhurst/TUnit@v1.37.0...v1.37.10

## 1.37.0

<!-- Release notes generated using configuration in .github/release.yml
at v1.37.0 -->

## What's Changed
### Other Changes
* fix: stabilize flaky tests across analyzer, OTel, and engine suites by
@​thomhurst in thomhurst/TUnit#5609
* perf: engine hot-path allocation wins (#​5528 B) by @​thomhurst in
thomhurst/TUnit#5610
* feat(analyzers): detect collection IsEqualTo reference equality
(TUnitAssertions0016) by @​thomhurst in
thomhurst/TUnit#5615
* perf: consolidate test dedup + hook register guards (#​5528 A) by
@​thomhurst in thomhurst/TUnit#5612
* perf: engine discovery/init path cleanup (#​5528 C) by @​thomhurst in
thomhurst/TUnit#5611
* fix(assertions): render collection contents in IsEqualTo failure
messages (#​5613 B) by @​thomhurst in
thomhurst/TUnit#5619
* feat(analyzers): code-fix for TUnit0015 to insert CancellationToken
(#​5613 D) by @​thomhurst in
thomhurst/TUnit#5621
* fix(assertions): add Task reference forwarders on
AsyncDelegateAssertion by @​thomhurst in
thomhurst/TUnit#5618
* test(asp-net): fix race in FactoryMethodOrderTests by @​thomhurst in
thomhurst/TUnit#5623
* feat(analyzers): code-fix for TUnit0049 to insert [MatrixDataSource]
(#​5613 C) by @​thomhurst in
thomhurst/TUnit#5620
* fix(pipeline): isolate AOT publish outputs to stop clobbering pack
DLLs (#​5622) by @​thomhurst in
thomhurst/TUnit#5624
### Dependencies
* chore(deps): update tunit to 1.36.0 by @​thomhurst in
thomhurst/TUnit#5608
* chore(deps): update modularpipelines to 3.2.8 by @​thomhurst in
thomhurst/TUnit#5614


**Full Changelog**:
thomhurst/TUnit@v1.36.0...v1.37.0

## 1.36.0

<!-- Release notes generated using configuration in .github/release.yml
at v1.36.0 -->

## What's Changed
### Other Changes
* fix: don't render test's own trace as Linked Trace in HTML report by
@​thomhurst in thomhurst/TUnit#5580
* fix(docs): benchmark index links 404 by @​thomhurst in
thomhurst/TUnit#5587
* docs: replace repeated benchmark link suffix with per-test
descriptions by @​thomhurst in
thomhurst/TUnit#5588
* docs: clearer distributed tracing setup and troubleshooting by
@​thomhurst in thomhurst/TUnit#5597
* fix: auto-suppress ExecutionContext flow for hosted services (#​5589)
by @​thomhurst in thomhurst/TUnit#5598
* feat: auto-align DistributedContextPropagator to W3C by @​thomhurst in
thomhurst/TUnit#5599
* feat: TUnit0064 analyzer + code fix for direct WebApplicationFactory
inheritance by @​thomhurst in
thomhurst/TUnit#5601
* feat: auto-propagate test trace context through IHttpClientFactory by
@​thomhurst in thomhurst/TUnit#5603
* feat: TUnit.OpenTelemetry zero-config tracing package by @​thomhurst
in thomhurst/TUnit#5602
* fix: restore [Obsolete] members removed in v1.27 (#​5539) by
@​thomhurst in thomhurst/TUnit#5605
* feat: generalize OTLP receiver for use outside TUnit.Aspire by
@​thomhurst in thomhurst/TUnit#5606
* feat: auto-configure OpenTelemetry in TestWebApplicationFactory SUT by
@​thomhurst in thomhurst/TUnit#5607
### Dependencies
* chore(deps): update tunit to 1.35.2 by @​thomhurst in
thomhurst/TUnit#5581
* chore(deps): update dependency typescript to ~6.0.3 by @​thomhurst in
thomhurst/TUnit#5582
* chore(deps): update dependency coverlet.collector to v10 by
@​thomhurst in thomhurst/TUnit#5600


**Full Changelog**:
thomhurst/TUnit@v1.35.2...v1.36.0

Commits viewable in [compare
view](thomhurst/TUnit@v1.35.2...v1.37.10).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=TUnit&package-manager=nuget&previous-version=1.35.2&new-version=1.37.10)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.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.

1 participant