Langfuse JS/TS SDKs
    Preparing search index...

    Interface LangfuseSpanProcessorParams

    Configuration parameters for the LangfuseSpanProcessor.

    interface LangfuseSpanProcessorParams {
        additionalHeaders?: Record<string, string>;
        baseUrl?: string;
        compression?: "gzip" | "none";
        environment?: string;
        exporter?: SpanExporter;
        exportMode?: "immediate" | "batched";
        flushAt?: number;
        flushInterval?: number;
        mask?: MaskFunction;
        mediaUploadEnabled?: boolean;
        publicKey?: string;
        release?: string;
        secretKey?: string;
        shouldExportSpan?: ShouldExportSpan;
        timeout?: number;
    }
    Index

    Properties

    additionalHeaders?: Record<string, string>

    Additional HTTP headers to include with requests.

    baseUrl?: string

    Langfuse instance base URL. Can also be set via LANGFUSE_BASE_URL environment variable.

    "https://cloud.langfuse.com"
    
    compression?: "gzip" | "none"

    Compression for span export requests: "gzip" or "none". Can also be set via LANGFUSE_OTEL_COMPRESSION environment variable. When unset, falls back to the OTEL_EXPORTER_OTLP_TRACES_COMPRESSION and OTEL_EXPORTER_OTLP_COMPRESSION environment variables, then to no compression.

    Ignored when a custom exporter is provided. Only takes effect on Node.js and Bun; browser and edge runtimes ignore it. Requires Langfuse server v3.30.0 or later.

    environment?: string

    Environment identifier for the traces. Can also be set via LANGFUSE_TRACING_ENVIRONMENT environment variable.

    exporter?: SpanExporter

    Custom OpenTelemetry span exporter. If not provided, a default OTLP exporter will be used. Custom exporters bypass Langfuse's OTLP batch byte limit and must enforce any transport-specific request limits themselves.

    exportMode?: "immediate" | "batched"

    Span export mode to use.

    • batched: Recommended for production environments with long-running processes. Spans are batched and exported in groups for optimal performance.
    • immediate: Recommended for short-lived environments such as serverless functions. Spans are exported immediately to prevent data loss when the process terminates / is frozen.
    "batched"
    
    flushAt?: number

    Number of spans to batch before flushing. Can also be set via LANGFUSE_FLUSH_AT environment variable.

    flushInterval?: number

    Flush interval in seconds. Can also be set via LANGFUSE_FLUSH_INTERVAL environment variable.

    Function to mask sensitive data in spans before export.

    mediaUploadEnabled?: boolean

    Whether media detection and upload should be attempted by the processor. Can also be set via LANGFUSE_MEDIA_UPLOAD_ENABLED environment variable.

    Set to false to keep base64 media payloads unchanged on exported spans.

    true
    
    publicKey?: string

    Langfuse public API key. Can also be set via LANGFUSE_PUBLIC_KEY environment variable.

    release?: string

    Release identifier for the traces. Can also be set via LANGFUSE_RELEASE environment variable.

    secretKey?: string

    Langfuse secret API key. Can also be set via LANGFUSE_SECRET_KEY environment variable.

    shouldExportSpan?: ShouldExportSpan

    Function to determine whether a span should be exported to Langfuse. If not provided, a smart default filter is applied to export Langfuse spans, spans with gen_ai. attributes, and spans from known LLM instrumentors.

    timeout?: number

    Request timeout in seconds. Can also be set via LANGFUSE_TIMEOUT environment variable.

    5