Skip to main content

OpenTelemetry

This document describes a sample setup for sending metrics to Levitate via OpenTelemetry

Prerequisites

Create a Levitate cluster by following Getting Started.

Keep the following information handy after creating the cluster:

  • $levitate_remote_write_url - Levitate's Remote write endpoint
  • $levitate_remote_write_username - Cluster ID
  • $levitate_remote_write_password - Write token created for the cluster

OpenTelemetry Collector basics

Information flow - Metrics to Levitate via OpenTelemetry

OpenTelemetry collectors consist of three parts

  1. Receivers
    1. A receiver, which can be push or pull-based sends data to the collector.
    2. We will use Prometheus receiver which will receive metrics.
  2. Processors
    1. Processors are run on data between being received and being exported.
    2. Processors are not mandatory for sending data to Levitate.
  3. Exporters
    1. An exporter, which can be push or pull-based, sends data to one or more backends/destinations.
    2. We will use Levitate as an exporter destination.

Setup

  1. Create a docker-compose.yaml file with the following config
    1. Note that the image used for OpenTelemetry Collector is otel/opentelemetry-collector-contrib:0.64.0 which has support for the Basic authentication extension.
version: "3.5"
services:
otel-collector:
container_name: otel-collector-contrib
image: otel/opentelemetry-collector-contrib:0.64.0
command: [ "--config=/etc/otelcol-config.yaml" ]
ports:
- "8888:8888" # Prometheus metrics exposed by the collector
- "13133:13133" # health_check extension
volumes:
- ./otel-config.yaml:/etc/otelcol-config.yaml
restart: always
networks:
- monitoring
networks:
monitoring:
driver: bridge
  1. Create otel-config.yaml with a sample scrape config. Replace this scrape config by your desired config:
extensions:
basicauth/prw:
client_auth:
# Replace these variables by their actual values
username: $levitate_remote_write_username
password: $levitate_remote_write_password

receivers:
prometheus:
config:
scrape_configs:
- job_name: 'otel-collector-01'
scrape_interval: 60s
static_configs:
- targets: ['otel-collector:8888']

exporters:
prometheusremotewrite:
auth:
authenticator: basicauth/prw
endpoint: "$levitate_remote_write_url" # Replace this variable by its actual value

service:
extensions: [basicauth/prw]
pipelines:
metrics:
receivers: [prometheus]
exporters: [prometheusremotewrite]
  1. Deploy the setup using
docker-compose up

As per the config, the entire flow is combined in the pipelines section under the service where the data flows from OpenTelemetry Collector to Levitate using the basic auth mechanism.

info

The same config file otel-config.yaml can be used when using another compute layer e.g. K8s.

Troubleshooting

Please get in touch with us on Discord or Email if you have any questions.