feat(ray): Support span streaming#6518
Conversation
Codecov Results 📊✅ 88762 passed | ⏭️ 6025 skipped | Total: 94787 | Pass Rate: 93.64% | Execution Time: 307m 54s All tests are passing successfully. ❌ Patch coverage is 33.33%. Project has 2490 uncovered lines. Files with missing lines (1)
Generated by Codecov Action |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a53ce3e. Configure here.
sentrivana
left a comment
There was a problem hiding this comment.
LGTM, see couple comments
| ): | ||
| try: | ||
| result = user_f(*f_args, **f_kwargs) | ||
| except Exception: |
There was a problem hiding this comment.
Should we set the span status to error here or is that already happening somewhere in the helper methods?
There was a problem hiding this comment.
The span status is set to error in StreamedSpan.__exit__() since we use the with ...: construct.
The integration has had this manual status management since the start (#2444), so I am assumed this isn't behavior we wish to keep (but please let me know if I'm missing something).
The only functional difference is when the exception is in the list used by should_be_treated_as_error().
| result = old_remote_method( | ||
| *args, **kwargs, _sentry_tracing=tracing | ||
| ) | ||
| except Exception: |
There was a problem hiding this comment.
Same q re: setting span status to error
|
|
||
| def setup_sentry(span_streaming=False, transport=None): | ||
| if span_streaming: | ||
| sentry_sdk._span_batcher.SpanBatcher.MAX_BEFORE_FLUSH = 1 |
There was a problem hiding this comment.
Is this needed/can we flush explicitly instead?
There was a problem hiding this comment.
I added this for the Ray worker. I couldn't find a hook to run code on teardown of the Ray task, and we finish the Ray segment span in the worker after the target function has returned.

Description
No attributes are changed as the integration does not set undocumented or deprecated attributes.
Use
RayLoggingTransporttransport in tests to capture streamed spans, as spans are not emitted synchronously like transactions.Adapting Tests
sedcommands used for converting transaction context managers:sedcommands used for converting event capture:sedcommands used for converting source:sedcommands used for convertingop:sedcommands used for converting origin:sedcommands used for convertingdescription:other test changes:
Issues
Closes #6051
Reminders
uv run ruff.feat:,fix:,ref:,meta:)