feat: add sentry.timestamp.sequence attribute to the spec#262
Conversation
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Documentation 📚
Internal Changes 🔧Deps
Deps Dev
Other
🤖 This preview updates automatically when you update the PR. |
sentry.log.sequence attribute to the specsentry.timestamp.sequence attribute to the spec
1e487d8 to
f412ffa
Compare
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.
There was a problem hiding this comment.
Pull request overview
Adds a new sequencing attribute intended to allow deterministic ordering when multiple items share the same timestamp (e.g., runtimes with frozen clocks), updating both the spec model and the generated conventions libraries.
Changes:
- Adds a new attribute definition JSON under
model/attributes/sentry/. - Updates Python conventions (
attributes.py) with a new attribute constant, metadata, and type mapping. - Updates JavaScript conventions (
attributes.ts) with a new attribute constant, metadata, and typings.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| python/src/sentry_conventions/attributes.py | Adds a new Sentry attribute constant + metadata + type mapping (currently for sentry.log.sequence). |
| model/attributes/sentry/sentry__timestamp__sequence.json | Introduces the spec definition for sentry.timestamp.sequence (currently missing changelog). |
| javascript/sentry-conventions/src/attributes.ts | Adds a new exported attribute constant + metadata + typings (currently for sentry.log.sequence). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "key": "false" | ||
| }, | ||
| "is_in_otel": false, | ||
| "example": 0 |
There was a problem hiding this comment.
All other model/attributes/sentry/*.json files include a changelog block, but this new attribute file does not. Please add an appropriate changelog entry (version + PR number) to match the established schema and ensure downstream generators include release provenance consistently.
| "example": 0 | |
| "example": 0, | |
| "changelog": [ | |
| { | |
| "version": "1.0.0", | |
| "pr": 12345 | |
| } | |
| ] |
Add attribute for deterministic ordering of logs and metrics when timestamps share the same integer millisecond. Starts at 0 on SDK init, increments by 1 per captured item, resets when the millisecond changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This reverts commit f412ffa.
Add attribute for deterministic ordering of logs and metrics when timestamps share the same integer millisecond. Starts at 0 on SDK init, increments by 1 per captured item, resets when the millisecond changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e56f596 to
5ec191f
Compare
This pull request introduces a new log attribute,
sentry. timestamp.sequence, to both the JavaScript and Python Sentry conventions libraries. It’s a monotonically incrementing integer used by the SDK to ensure correct log ordering when timestamps are identical.The attribute is optional, and not required to be sent by SDKs. Only required if certain runtime environments has unreliable timestamp generation.
The attribute addresses an issue that came up in Cloudflare’s runtime which freezes all timers and clock functions, causing all timestamp calls to return the same value. This can lead to logs being displayed out of order if they don’t get sent in one request. Instead, they’ll appear in the order of arrival in ingest, which is subject to request latencies and out-of-order request completion.
Related PRs:
sentry.timestamp.sequencedefinition to the logs and metrics specs sentry-docs#16492sentry.timestamp.sequenceattribute for timestamp tie-breaking sentry-javascript#19421PR Checklist
yarn testand verified that the tests pass.yarn generate && yarn formatto generate and format code and docs.If an attribute was added:
nextjs.function_id, notfunction_id)pii(i.e.maybeortrue. Usefalseonly for values that should never be scrubbed such as IDs)If an attribute was deprecated: