> ## Documentation Index
> Fetch the complete documentation index at: https://www.botgauge.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Any OTLP exporter

> Send OpenTelemetry traces to BotGauge without the SDK. Endpoint, Bearer header, and gzip settings, plus Python, environment variable, and Collector setups.

BotGauge accepts plain OpenTelemetry, so you can forward traces without installing the BotGauge SDK. Point any OTLP/HTTP exporter at the endpoint below with your key as a Bearer token and gzip compression. That's the same thing the SDK sends.

| Setting | Value |
| - | - |
| Endpoint | `https://api.botgauge.com/v1/traces` (OTLP/HTTP, protobuf) |
| Header | `Authorization: Bearer <key>` only |
| Compression | gzip |

> [!WARNING]
>
> Spans sent this way reach BotGauge as your instrumentation produced them. They carry no `botgauge.session.id` or `botgauge.agent.id` attributes, and nothing gets masked. Use the [SDK](https://www.botgauge.com/docs/tracing/install.md) if you need session and agent identity or PII masking.

## In code (Python)

Add an OTLP exporter to your own tracer provider.

```bash terminal theme={null}
pip install opentelemetry-sdk opentelemetry-exporter-otlp-proto-http
```

```python raw_otlp.py theme={null}
import os

from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.http import Compression
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor

key = os.environ["BOTGAUGE_API_KEY"]
exporter = OTLPSpanExporter(
    endpoint="https://api.botgauge.com/v1/traces",
    headers={"Authorization": f"Bearer {key}"},
    compression=Compression.Gzip,
)
provider = TracerProvider(resource=Resource.create({"service.name": "my-agent"}))
provider.add_span_processor(BatchSpanProcessor(exporter))
trace.set_tracer_provider(provider)

tracer = trace.get_tracer("my-agent")
with tracer.start_as_current_span("check_balance"):
    pass

provider.shutdown()
```

## Environment variables only

OpenTelemetry's own launcher, `opentelemetry-instrument`, configures the exporter from environment variables and turns on the instrumentors you've installed. This example traces an unmodified LangChain app through the OpenInference LangChain instrumentor. Install your framework's instrumentor instead. See the [instrumentor packages](https://www.botgauge.com/docs/integrations/versions-not-verified.md#in-code-with-a-version-that-isnt-verified).

```bash terminal theme={null}
pip install opentelemetry-distro opentelemetry-exporter-otlp-proto-http \
  openinference-instrumentation-langchain langchain-openai
```

```bash terminal theme={null}
export OTEL_SERVICE_NAME="my-agent"
export OTEL_TRACES_EXPORTER="otlp"
export OTEL_METRICS_EXPORTER="none"
export OTEL_LOGS_EXPORTER="none"
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="https://api.botgauge.com/v1/traces"
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_TRACES_COMPRESSION="gzip"
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="Authorization=Bearer%20${BOTGAUGE_API_KEY}"
```

```python app.py theme={null}
import os

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(model=os.environ["OPENAI_MODEL"])
print(llm.invoke("In one sentence, what is OpenTelemetry?").text)
```

```bash terminal theme={null}
opentelemetry-instrument python app.py
```

The header value is URL-encoded. `%20` is the space after `Bearer`.

Forward traces from any exporterSend your OpenTelemetry traces directly to [BotGauge](https://cloud.botgauge.com).

[Try BotGauge →](https://cloud.botgauge.com)

## Through an OpenTelemetry Collector

If your apps already send to a Collector, add BotGauge as an exporter. The key stays in the Collector, so your apps don't need it. Start the Collector with `BOTGAUGE_API_KEY` set.

```yaml collector.yaml theme={null}
receivers:
  otlp:
    protocols:
      http:
        endpoint: 127.0.0.1:4318

exporters:
  otlphttp/botgauge:
    traces_endpoint: https://api.botgauge.com/v1/traces
    headers:
      Authorization: "Bearer ${env:BOTGAUGE_API_KEY}"
    compression: gzip

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [otlphttp/botgauge]
```

```bash terminal theme={null}
otelcol --config collector.yaml
```

Then point your app at the Collector, for example with the same `app.py` and `opentelemetry-instrument`.

```bash terminal theme={null}
export OTEL_SERVICE_NAME="my-agent"
export OTEL_TRACES_EXPORTER="otlp"
export OTEL_METRICS_EXPORTER="none"
export OTEL_LOGS_EXPORTER="none"
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="http://127.0.0.1:4318/v1/traces"
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL="http/protobuf"
```

This was tested with the OpenTelemetry Collector core build 0.162.0. That build accepts the HTTP exporter as `otlphttp` (used here) or `otlp_http`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.