Configuration for the LangChain OpenTelemetry integration.
Options
:capture_input_messages- Whentrue, recordsgen_ai.input.messagesas a span attribute containing the serialized input messages. Defaults tofalse.:capture_output_messages- Whentrue, recordsgen_ai.output.messagesas a span attribute containing the serialized output messages. Defaults tofalse.:capture_tool_arguments- Whentrue, recordsgen_ai.tool.call.argumentsas a span attribute. Defaults tofalse.:capture_tool_results- Whentrue, recordsgen_ai.tool.call.resultas a span attribute. Defaults tofalse.:enable_metrics- Whentrue, attaches the metrics handler, which re-emits LangChain telemetry as intermediary[:langchain, :otel, …]metric events for a consumer (Telemetry.Metrics, PromEx, …) to record. It does not record OTel histograms directly. Defaults totrue. SeeLangChain.OpenTelemetry.MetricsHandler.:inherit_attributes- Whentrue, attributes supplied viacustom_context[:otel_attributes]on a chain are inherited by thechatandexecute_toolspans nested under it, instead of landing only on the chain span. Defaults totrue.This is what gets application context (user, tenant, feature) onto the LLM span, which carries no
custom_contextof its own. Inherited values always lose to attributes the span derives itself, so an inheritedgen_ai.request.modelcan never mask the real per-call model.Inheritance is carried on the OpenTelemetry context, so it follows the trace across process boundaries — including
async: truetools running in their ownTask— but is never serialized onto outbound requests the way baggage is. Turn it off if a very large attribute map makes the per-span copy undesirable.
Summary
Functions
Creates a new config from the given options.