Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore: enable tracing on all platforms (#5461)

Steffen Schmitz92d5f3524bc3
diff --git a/web/src/observability.config.ts b/web/src/observability.config.ts
index 77c093393f..e5fa22c811 100644
--- a/web/src/observability.config.ts
+++ b/web/src/observability.config.ts
@@ -17,59 +17,54 @@ import { awsEcsDetectorSync } from "@opentelemetry/resource-detector-aws";
import { containerDetector } from "@opentelemetry/resource-detector-container";
import { env } from "@/src/env.mjs";
-if (!process.env.VERCEL && process.env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION) {
- dd.init({
- runtimeMetrics: true,
- plugins: false,
- });
+dd.init({
+ runtimeMetrics: true,
+ plugins: false,
+});
- const sdk = new NodeSDK({
- resource: new Resource({
- "service.name": env.OTEL_SERVICE_NAME,
- "service.version": env.BUILD_ID,
+const sdk = new NodeSDK({
+ resource: new Resource({
+ "service.name": env.OTEL_SERVICE_NAME,
+ "service.version": env.BUILD_ID,
+ }),
+ traceExporter: new OTLPTraceExporter({
+ url: `${env.OTEL_EXPORTER_OTLP_ENDPOINT}/v1/traces`,
+ }),
+ instrumentations: [
+ new IORedisInstrumentation(),
+ new HttpInstrumentation({
+ requireParentforOutgoingSpans: true,
+ ignoreIncomingRequestHook: (req) => {
+ // Ignore health checks
+ return ["/api/public/health", "/api/public/ready", "/api/health"].some(
+ (path) => req.url?.includes(path),
+ );
+ },
+ ignoreOutgoingRequestHook: (req) => {
+ return req.host === "127.0.0.1";
+ },
+ requestHook: (span, req: any) => {
+ const url = "path" in req ? req?.path : req?.url;
+ let path = new URL(url, `http://${req?.host ?? "localhost"}`).pathname;
+ if (path.startsWith("/_next/static")) {
+ path = "/_next/static/*";
+ }
+ span.updateName(`${req?.method} ${path}`);
+ span.setAttribute("http.route", path);
+ },
}),
- traceExporter: new OTLPTraceExporter({
- url: `${env.OTEL_EXPORTER_OTLP_ENDPOINT}/v1/traces`,
- }),
- instrumentations: [
- new IORedisInstrumentation(),
- new HttpInstrumentation({
- requireParentforOutgoingSpans: true,
- ignoreIncomingRequestHook: (req) => {
- // Ignore health checks
- return [
- "/api/public/health",
- "/api/public/ready",
- "/api/health",
- ].some((path) => req.url?.includes(path));
- },
- ignoreOutgoingRequestHook: (req) => {
- return req.host === "127.0.0.1";
- },
- requestHook: (span, req: any) => {
- const url = "path" in req ? req?.path : req?.url;
- let path = new URL(url, `http://${req?.host ?? "localhost"}`)
- .pathname;
- if (path.startsWith("/_next/static")) {
- path = "/_next/static/*";
- }
- span.updateName(`${req?.method} ${path}`);
- span.setAttribute("http.route", path);
- },
- }),
- new PrismaInstrumentation(),
- new AwsInstrumentation(),
- new WinstonInstrumentation({ disableLogSending: true }),
- new BullMQInstrumentation({ useProducerSpanAsConsumerParent: true }),
- ],
- resourceDetectors: [
- envDetector,
- processDetector,
- awsEcsDetectorSync,
- containerDetector,
- ],
- sampler: new TraceIdRatioBasedSampler(env.OTEL_TRACE_SAMPLING_RATIO),
- });
+ new PrismaInstrumentation(),
+ new AwsInstrumentation(),
+ new WinstonInstrumentation({ disableLogSending: true }),
+ new BullMQInstrumentation({ useProducerSpanAsConsumerParent: true }),
+ ],
+ resourceDetectors: [
+ envDetector,
+ processDetector,
+ awsEcsDetectorSync,
+ containerDetector,
+ ],
+ sampler: new TraceIdRatioBasedSampler(env.OTEL_TRACE_SAMPLING_RATIO),
+});
- sdk.start();
-}
+sdk.start();