Skip to content
Discussion options

You must be logged in to vote

Hi @kleenkanteen,

The issue is that your application exits before the traces are sent to Langfuse. You can find more on this here: https://langfuse.com/docs/observability/data-model#short-lived-applications

You can fix this by explicitly telling the OpenTelemetry SDK to flush all pending spans and wait for them to be sent, before exiting the application:

In your instrumentation.ts file, export the SDK so that you can use it in index.ts:

export const sdk = new NodeSDK({
  spanProcessors: [new LangfuseSpanProcessor()],
});

sdk.start();

Import and shut down the SDK after your main function completes:

import { sdk } from "./instrumentation";
import { startActiveObservation } from "@langfuse/…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@kleenkanteen
Comment options

@Lotte-Verheyden
Comment options

Answer selected by Lotte-Verheyden
@kleenkanteen
Comment options

@Lotte-Verheyden
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants