Introduction

Langtrace offers flexible options for trace collection and analysis:

  1. Langtrace Cloud ☁️: Our managed SaaS solution for easy setup and immediate insights.
  2. Self-hosted Langtrace 🏠: For organizations that prefer to host Langtrace on their own infrastructure.
  3. OpenTelemetry Integration πŸ”—: Langtrace SDK supports sending traces to any OpenTelemetry-compatible backend (Datadog, New Relic, Grafana, etc), allowing you to use your existing observability stack.

Important: When using Langtrace with third-party OpenTelemetry-compatible vendors, you don’t need to generate a Langtrace API key. The SDK can be configured to send traces directly to your preferred backend.

Choose the option that best fits your needs and follow the corresponding setup instructions below.

Langtrace Cloud ☁️

To use the managed SaaS version of Langtrace, follow these steps:

  1. Sign up by going to this link.
  2. Create a new Project after signing up. Projects are containers for storing traces and metrics generated by your application. If you have only one application, creating 1 project will do.
  3. Generate an API key. This key will be used to authenticate your application with Langtrace Cloud.

    You may also create new projects and generate API keys for each of them later.

  4. In your application, install the Langtrace SDK. The code for installing the SDK is shown below:
  1. Initialize the Langtrace SDK with the API key you generated in the step 3. The code for setting up the SDK is shown below:
  1. You can now use Langtrace in your code. Here’s a simple example:

Congrats! You can now view your traces on Langtrace Cloud. πŸš€

OpenTelemetry Integration πŸ”—

If you prefer to use Langtrace with your existing OpenTelemetry-compatible backend:

  1. Install the Langtrace SDK as described in the Langtrace Cloud section.
  2. Instead of initializing with a Langtrace API key, configure the SDK to use your OpenTelemetry exporter. Refer to our documentation for OpenTelemetry tools. Or consult your platform of choice.

Note: When shipping traces directly to other observability tools (e.g., Datadog, Instana, New Relic), you do not need a Langtrace API key. Only the API key for your chosen observability tool is required.

Langtrace Self-hosted 🏠

For users/organizations that want to host Langtrace on their own infrastructure, follow these steps to get started.

Configure Langtrace SDK

For more details on configuring the Langtrace SDK, refer to the page Langtrace SDK Features

ParameterTypeDefault ValueDescription
batchboolTrueWhether to batch spans before sending them.
api_keystrLANGTRACE_API_KEY
or None
The API key for authentication.
write_spans_to_consoleboolFalseWhether to write spans to the console.
custom_remote_exporterOptional[Exporter]NoneCustom remote exporter.
If None, a default LangTraceExporter will be used.
api_hostOptional[str]https://langtrace.ai/The API host for the remote exporter.
service_nameOptional[str]NoneThe Service name for initializing langtrace
disable_instrumentationsOptional
[DisableInstrumentations]
NoneYou can pass an object to disable instrumentation for specific vendors,
e.g., {'only': ['openai']}
or {'all_except': ['openai']}.