Setting up Langtrace Python SDK with OTEL Collector
This guide will walk you through setting up Langtrace’s Python SDK with the OpenTelemetry (OTEL) Collector to send traces to Langtrace’s Cloud or a self-hosted setup.
Refer to the OTEL configuration page for details on running and configuring the OpenTelemetry Collector with a custom configuration file.
To send traces to the OTEL Collector, install the required OpenTelemetry exporter package:
Initialize the Langtrace SDK with a custom remote exporter using the OTLPSpanExporter to send traces.
Example pre-requisite steps for running the code.
Create a folder and set up a virtual environment for Python:
Install the OpenAI and Langtrace Python SDK:
Export the OpenAI API key:
Run the script:
By following this guide, you will have integrated OpenTelemetry support into your Python project, allowing you to send traces to an OpenTelemetry backend, including Langtrace’s Cloud or a self-hosted setup.
Setting up Langtrace Python SDK with OTEL Collector
This guide will walk you through setting up Langtrace’s Python SDK with the OpenTelemetry (OTEL) Collector to send traces to Langtrace’s Cloud or a self-hosted setup.
Refer to the OTEL configuration page for details on running and configuring the OpenTelemetry Collector with a custom configuration file.
To send traces to the OTEL Collector, install the required OpenTelemetry exporter package:
Initialize the Langtrace SDK with a custom remote exporter using the OTLPSpanExporter to send traces.
Example pre-requisite steps for running the code.
Create a folder and set up a virtual environment for Python:
Install the OpenAI and Langtrace Python SDK:
Export the OpenAI API key:
Run the script:
By following this guide, you will have integrated OpenTelemetry support into your Python project, allowing you to send traces to an OpenTelemetry backend, including Langtrace’s Cloud or a self-hosted setup.