Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/spicy-dingos-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@vercel/otel": patch
---

fix: don't inline system env vars
8 changes: 2 additions & 6 deletions packages/otel/src/instrumentations/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,8 @@ export class FetchInstrumentation implements Instrumentation {
}

private shouldPropagate(url: URL, init?: InternalRequestInit): boolean {
const host =
process.env.VERCEL_URL || process.env.NEXT_PUBLIC_VERCEL_URL || null;
const branchHost =
process.env.VERCEL_BRANCH_URL ||
process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL ||
null;
const host = process.env.VERCEL_URL || null;
const branchHost = process.env.VERCEL_BRANCH_URL || null;
const propagateContextUrls = this.config.propagateContextUrls ?? [];
const dontPropagateContextUrls = this.config.dontPropagateContextUrls ?? [];
if (init?.opentelemetry?.propagateContext) {
Expand Down
16 changes: 4 additions & 12 deletions packages/otel/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,12 @@ export class Sdk {
// Vercel.
// https://vercel.com/docs/projects/environment-variables/system-environment-variables
// Vercel Env set as top level attribute for simplicity. One of 'production', 'preview' or 'development'.
env: process.env.VERCEL_ENV || process.env.NEXT_PUBLIC_VERCEL_ENV,
env: process.env.VERCEL_ENV,
"vercel.region": process.env.VERCEL_REGION,
"vercel.runtime": runtime,
"vercel.sha":
process.env.VERCEL_GIT_COMMIT_SHA ||
process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA,
"vercel.host":
process.env.VERCEL_URL ||
process.env.NEXT_PUBLIC_VERCEL_URL ||
undefined,
"vercel.branch_host":
process.env.VERCEL_BRANCH_URL ||
process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL ||
undefined,
"vercel.sha": process.env.VERCEL_GIT_COMMIT_SHA,
"vercel.host": process.env.VERCEL_URL || undefined,
"vercel.branch_host": process.env.VERCEL_BRANCH_URL || undefined,
"vercel.deployment_id": process.env.VERCEL_DEPLOYMENT_ID || undefined,
[SemanticResourceAttributes.SERVICE_VERSION]:
process.env.VERCEL_DEPLOYMENT_ID,
Expand Down