Skip to content

Commit

Permalink
Call registerOTel() in instrumentation.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Rindrics committed Oct 24, 2024
1 parent 6dbdb6f commit 82a2a03
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 34 deletions.
33 changes: 0 additions & 33 deletions instrumentation.node.ts

This file was deleted.

33 changes: 32 additions & 1 deletion instrumentation.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,39 @@
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
import { Resource } from "@opentelemetry/resources";
import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
import { SEMRESATTRS_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
import * as Sentry from "@sentry/nextjs";
import { registerOTel } from "@vercel/otel";

const header = {
"signoz-access-token": process.env.SIGNOZ_INGESTION_TOKEN,
};

// Configure OTLP trace exporter
const traceExporter = new OTLPTraceExporter({
url: "https://ingest.us.signoz.cloud:443/v1/traces",
headers: header,
});

// Configure OTLP metrics exporter
const otlpMetricsExporter = new OTLPMetricExporter({
url: "https://ingest.us.signoz.cloud:443/v1/metrics",
headers: header,
});

export async function register() {
registerOTel({
serviceName: "giselle",
metricReader: new PeriodicExportingMetricReader({
exporter: otlpMetricsExporter,
exportIntervalMillis: 10000,
}),
traceExporter: traceExporter,
});
console.log("OTEL SDK initialized");

if (process.env.NEXT_RUNTIME === "nodejs") {
await import("./instrumentation.node");
await import("./sentry.server.config");
}

Expand Down

0 comments on commit 82a2a03

Please sign in to comment.