Skip to content

Commit

Permalink
Await forceFlush() metrics with Promise.all()
Browse files Browse the repository at this point in the history
  • Loading branch information
Rindrics committed Oct 18, 2024
1 parent a5e4779 commit c314949
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions instrumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@ import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
import * as Sentry from "@sentry/nextjs";
import { registerOTel } from "@vercel/otel";

export const metricReader = new PeriodicExportingMetricReader({
exporter: new OTLPMetricExporter({
url: "https://ingest.us.signoz.cloud:443/v1/metrics",
headers: {
"signoz-access-token": process.env.SIGNOZ_INGESTION_TOKEN,
},
}),
});

export async function register() {
registerOTel({
serviceName: "giselle",
attributes: {
environment: process.env.VERCEL_ENV || "not-set",
},
metricReader: new PeriodicExportingMetricReader({
exporter: new OTLPMetricExporter({
url: "https://ingest.us.signoz.cloud:443/v1/metrics",
headers: {
"signoz-access-token": process.env.SIGNOZ_INGESTION_TOKEN,
},
}),
exportIntervalMillis: 10000,
}),
metricReader: metricReader,
});

if (process.env.NEXT_RUNTIME === "nodejs") {
Expand Down

0 comments on commit c314949

Please sign in to comment.