Skip to content

Commit

Permalink
Fix vercel transport OTEL attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofzuraw committed Oct 23, 2024
1 parent 7d1205c commit 96ab164
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .changeset/weak-crabs-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@saleor/apps-logger": patch
---

Added missing OTEL attributes to `loggerVercelTransport`. They will be visible under `otel` key in log collection service.

Attributes:
* `span_id`
* `trace_id`
* `timestamp`
6 changes: 6 additions & 0 deletions packages/logger/src/logger-vercel-transport.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { trace } from "@opentelemetry/api";
import * as Sentry from "@sentry/nextjs";
import { ILogObj, Logger } from "tslog";

Expand All @@ -21,6 +22,11 @@ export const attachLoggerVercelTransport = (
deployment: {
environment: process.env.ENV,
},
otel: {
span_id: trace.getActiveSpan()?.spanContext().spanId,
trace_id: trace.getActiveSpan()?.spanContext().traceId,
timestamp: _meta.date.getTime(),
},
"commit-sha": process.env.VERCEL_GIT_COMMIT_SHA,
service: {
name: process.env.OTEL_SERVICE_NAME,
Expand Down

0 comments on commit 96ab164

Please sign in to comment.