Skip to content

ref: Rename _timestamp to _end_timestamp#6235

Merged
sentrivana merged 7 commits intomasterfrom
ivana/rename-timestamp-to-end-timestamp
May 7, 2026
Merged

ref: Rename _timestamp to _end_timestamp#6235
sentrivana merged 7 commits intomasterfrom
ivana/rename-timestamp-to-end-timestamp

Conversation

@sentrivana
Copy link
Copy Markdown
Contributor

@sentrivana sentrivana commented May 7, 2026

The field capturing the end timestamp of a span used to be called timestamp in legacy mode (on the Span class), with start_timestamp as its counterpart.

In span streaming, we originally followed the same convention on the new StreamedSpan class, but there's actually no reason to and it'd be better to use end_timestamp instead:

  • the field on the serialized span v2 is actually called end_timestamp
  • end_timestamp is a clearer name in general, and complements start_timestamp nicely

Comment thread sentry_sdk/traces.py
Comment thread sentry_sdk/traces.py
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Codecov Results 📊

12 passed | Total: 12 | Pass Rate: 100% | Execution Time: 2.13s

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

❌ Patch coverage is 73.68%. Project has 14649 uncovered lines.
✅ Project coverage is 33.18%. Comparing base (base) to head (head).

Files with missing lines (3)
File Patch % Lines
tracing_utils.py 51.07% ⚠️ 389 Missing and 61 partials
traces.py 78.91% ⚠️ 66 Missing and 27 partials
_span_batcher.py 77.24% ⚠️ 28 Missing and 12 partials
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    33.18%    33.18%        —%
==========================================
  Files          190       190         —
  Lines        21918     21924        +6
  Branches      7374      7378        +4
==========================================
+ Hits          7272      7275        +3
- Misses       14646     14649        +3
- Partials       661       661         —

Generated by Codecov Action

@sentrivana sentrivana marked this pull request as ready for review May 7, 2026 12:31
@sentrivana sentrivana requested a review from a team as a code owner May 7, 2026 12:31
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ea2436c. Configure here.

Comment thread sentry_sdk/traces.py
def timestamp(self) -> "Optional[datetime]":
return self._timestamp
def end_timestamp(self) -> "Optional[datetime]":
return self._end_timestamp
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Renamed property breaks openai_agents integration at runtime

High Severity

The timestamp property on StreamedSpan was renamed to end_timestamp, but three call sites in the openai_agents integration still access span.timestamp on spans that can be StreamedSpan instances (when span streaming is enabled via get_start_span_function). This causes an AttributeError at runtime. The most critical site is in _run_single_turn (agent_run.py), where the AttributeError is not wrapped in capture_internal_exceptions(), so it replaces the original exception being handled.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ea2436c. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If this is true, how come our tests didn't catch this? 🙈

Copy link
Copy Markdown
Contributor Author

@sentrivana sentrivana May 7, 2026

Choose a reason for hiding this comment

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

Ah right, openai agents doesn't support span streaming yet, so that's ok.

@sentrivana sentrivana marked this pull request as draft May 7, 2026 12:39
@sentrivana sentrivana marked this pull request as ready for review May 7, 2026 12:40
@sentrivana sentrivana merged commit 575edf9 into master May 7, 2026
154 of 156 checks passed
@sentrivana sentrivana deleted the ivana/rename-timestamp-to-end-timestamp branch May 7, 2026 14:02
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