← All insightsCheat Sheet

OpenTelemetry cheat sheet: the complete command reference

CodeWizard Engineering · 16 April 2026 · 3 min read · Beginner

This is a complete, hands-on OpenTelemetry cheat sheet: install, configure, operate, automate and secure it - with copy-paste commands grouped by task. Bookmark it for day-to-day work, incidents and interviews alike.

OpenTelemetry (OTel) is a CNCF standard and SDK set for generating traces, metrics and logs, plus a Collector that receives, processes and exports them to any backend.

Why you reach for it

  • Vendor-neutral instrumentation - swap backends without re-instrumenting
  • One Collector pipeline for traces, metrics and logs
  • Auto-instrumentation for many languages and frameworks

Installation

bash
docker run -p 4317:4317 -p 4318:4318 \
  -v $PWD/otel.yaml:/etc/otelcol/config.yaml otel/opentelemetry-collector

Configuration reference

A Collector pipeline: receive OTLP, batch, export.

yaml
receivers:
  otlp: { protocols: { grpc: {}, http: {} } }
processors:
  batch: {}
exporters:
  prometheus: { endpoint: 0.0.0.0:8889 }
  otlphttp: { endpoint: https://tempo:4318 }
service:
  pipelines:
    traces:  { receivers: [otlp], processors: [batch], exporters: [otlphttp] }
    metrics: { receivers: [otlp], processors: [batch], exporters: [prometheus] }

Core commands you use daily

Auto-instrument a Python app with zero code changes.

python
pip install opentelemetry-distro opentelemetry-exporter-otlp
opentelemetry-bootstrap -a install
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 \
  opentelemetry-instrument python app.py

Environment variables

bash
export OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4317
export OTEL_SERVICE_NAME=checkout
export OTEL_TRACES_SAMPLER=parentbased_traceidratio
export OTEL_TRACES_SAMPLER_ARG=0.1

Collector & auto-instrumentation

bash
otelcol validate --config otel.yaml
# Python auto-instrumentation:
opentelemetry-instrument python app.py
# Node:
node --require @opentelemetry/auto-instrumentations-node/register app.js

Use it in CI/CD

Validate Collector config in CI.

yaml
- run: otelcol validate --config otel.yaml

Best-practice checklist

  • Send everything to a Collector, then fan out to backends
  • Use tail-based sampling for traces to keep the interesting ones
  • Propagate context across services with W3C tracecontext

Common pitfalls to avoid

  • Sampling misconfigured, so you keep everything and blow up cost
  • Mixing SDK versions and losing context propagation
  • Exporting directly from apps instead of through a Collector

Security quick wins

  • Terminate and authenticate OTLP; don't expose the Collector openly
  • Strip PII in processors before export

Works well with

  • Prometheus - The de-facto standard for metrics - a pull-based time-series database with a powerful query language.
  • Grafana - The open dashboarding layer for metrics, logs and traces, with alerting across many data sources.
  • datadog
A cheat sheet is muscle memory on paper - keep it close until the commands live in your fingers.

Want senior help putting OpenTelemetry to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.

Like where this is going?

Get hands-on help from the engineers who write these posts.

Book a free consult