Skip to content

fix(trace-logs): timestamp_precise is a number, not a string#322

Closed
BYK wants to merge 6 commits intomainfrom
feat/trace-logs
Closed

fix(trace-logs): timestamp_precise is a number, not a string#322
BYK wants to merge 6 commits intomainfrom
feat/trace-logs

Conversation

@BYK
Copy link
Member

@BYK BYK commented Mar 3, 2026

Fixes a runtime Zod validation error when running sentry trace logs. The trace-logs API returns timestamp_precise as a nanosecond integer (same as Explore/Events logs), not an ISO string as originally assumed.

Changes:

  • TraceLogSchema.timestamp_precise: z.string()z.number()
  • Updated JSDoc and test fixtures to match

Follow-up to #311.

BYK and others added 5 commits March 1, 2026 14:56
Implements the `sentry trace logs` subcommand to view logs associated
with a distributed trace via the dedicated `/organizations/{org}/trace-logs/`
endpoint (org-scoped, queries all projects automatically).

- Adds TraceLog/TraceLogsResponse Zod schemas and types
- Adds `listTraceLogs()` to api-client using region-aware routing
- Adds trace-log formatters to log.ts (batch table + plain markdown)
- New command with flags: --json, --period/-t, --limit/-n, --query/-q, --web/-w
- Positional: `<trace-id>`, `<org> <trace-id>`, or `<org>/<trace-id>`
- 33 tests; 2394 passing total, 0 failures
Replace the 4 trace-log-specific formatter functions with a shared LogLike
interface and an includeTrace param on buildLogRowCells. The only real
difference was suppressing the trace-ID suffix — both SentryLog and TraceLog
carry the same timestamp/severity/message shape.

Net: -80 lines, no new abstractions.
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (api) Add --data/-d flag and auto-detect JSON body in fields by BYK in #320
  • (formatters) Render all terminal output as markdown by BYK in #297
  • (issue-list) Global limit with fair distribution, compound cursor, and richer progress by BYK in #306
  • (trace) Add sentry trace logs subcommand (Add CLI support for fetching logs associated with a trace #247) by BYK in #311

Bug Fixes 🐛

Api

  • Use numeric project ID to avoid "not actively selected" error by betegon in #312
  • Use limit param for issues endpoint page size by BYK in #309
  • Auto-correct ':' to '=' in --field values with a warning by BYK in #302

Formatters

  • Expand streaming table to fill terminal width by betegon in #314
  • Fix HTML entities and escaped underscores in table output by betegon in #313

Other

  • (ci) Generate JUnit XML to silence codecov-action warnings by BYK in #300
  • (nightly) Push to GHCR from artifacts dir so layer titles are bare filenames by BYK in #301
  • (region) Resolve DSN org prefix at resolution layer by BYK in #316
  • (test) Handle 0/-0 in getComparator anti-symmetry property test by BYK in #308
  • (trace-logs) Timestamp_precise is a number, not a string by BYK in #322

Internal Changes 🔧

Api

  • Upgrade @sentry/api to 0.21.0, remove raw HTTP pagination workarounds by BYK in #321
  • Wire listIssuesPaginated through @sentry/api SDK for type safety by BYK in #310

🤖 This preview updates automatically when you update the PR.

The trace-logs API returns timestamp_precise as a nanosecond integer,
same as the Explore/Events logs endpoint. The schema incorrectly
declared it as z.string() which caused Zod validation failures at
runtime.
@BYK BYK force-pushed the feat/trace-logs branch from 9c83bc9 to c12944c Compare March 3, 2026 01:12
@BYK BYK closed this Mar 3, 2026
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.

1 participant