DOCS
LangGraph and LangChain
LangGraph runs nodes through LangChain callbacks. An OpenTelemetry instrumentor on that callback path sees the graph, the model, and the tools. Monitor also accepts traceloop.span.kind values agent, workflow, tool, generation, and llm.
- Create an ingest key.
- Install
opentelemetry-sdk,opentelemetry-exporter-otlp-proto-http, andopentelemetry-instrumentation-langchain. - Point
OTEL_EXPORTER_OTLP_TRACES_ENDPOINTathttps://balerxgate.com/v1/traces. This variable is the full traces URL. The base variableOTEL_EXPORTER_OTLP_ENDPOINTis a host, and the SDK appends/v1/tracesitself. - Set
OTEL_EXPORTER_OTLP_HEADERStox-balerx-key=YOUR_INGEST_KEY. - Call
LangchainInstrumentor().instrument()before you compile or invoke the graph. - Invoke the graph once and look at Runs.
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://balerxgate.com/v1/traces
export OTEL_EXPORTER_OTLP_HEADERS=x-balerx-key=YOUR_INGEST_KEYfrom opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.instrumentation.langchain import LangchainInstrumentor
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.trace import set_tracer_provider
provider = TracerProvider()
provider.add_span_processor(
BatchSpanProcessor(OTLPSpanExporter(), max_export_batch_size=512)
)
set_tracer_provider(provider)
LangchainInstrumentor().instrument()OTLPSpanExporter() with no arguments reads the environment from step 3. Prompts stay out of Balerx until content capture is enabled.
