Skip to content

Fix OpenTelemetry span status for failed tasks (#136)#137

Merged
chrisguidry merged 1 commit intomainfrom
fix-span-status-on-failures
Jun 19, 2025
Merged

Fix OpenTelemetry span status for failed tasks (#136)#137
chrisguidry merged 1 commit intomainfrom
fix-span-status-on-failures

Conversation

@chrisguidry
Copy link
Owner

Summary

  • Fix OpenTelemetry spans not being marked as failing when tasks fail and are retried
  • Set span status to ERROR when tasks fail, regardless of retries
  • Set span status to OK when tasks succeed
  • Use record_exception() for proper exception tracking
  • Capture span directly from context manager instead of get_current_span()

Closes #136

🤖 Generated with Claude Code

@github-actions
Copy link

github-actions bot commented Jun 19, 2025

📚 Documentation has been built for this PR!

You can download the documentation directly here:
https://github.com/chrisguidry/docket/actions/runs/15768172105/artifacts/3366520683

@codecov-commenter
Copy link

codecov-commenter commented Jun 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (ca58e02) to head (3266af0).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #137   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           27        27           
  Lines         3293      3354   +61     
  Branches       186       189    +3     
=========================================
+ Hits          3293      3354   +61     
Flag Coverage Δ
python-3.12 100.00% <100.00%> (ø)
python-3.13 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/docket/worker.py 100.00% <100.00%> (ø)
tests/test_instrumentation.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chrisguidry chrisguidry force-pushed the fix-span-status-on-failures branch from 588703b to 3266af0 Compare June 19, 2025 23:57
@chrisguidry chrisguidry merged commit 6d83b40 into main Jun 19, 2025
12 checks passed
@chrisguidry chrisguidry deleted the fix-span-status-on-failures branch June 19, 2025 23:58
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.

OpenTelemetry span failures versus retries

3 participants