Langfuse JS/TS SDKs
    Preparing search index...

    Function createTraceAttributes

    • Creates OpenTelemetry attributes from Langfuse trace attributes.

      Converts user-friendly trace attributes into the internal OpenTelemetry attribute format required by the span processor.

      Parameters

      Returns Attributes

      OpenTelemetry attributes object with non-null values

      import { createTraceAttributes } from '@langfuse/tracing';

      const otelAttributes = createTraceAttributes({
      name: 'user-checkout-flow',
      userId: 'user-123',
      sessionId: 'session-456',
      tags: ['checkout', 'payment'],
      metadata: { version: '2.1.0' }
      });

      span.setAttributes(otelAttributes);