> ## Documentation Index
> Fetch the complete documentation index at: https://statsig-4b2ff144-serverless-cloudflare.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Ingesting Open Telemetry Data

<Tip>
  Setting up OTEL can be tricky, if you have any questions, feel free to reach out to us on slack!
</Tip>

## Overview

This guide walks you through setting up the OpenTelemetry Collector in your Kubernetes environment and configuring it to send telemetry data to Statsig using the official `otlphttp` exporter

***

## ✅ Prerequisites

* A running Kubernetes cluster (e.g., GKE, EKS, Minikube, etc.)
* Helm installed, or another mechanism to apply helm charts to your cluster, like ArgoCD
* API Access to a Statsig project with a Server SDK Secret Key
* Optional: `kubectl` configured and connected to the cluster, for validating and debugging setup

***

## 1. Setup OpenTelemetry Collector on Kubernetes

Our recommend setup follows the official OpenTelemetry Kubernetes guide to install the OpenTelemetry Collector in both **DaemonSet** and **Deployment** modes, using the official Helm Chart. **Note:** You'll find well-tested and ready-to-use `values.yaml` files for both deployments modes in Step 3!

**📘 Official Guide:**

[OpenTelemetry Collector for Kubernetes – Getting Started](https://opentelemetry.io/docs/platforms/kubernetes/getting-started/)

### Why both?

* **DaemonSet Collector**: Runs one instance per node to collect host-level telemetry (e.g., logs, pod and node metrics).
* **Deployment Collector**: Runs one instance per cluster to gather telemetry related to the cluster as a whole.

We recommend configuring these receivers at the minimum, for a useful observability platform for your kubernetes workloads powered by Statsig. We make use of the powerful [Presets](https://opentelemetry.io/docs/platforms/kubernetes/helm/collector/#presets) provided by the official chart, but also customize some components as can be seen in the sample values files in Step 3.

* Minimum for scraping logs:
  * [Filelog Receiver](https://opentelemetry.io/docs/platforms/kubernetes/getting-started/#filelog-receiver)
  * [Kubernetes Attributes Processor](https://opentelemetry.io/docs/platforms/kubernetes/getting-started/#kubernetes-attributes-processor)
* Minimum for scraping kubernetes metrics
  * [KubeletStats Receiver](https://opentelemetry.io/docs/platforms/kubernetes/getting-started/#kubeletstats-receiver)
  * [Kubernetes Cluster Receiver](https://opentelemetry.io/docs/platforms/kubernetes/getting-started/#kubernetes-cluster-receiver)
* Minimum for metrics about Otel Collector itself
  * [OTLP Receiver](https://opentelemetry.io/docs/platforms/kubernetes/getting-started/#otlp-receiver) for [scraping internal metrics](https://opentelemetry.io/docs/collector/internal-telemetry/#configure-internal-metrics) (alternatively scraped through prometheus receiver)

***

## 2. Configure exporting telemetry to Statsig with OTLP HTTP Exporter

Statsig supports receiving OTLP formatted, JSON encoded telemetry at the endpoint `https://api.statsig.com/otlp`. The OpenTelemetry Collector supports sending the scraped telemetry to the Statsig endpoint via the official `otlphttp` exporter.

### Authentication

Requests are authenticated using request header `statsig-api-key` and a valid SDK Server Secret key generated from [console.statsig.com](http://console.statsig.com) (under Settings > Keys & Environments). It is recommended to keep your secret key secure with a Kubernetes Secret management provider and make it available to access securely from the open telemetry collector pod’s environment.

### Example Exporter Config

```yaml theme={null}
exporters:
  otlphttp:
    endpoint: https://api.statsig.com/otlp
    encoding: json
    headers:
      statsig-api-key: ${env:STATSIG_SERVER_SDK_SECRET}
```

## 3. Example Helm Chart Values for a quick and correct setup

We provide two complete and tested `values.yaml` configurations for use with the OpenTelemetry Helm charts:

### 🔗 Deployment Collector

👉 [values-gateway.yaml](https://gist.github.com/karan-statsig/d5c70b7fd100ab445985b620dcb7e8c6)

### 🔗 DaemonSet Collector

👉 [values-agent.yaml](https://gist.github.com/karan-statsig/f02ee95fef00aecde402829b5a4c60e8)

Use them with the Helm chart version `0.75.1` like this:

```yaml theme={null}
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm repo update

# Install Deployment Collector
helm install otel-deployment open-telemetry/opentelemetry-collector \
  --version 0.75.1 \
  -f values-gateway.yaml -n otel --create-namespace

# Install DaemonSet Collector
helm install otel-daemonset open-telemetry/opentelemetry-collector \
  --version 0.75.1 \
  -f values-agent.yaml -n otel
```

## 4. Verify the Setup

Check that all pods are running:

```bash theme={null}
kubectl get pods -n otel
```

Check logs for a specific collector pod and confirm there are errors reported:

```bash theme={null}
kubectl logs -n otel $pod_name
```

## 5. Explore

Explore your Logs and Metrics at [console.statsig.com](http://console.statsig.com) with the Logs Explorer and Metrics Explorer products under Analytics on the sidebar menu 🙂

***

## 🔗 Resources

* [OpenTelemetry Collector Documentation](https://opentelemetry.io/docs/collector/)
* [Important Concepts for Kubernetes](https://opentelemetry.io/docs/platforms/kubernetes/collector/components/)
* [Helm Chart Reference](https://github.com/open-telemetry/opentelemetry-helm-charts)
* [Collector Configuration Reference](https://opentelemetry.io/docs/collector/configuration)
* [OTLP Protocol Specification](https://opentelemetry.io/docs/specs/otlp/)
