From 17803be129e97014e3c35533343d0ee0dc20ade9 Mon Sep 17 00:00:00 2001 From: NeuralFlux <40491005+NeuralFlux@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:59:49 -0400 Subject: [PATCH] fix: rollback to SimpleSpanProcessor --- src/controllers/opentelemetry.ts | 4 ++-- src/controllers/threading/taskHandler.ts | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/controllers/opentelemetry.ts b/src/controllers/opentelemetry.ts index 557a5c0..d3e579c 100644 --- a/src/controllers/opentelemetry.ts +++ b/src/controllers/opentelemetry.ts @@ -1,5 +1,5 @@ import { NodeSDK } from "@opentelemetry/sdk-node"; -import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-node"; +import { SimpleSpanProcessor } from "@opentelemetry/sdk-trace-node"; import { HttpInstrumentation } from "@opentelemetry/instrumentation-http"; import { ExpressInstrumentation } from "@opentelemetry/instrumentation-express"; import { Resource } from "@opentelemetry/resources"; @@ -15,7 +15,7 @@ const jaegerResName = process.env.JAEGER_RES_NAME ?? '/v1/traces'; const traceExporter = new OTLPTraceExporter({ url: `http://${jaegerHost}:${jaegerPort}${jaegerResName}` }); -const spanProcessor = new BatchSpanProcessor(traceExporter); +const spanProcessor = new SimpleSpanProcessor(traceExporter); debug("Initializing Opentelemetry instrumentation..."); const sdk = new NodeSDK({ diff --git a/src/controllers/threading/taskHandler.ts b/src/controllers/threading/taskHandler.ts index b22ae41..586adf7 100644 --- a/src/controllers/threading/taskHandler.ts +++ b/src/controllers/threading/taskHandler.ts @@ -17,7 +17,6 @@ import { ProfilingIntegration } from "@sentry/profiling-node"; import { Span, trace, context, propagation, Context, Tracer } from "@opentelemetry/api"; import { Telemetry } from "@biothings-explorer/utils"; import { InnerTaskData } from "@biothings-explorer/types"; -import { flushRemainingSpans } from "../opentelemetry"; // use SENTRY_DSN environment variable try { @@ -114,7 +113,7 @@ async function runTask({ transaction.finish(); span.end(); Telemetry.removeOtelSpan(); - await flushRemainingSpans(); + // await flushRemainingSpans(); // only needed with BatchSpanProcessor } catch (error) { debug("Sentry/OpenTelemetry transaction finish error. This does not affect execution."); debug(error);