RousselTMLEARNING

Article · Observa: from discovery to expertise

Collecting with OpenTelemetry and Alloy

2. Collecting: OpenTelemetry and Alloy #

What to send, and how.

The collection pipeline #

Collection pipeline
Metrics via remote_write, logs pushed, traces and profiles via OTLP.
  • An open standard: OTLP and Prometheus exporters.
  • A collector between sources and databases.
  • Consistent attributes and controlled cardinality: no user ID or raw URL as a label.
  • Correlation: trace_id / span_id in logs, exemplars on histograms.

Instrumenting with OpenTelemetry #

export OTEL_SERVICE_NAME=checkout
export OTEL_RESOURCE_ATTRIBUTES="service.namespace=boutique,service.version=1.8.2,deployment.environment.name=prod,service.criticality=high"
export OTEL_EXPORTER_OTLP_ENDPOINT=http://alloy:4318
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
Resource attributes
service.criticality sets the service level used by SLA alerts.
# Java
java -javaagent:opentelemetry-javaagent.jar -jar app.jar
# Python
pip install opentelemetry-distro opentelemetry-exporter-otlp
opentelemetry-bootstrap -a install
opentelemetry-instrument python app.py
# Node.js
npm install @opentelemetry/auto-instrumentations-node
node --require @opentelemetry/auto-instrumentations-node/register app.js
Best practice : Start with automatic instrumentation, then add business spans and metrics. For the service map, enable the collector's servicegraph connector or Tempo's metrics-generator.

Grafana Alloy and fleet management #

Alloy, the recommended collector with Observa, combines Prometheus scraping, logs, OpenTelemetry components and profiles. Observa can manage a fleet of Alloy instances remotely: inventory and central configuration, through the remotecfg block.

remotecfg {
  url          = "https://observa.example.com/api/fleet"
  bearer_token = sys.env("OBSERVA_FLEET_TOKEN")
  id           = constants.hostname
  attributes   = { "env" = "prod", "role" = "vcenter-collector", "os" = constants.os }
}
ComponentCollection
Linux / Windowsprometheus.exporter.unix, loki.source.journal · prometheus.exporter.windows, loki.source.windowsevent
VMware vCenterotelcol.receiver.vcenter with a read-only account
Kubernetesk8s-monitoring Helm chart
Databasesprometheus.exporter.postgres, mysql, mssql, oracledb
Networkprometheus.exporter.snmp (SNMPv3 recommended)
Sites and certificatesprometheus.exporter.blackbox
Good to know : As soon as a component's metrics land in Prometheus, the matching built-in alerts turn on in auto mode: collecting a PostgreSQL exporter is enough to get its alerts.

Sources #

📄 Connecting sources and collecting telemetry for Observa →

My progress

  • ⏱ Estimated time : ≈ 4 min

Sign in to track your progress and take notes. Sign in

⭐ Rate this lesson

5.0 initial rating from the teaching team

Sign in to rate this lesson →

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

Recommended Articles

Grafana Alloy: collecting and transforming telemetry

Learn how to use Grafana Alloy to collect, transform and route logs, metrics and traces. Discover...

Collecting logs into Loki: Alloy, Promtail, Docker and OpenTelemetry

Send logs to Loki: Grafana Alloy, Promtail, the Docker driver, OTLP, good labels, parsing and enr...

OpenTelemetry Collector, Grafana Alloy and Bindplane: comparing three approaches to telemetry pipelines

Detailed comparison of three ways to manage telemetry pipelines: the OpenTelemetry Collector in Y...

Grafana Alloy best practices: optimizing your telemetry collection

Discover the golden rules for configuring Grafana Alloy robustly: modularity, secrets management,...

Fleet Management in Grafana Cloud

Fleet Management in Grafana Cloud: remotely managing a fleet of Grafana Alloy and OpenTelemetry c...

Grafana Alloy environment variables: GOMEMLIMIT, sys.env and OTEL_RESOURCE_ATTRIBUTES

Which variables does Grafana Alloy actually read? GOMEMLIMIT, HTTP_PROXY, sys.env, OTEL_RESOURCE_...

Fleet Management, Kubernetes Monitoring and the OpenTelemetry engine: Alloy at scale

Manage hundreds of Alloys with remotecfg and Fleet Management, deploy the k8s-monitoring v4 Helm ...

Grafana Alloy: collecting system metrics and local logs

Learn how to configure Grafana Alloy to monitor the server it runs on, with a focus on configurat...

Grafana Alloy vs OpenTelemetry Collector: Which One Should You Choose?

A detailed comparison between Grafana Alloy and the OpenTelemetry Collector. Discover the strengt...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!