Skip to content

docs: correct workers tracing sampling description#81

Merged
ankurs merged 1 commit intomainfrom
docs/fix-workers-tracing-sampling
Apr 27, 2026
Merged

docs: correct workers tracing sampling description#81
ankurs merged 1 commit intomainfrom
docs/fix-workers-tracing-sampling

Conversation

@ankurs
Copy link
Copy Markdown
Member

@ankurs ankurs commented Apr 27, 2026

Summary

The workers tracing docs claimed worker spans are "always sampled regardless of the global sampler" — this is no longer accurate. The current middleware.Tracing() implementation uses tracing.NewInternalSpan which respects the global sampler.

Updated the description to reflect actual behavior: worker spans are typically trace roots, so sampling follows the global TracerProvider's sampler. If using ParentBased(TraceIDRatioBased(...)) with a low ratio, worker spans may be dropped — users should configure AlwaysSample() if needed.

Test plan

  • Visual review — wording matches actual workers/middleware/tracing.go behavior

Summary by CodeRabbit

  • Documentation
    • Updated tracing documentation to clarify how worker spans are sampled by the global TracerProvider and provided guidance on configuring sampling strategies for worker cycles to ensure consistent tracing behavior.

Worker spans now respect the global sampler — the previous force-sampling
behavior was removed. Update the description to match current behavior.
Copilot AI review requested due to automatic review settings April 27, 2026 11:53
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8b46a22d-46f0-44f6-94e0-76d16ce82f6c

📥 Commits

Reviewing files that changed from the base of the PR and between 92e8140 and 365dde4.

📒 Files selected for processing (1)
  • howto/workers.md

📝 Walkthrough

Walkthrough

Updated worker tracing documentation to clarify that worker:<name>:cycle spans are typically trace roots whose sampling follows the global TracerProvider sampler, with added guidance on sampler configuration options.

Changes

Cohort / File(s) Summary
Worker Tracing Documentation
howto/workers.md
Revised description of worker:<name>:cycle span sampling behavior. Now clarifies these are trace roots following global sampler behavior rather than always being independently sampled. Added guidance on using AlwaysSample() when all cycles should be traced and noted that ParentBased(TraceIDRatioBased(...)) with low ratios may drop worker spans.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A worker's span now clearly traced,
Where sampler rules are now embraced,
No more mystery in the light,
Global guidance shining bright! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: correcting the documentation about workers tracing sampling behavior to accurately reflect how the middleware respects the global sampler.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/fix-workers-tracing-sampling

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the workers tracing documentation to reflect that worker cycle spans are sampled according to the global OpenTelemetry TracerProvider sampler (rather than being force-sampled), clarifying how root-span sampling can drop worker traces under low sampling ratios.

Changes:

  • Corrects the tracing section to state worker spans typically have no parent and therefore follow the global sampler.
  • Adds guidance that low ParentBased(TraceIDRatioBased(...)) ratios can probabilistically drop worker spans and suggests using AlwaysSample() when full coverage is required.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ankurs ankurs merged commit 216518c into main Apr 27, 2026
11 checks passed
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.

2 participants