langchain.js
    Preparing search index...

    LangSmith OpenTelemetry trace exporter that extends the standard OTLP trace exporter with LangSmith-specific configuration and span attribute transformations.

    This exporter automatically configures itself with LangSmith endpoints and API keys, based on your LANGSMITH_API_KEY and LANGSMITH_PROJECT environment variables. Will also respect OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_HEADERS environment variables if set.

    Optional configuration object that accepts all OTLPTraceExporter parameters. If not provided, uses default LangSmith configuration: - url: Defaults to LangSmith OTEL endpoint (${LANGSMITH_ENDPOINT}/otel/v1/traces) - headers: Auto-configured with LangSmith API key and project headers Any provided config will override these defaults.

    Hierarchy

    • OTLPTraceExporter
      • LangSmithOTLPTraceExporter
    Index

    Constructors

    Methods

    Constructors

    • Parameters

      • Optionalconfig: OTLPExporterNodeConfigBase & {
            apiKey?: string;
            headers?: Record<string, string>;
            projectName?: string;
            transformExportedSpan?: (
                span: ReadableSpan,
            ) => ReadableSpan | Promise<ReadableSpan>;
        }
        • OptionalapiKey?: string

          The API key to use for the exporter.

        • Optionalheaders?: Record<string, string>

          Default headers to add to exporter requests.

        • OptionalprojectName?: string

          The name of the project to export traces to.

        • OptionaltransformExportedSpan?: (span: ReadableSpan) => ReadableSpan | Promise<ReadableSpan>

          A function that takes an exported span and returns a transformed version of it. May be used to add or remove attributes from the span.

          For example, to add a custom attribute to the span, you can do:

          import { LangSmithOTLPTraceExporter } from "langsmith/experimental/otel/exporter";

          const exporter = new LangSmithOTLPTraceExporter({
          transformExportedSpan: (span) => {
          if (span.name === "foo") {
          span.attributes["langsmith.metadata.bar"] = "baz";
          }
          return span;
          }
          });

      Returns LangSmithOTLPTraceExporter

    Methods

    • Export items.

      Parameters

      • spans: ReadableSpan[]
      • resultCallback: (result: ExportResult) => void

      Returns void