100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

OpenTelemetry Cheat Sheet

OpenTelemetry Cheat Sheet

Vendor-neutral observability instrumentation covering traces, metrics, logs, the Collector pipeline, and SDK setup across languages.

3 PagesAdvancedFeb 24, 2026

Node.js Auto-Instrumentation

Bootstrap traces and metrics for an app with zero manual span code.

javascript
// tracing.js — imported before any other moduleconst { NodeSDK } = require('@opentelemetry/sdk-node')const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node')const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc')const sdk = new NodeSDK({  traceExporter: new OTLPTraceExporter({ url: 'http://localhost:4317' }),  instrumentations: [getNodeAutoInstrumentations()],  serviceName: 'checkout-service',})sdk.start()

Manual Span Instrumentation

Wrap custom business logic in a span when auto-instrumentation isn't enough.

python
from opentelemetry import tracetracer = trace.get_tracer("checkout.service")def process_order(order_id: str):    with tracer.start_as_current_span("process_order") as span:        span.set_attribute("order.id", order_id)        span.add_event("inventory_checked")        try:            charge_payment(order_id)        except Exception as e:            span.record_exception(e)            span.set_status(trace.StatusCode.ERROR, str(e))            raise

Custom Metrics

Record a counter and a histogram alongside auto-collected runtime metrics.

python
from opentelemetry import metricsmeter = metrics.get_meter("checkout.service")orders_counter = meter.create_counter(    "orders.processed", unit="1", description="Total orders processed")latency_histogram = meter.create_histogram(    "order.processing.duration", unit="ms")orders_counter.add(1, {"status": "success"})latency_histogram.record(142.3, {"payment_provider": "stripe"})

OpenTelemetry Collector Pipeline

Receive OTLP data, batch/process it, and export to multiple backends.

yaml
receivers:  otlp:    protocols:      grpc:        endpoint: 0.0.0.0:4317      http:        endpoint: 0.0.0.0:4318processors:  batch: {}  memory_limiter:    limit_mib: 512exporters:  otlp/jaeger:    endpoint: jaeger-collector:4317  prometheus:    endpoint: 0.0.0.0:8889service:  pipelines:    traces:      receivers: [otlp]      processors: [memory_limiter, batch]      exporters: [otlp/jaeger]    metrics:      receivers: [otlp]      processors: [batch]      exporters: [prometheus]

Core Signals & Terms

The vocabulary of the OTel spec.

  • Span- a single timed operation with attributes, events, and a parent/child relationship
  • Trace- a tree of spans representing one end-to-end request across services
  • Context Propagation- passing trace IDs across process/service boundaries (e.g. W3C traceparent header)
  • Resource- metadata identifying the entity producing telemetry (service.name, host, k8s.pod.name)
  • OTLP- OpenTelemetry Protocol, the standard wire format between SDKs, Collector, and backends
  • Sampler- decides which traces to keep (e.g. ParentBased(TraceIdRatioBased) for head sampling)
Pro Tip

Deploy the Collector as a separate service (not just SDK-to-backend direct export) as soon as you have more than one backend or language — it centralizes sampling, PII redaction, and retry/batching logic so you're not reimplementing them in every service's SDK config.

Was this cheat sheet helpful?

Explore Topics

#OpenTelemetry#OpenTelemetryCheatSheet#DevOps#Advanced#NodeJsAutoInstrumentation#ManualSpanInstrumentation#CustomMetrics#OpenTelemetryCollectorPipeline#CheatSheet#SkillVeris
Advertisement
Sri Hayavadhana Info-Tech

Professional Web Designing Services

  • Responsive Websites
  • E-commerce Solutions
  • SEO Friendly Design
  • Fast & Secure
  • Support & Maintenance
Get a Free Quote

Share this Cheat Sheet