ref(spans): Remove unused end_timestamp from Span NamedTuple#109788
ref(spans): Remove unused end_timestamp from Span NamedTuple#109788
Conversation
The end_timestamp field on the buffer's Span NamedTuple was dead code. _prepare_payloads stored timestamps as dict values, but the only caller used p.sadd(set_key, *set_members.keys()), discarding the values entirely. Simplify _prepare_payloads to return a set instead of a dict. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
can we remove this assertion as well? also, I'm not sure if start_timestamp is used.
17b9eab to
6ce3add
Compare
The start_timestamp and end_timestamp assertions in validate_span_event only protected downstream systems, not the span buffer itself. Downstream consumers should validate their own inputs. Co-Authored-By: Claude <noreply@anthropic.com>
lvthanh03
left a comment
There was a problem hiding this comment.
The schema still requires start_timestamp and end_timestamp, the spans we produce to buffered-segments still have these attributes right?
|
@lvthanh03 yeah but i would argue the span buffer should not validate this constraint. segments consumer should protect itself |
Address review feedback: fix set[str | bytes, float] -> set[str | bytes] and update docstring to reflect the method now returns a set, not a dict.
…-timestamp # Conflicts: # src/sentry/spans/buffer.py # tests/sentry/spans/consumers/process/test_consumer.py
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
New tests added on master also used end_timestamp in Span() constructors.
Backend Test FailuresFailures on
|
This test validated end_timestamp type checking which we've removed.

This is a leftover from the time we used end_timestamp to trim segments intelligently. Now we moved to unsorted sets, and it's no longer needd.
Co-Authored-By: Claude noreply@anthropic.com