Skip to content

Feature/richer traces#5

Merged
Polliog merged 7 commits intomainfrom
feature/richer-traces
Feb 28, 2026
Merged

Feature/richer traces#5
Polliog merged 7 commits intomainfrom
feature/richer-traces

Conversation

@Polliog
Copy link
Contributor

@Polliog Polliog commented Feb 28, 2026

This pull request introduces LogTide SDK version 0.6.0, focusing on improved tracing, richer metadata, and new APIs for hierarchical span management. The most significant changes include the addition of OTLP Span Events, new child span APIs, standardized span attributes, and enhanced error and response handling across frameworks. The update also includes bug fixes and version bumps for all packages.

Tracing and Span Management Enhancements:

  • Added support for OTLP Span Events: Breadcrumbs are now automatically converted to OTLP Span Events, providing a detailed timeline in the trace viewer. [1] [2] [3]
  • Introduced new startChildSpan() and finishChildSpan() APIs in @logtide/core for creating and finishing hierarchical child spans, with corresponding unit tests. [1] [2] [3]

Richer Metadata and Standardization:

  • Added standardized span attributes to request spans: http.user_agent, net.peer.ip, http.query_string at span start, and http.status_code, duration_ms, http.route at span finish. [1] [2] [3]
  • Breadcrumbs and Angular HTTP Interceptor now include more request/response metadata, such as method, URL, status, and duration. [1] [2] [3]

Framework Integrations and Error Handling:

  • Exported logtideErrorHandler for Express to capture unhandled errors and associate them with the current request scope.
  • Improved Nuxt and Angular tracing: Nitro plugin and Angular HTTP Interceptor now accurately capture response status codes and durations for both successful and failed requests. [1] [2] [3]

Bug Fixes:

  • Fixed a bug in Nuxt Nitro plugin where spans were always marked as 'ok' regardless of the actual response status.

Version Updates:

  • Bumped all package versions to 0.6.0 to reflect the new release. (package.json, packages/core/package.json, packages/angular/package.json) [1] [2] [3]

…ser agent, IP, breadcrumb events

- Add http.user_agent, net.peer.ip, http.query_string attributes at span start
- Populate request breadcrumb data field (method, url, userAgent)
- Track startTime locally for accurate duration_ms calculation
- Set http.status_code, http.route, duration_ms as extra attributes at span finish
- Convert scope breadcrumbs to SpanEvent[] and pass to finishSpan for OTLP timeline
- Add response breadcrumb (level-aware: error/warn/info) before finishing span
- Include duration_ms in 5xx captureLog metadata
- Add includeRequestBody / includeRequestHeaders opt-in options (with header sanitization)
- Export logtideErrorHandler() from Express package for unhandled error capture
…e, harden headers denylist, move startTime capture

- Export logtideErrorHandler from @logtide/express public index
- Change http.status_code in captureLog from String(status) to status (number) for type consistency with span extraAttributes
- Move SENSITIVE_HEADERS Set to module level (avoid re-creating on every request); add set-cookie and proxy-authorization to the denylist
- Move startTime = Date.now() before addBreadcrumb so it captures actual request receipt time
- Merge duplicate type imports from @logtide/core into a single import line
- Replace (request as any).body casts with (request as unknown as { body?: unknown }).body in Fastify middleware
- Fix misleading test name: "should not set http.user_agent when User-Agent header is absent" -> "should set http.user_agent when User-Agent header is present"
…breadcrumb events

- Add http.user_agent, net.peer.ip (x-forwarded-for), http.query_string to span start attributes
- Populate request breadcrumb data field with method, url, userAgent
- Capture startTime before breadcrumb for accurate duration measurement
- Add response breadcrumb (type/category/level/data) before finishSpan
- Convert scope breadcrumbs to SpanEvent[] and pass via finishSpan events option
- Include http.status_code and duration_ms in extraAttributes on finishSpan
- Forward http.route from Hono routePath when available
- Add duration_ms to 5xx captureLog metadata
- Handle catch block in Hono with response breadcrumb + events on finishSpan
- Handle onError in Elysia with response breadcrumb + events on finishSpan
- Store startTime in Elysia spanMap entry for accurate per-request duration
- Add richer traces tests for both packages (status code, user agent, duration, events, query string, ip, route data)
…elysia format

Extract a local breadcrumbsToEvents helper in both packages and replace
the old flat data-key conversion with the richer format that includes
breadcrumb.type, breadcrumb.category, breadcrumb.level, and data.* prefixed
keys, matching the implementation already used by @logtide/hono and @logtide/elysia.
@Polliog Polliog merged commit fcbaa97 into main Feb 28, 2026
8 checks passed
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