-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
@vercel/otel
to setup OTEL (#1750)
* Migrate AvaTax * add example sampler * add http instrumentation * resource attributes * bring back sampler * remove env * use ATTR_DEPLOYMENT_ENVIRONMENT * unset var * cleanup * Migrate other apps * Add changesets * Update CMS dep & tsconfig * remove patches * update commet
- Loading branch information
1 parent
e5f0504
commit e3fe0f7
Showing
49 changed files
with
527 additions
and
962 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@saleor/apps-otel": minor | ||
--- | ||
|
||
Update functions exported from package and deps. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
"saleor-app-products-feed": patch | ||
"saleor-app-klaviyo": patch | ||
"saleor-app-segment": patch | ||
"saleor-app-avatax": patch | ||
"saleor-app-search": patch | ||
"saleor-app-smtp": patch | ||
"saleor-app-cms": patch | ||
--- | ||
|
||
Use `@vercel/otel` package to setup OTEL. After this change spans will be automatically flushed by Vercel. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/* eslint-disable node/no-process-env */ | ||
// Use `process.env` here to avoid broken Next.js build | ||
|
||
export async function register() { | ||
// eslint-disable-next-line node/no-process-env | ||
if (process.env.NEXT_RUNTIME === "nodejs" && process.env.OTEL_ENABLED === "true") { | ||
await import("./otel-instrumentation.node"); | ||
if (process.env.OTEL_ENABLED === "true") { | ||
await import("./instrumentations/otel"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* eslint-disable node/no-process-env */ | ||
// Use `process.env` here to avoid broken Next.js build | ||
import { ATTR_SERVICE_VERSION } from "@opentelemetry/semantic-conventions"; | ||
import { ATTR_DEPLOYMENT_ENVIRONMENT_NAME } from "@opentelemetry/semantic-conventions/incubating"; | ||
import { createBatchSpanProcessor } from "@saleor/apps-otel/src/batch-span-processor-factory"; | ||
import { createHttpInstrumentation } from "@saleor/apps-otel/src/http-instrumentation-factory"; | ||
import { registerOTel } from "@vercel/otel"; | ||
|
||
import pkg from "../../package.json"; | ||
|
||
registerOTel({ | ||
serviceName: process.env.OTEL_SERVICE_NAME, | ||
attributes: { | ||
[ATTR_SERVICE_VERSION]: pkg.version, | ||
[ATTR_DEPLOYMENT_ENVIRONMENT_NAME]: process.env.ENV, | ||
"commit-sha": process.env.VERCEL_GIT_COMMIT_SHA, | ||
// override attribute set by `@vercel/otel` - if you are using OSS version you can remove it | ||
env: undefined, | ||
"vercel.env": process.env.VERCEL_ENV, | ||
}, | ||
spanProcessors: [ | ||
createBatchSpanProcessor({ | ||
accessToken: process.env.OTEL_ACCESS_TOKEN, | ||
}), | ||
], | ||
instrumentations: [createHttpInstrumentation()], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { trace } from "@opentelemetry/api"; | ||
|
||
export const appRootTracer = trace.getTracer("saleor-app-avatax"); | ||
import pkg from "../../package.json"; | ||
|
||
export const appRootTracer = trace.getTracer("saleor.app.avatax", pkg.version); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Use `process.env` here to avoid broken Next.js build | ||
|
||
export async function register() { | ||
if (process.env.NEXT_RUNTIME === "nodejs" && process.env.OTEL_ENABLED === "true") { | ||
await import("./otel-instrumentation.node"); | ||
if (process.env.OTEL_ENABLED === "true") { | ||
await import("./instrumentations/otel"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Use `process.env` here to avoid broken Next.js build | ||
import { ATTR_SERVICE_VERSION } from "@opentelemetry/semantic-conventions"; | ||
import { ATTR_DEPLOYMENT_ENVIRONMENT_NAME } from "@opentelemetry/semantic-conventions/incubating"; | ||
import { createBatchSpanProcessor } from "@saleor/apps-otel/src/batch-span-processor-factory"; | ||
import { createHttpInstrumentation } from "@saleor/apps-otel/src/http-instrumentation-factory"; | ||
import { registerOTel } from "@vercel/otel"; | ||
|
||
import pkg from "../../package.json"; | ||
|
||
registerOTel({ | ||
serviceName: process.env.OTEL_SERVICE_NAME, | ||
attributes: { | ||
[ATTR_SERVICE_VERSION]: pkg.version, | ||
[ATTR_DEPLOYMENT_ENVIRONMENT_NAME]: process.env.ENV, | ||
"commit-sha": process.env.VERCEL_GIT_COMMIT_SHA, | ||
// override attribute set by `@vercel/otel` - if you are using OSS version you can remove it | ||
env: undefined, | ||
"vercel.env": process.env.VERCEL_ENV, | ||
}, | ||
spanProcessors: [ | ||
createBatchSpanProcessor({ | ||
accessToken: process.env.OTEL_ACCESS_TOKEN, | ||
}), | ||
], | ||
instrumentations: [createHttpInstrumentation()], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { trace } from "@opentelemetry/api"; | ||
|
||
export const appRootTracer = trace.getTracer("saleor-app-avatax"); | ||
import pkg from "../../../package.json"; | ||
|
||
export const appRootTracer = trace.getTracer("saleor.app.cms", pkg.version); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Use `process.env` here to avoid broken Next.js build | ||
|
||
export async function register() { | ||
if (process.env.NEXT_RUNTIME === "nodejs" && process.env.OTEL_ENABLED === "true") { | ||
await import("./otel-instrumentation.node"); | ||
if (process.env.OTEL_ENABLED === "true") { | ||
await import("./instrumentations/otel"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Use `process.env` here to avoid broken Next.js build | ||
import { ATTR_SERVICE_VERSION } from "@opentelemetry/semantic-conventions"; | ||
import { ATTR_DEPLOYMENT_ENVIRONMENT_NAME } from "@opentelemetry/semantic-conventions/incubating"; | ||
import { createBatchSpanProcessor } from "@saleor/apps-otel/src/batch-span-processor-factory"; | ||
import { createHttpInstrumentation } from "@saleor/apps-otel/src/http-instrumentation-factory"; | ||
import { registerOTel } from "@vercel/otel"; | ||
|
||
import pkg from "../../package.json"; | ||
|
||
registerOTel({ | ||
serviceName: process.env.OTEL_SERVICE_NAME, | ||
attributes: { | ||
[ATTR_SERVICE_VERSION]: pkg.version, | ||
[ATTR_DEPLOYMENT_ENVIRONMENT_NAME]: process.env.ENV, | ||
"commit-sha": process.env.VERCEL_GIT_COMMIT_SHA, | ||
// override attribute set by `@vercel/otel` - if you are using OSS version you can remove it | ||
env: undefined, | ||
"vercel.env": process.env.VERCEL_ENV, | ||
}, | ||
spanProcessors: [ | ||
createBatchSpanProcessor({ | ||
accessToken: process.env.OTEL_ACCESS_TOKEN, | ||
}), | ||
], | ||
instrumentations: [createHttpInstrumentation()], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { trace } from "@opentelemetry/api"; | ||
|
||
export const appRootTracer = trace.getTracer("saleor-app-klaviyo"); | ||
import pkg from "../../package.json"; | ||
|
||
export const appRootTracer = trace.getTracer("saleor.app.klaviyo", pkg.version); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Use `process.env` here to avoid broken Next.js build | ||
|
||
export async function register() { | ||
if (process.env.NEXT_RUNTIME === "nodejs" && process.env.OTEL_ENABLED === "true") { | ||
await import("./otel-instrumentation.node"); | ||
if (process.env.OTEL_ENABLED === "true") { | ||
await import("./instrumentations/otel"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Use `process.env` here to avoid broken Next.js build | ||
import { ATTR_SERVICE_VERSION } from "@opentelemetry/semantic-conventions"; | ||
import { ATTR_DEPLOYMENT_ENVIRONMENT_NAME } from "@opentelemetry/semantic-conventions/incubating"; | ||
import { createBatchSpanProcessor } from "@saleor/apps-otel/src/batch-span-processor-factory"; | ||
import { createHttpInstrumentation } from "@saleor/apps-otel/src/http-instrumentation-factory"; | ||
import { registerOTel } from "@vercel/otel"; | ||
|
||
import pkg from "../../package.json"; | ||
|
||
registerOTel({ | ||
serviceName: process.env.OTEL_SERVICE_NAME, | ||
attributes: { | ||
[ATTR_SERVICE_VERSION]: pkg.version, | ||
[ATTR_DEPLOYMENT_ENVIRONMENT_NAME]: process.env.ENV, | ||
"commit-sha": process.env.VERCEL_GIT_COMMIT_SHA, | ||
// override attribute set by `@vercel/otel` - if you are using OSS version you can remove it | ||
env: undefined, | ||
"vercel.env": process.env.VERCEL_ENV, | ||
}, | ||
spanProcessors: [ | ||
createBatchSpanProcessor({ | ||
accessToken: process.env.OTEL_ACCESS_TOKEN, | ||
}), | ||
], | ||
instrumentations: [createHttpInstrumentation()], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { trace } from "@opentelemetry/api"; | ||
|
||
export const appRootTracer = trace.getTracer("saleor-app-products-feed"); | ||
import pkg from "../../package.json"; | ||
|
||
export const appRootTracer = trace.getTracer("saleor.app.products-feed", pkg.version); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Use `process.env` here to avoid broken Next.js build | ||
|
||
export async function register() { | ||
if (process.env.NEXT_RUNTIME === "nodejs" && process.env.OTEL_ENABLED === "true") { | ||
await import("./otel-instrumentation.node"); | ||
if (process.env.OTEL_ENABLED === "true") { | ||
await import("./instrumentations/otel"); | ||
} | ||
} |
Oops, something went wrong.