Running Prometheus Agent for metrics, Promtail for logs, and an OTel Collector for traces means three agents on every node. Grafana Alloy replaces all three with one programmable collector.
Installation
helm install alloy grafana/alloy \
--namespace monitoring --create-namespaceConfiguration Language
Alloy uses a component-based configuration:
// Scrape Kubernetes pods for Prometheus metrics
prometheus.scrape "pods" {
targets = discovery.kubernetes.pods.targets
forward_to = [prometheus.remote_write.mimir.receiver]
}
// Discover Kubernetes pods
discovery.kubernetes "pods" {
role = "pod"
}
// Send metrics to Mimir/Prometheus
prometheus.remote_write "mimir" {
endpoint {
url = "http://mimir.monitoring:9009/api/v1/push"
}
}Components connect with pipes: discovery ā scrape ā remote_write. Data flows left to right.
Master this topic with hands-on labs
Go beyond reading ā build real projects in sandboxed environments with expert video guidance.
Browse Courses āCollect Everything
Metrics (Prometheus)
prometheus.scrape "nodes" {
targets = [{
__address__ = "localhost:9100",
job = "node-exporter",
}]
scrape_interval = "15s"
forward_to = [prometheus.remote_write.mimir.receiver]
}Logs (Loki)
// Discover pod logs
loki.source.kubernetes "pods" {
targets = discovery.kubernetes.pods.targets
forward_to = [loki.process.pipeline.receiver]
}
// Process logs (parse JSON, add labels)
loki.process "pipeline" {
stage.json {
expressions = {
level = "level",
message = "msg",
}
}
stage.labels {
values = { level = "" }
}
forward_to = [loki.write.default.receiver]
}
// Send to Loki
loki.write "default" {
endpoint {
url = "http://loki.monitoring:3100/loki/api/v1/push"
}
}Traces (Tempo)
// Receive OTLP traces
otelcol.receiver.otlp "default" {
grpc {
endpoint = "0.0.0.0:4317"
}
http {
endpoint = "0.0.0.0:4318"
}
output {
traces = [otelcol.exporter.otlp.tempo.input]
}
}
// Send to Tempo
otelcol.exporter.otlp "tempo" {
client {
endpoint = "tempo.monitoring:4317"
}
}All Three in One Config
// === METRICS ===
discovery.kubernetes "pods" { role = "pod" }
prometheus.scrape "pods" {
targets = discovery.kubernetes.pods.targets
forward_to = [prometheus.remote_write.mimir.receiver]
}
prometheus.remote_write "mimir" {
endpoint { url = "http://mimir:9009/api/v1/push" }
}
// === LOGS ===
loki.source.kubernetes "pods" {
targets = discovery.kubernetes.pods.targets
forward_to = [loki.write.loki.receiver]
}
loki.write "loki" {
endpoint { url = "http://loki:3100/loki/api/v1/push" }
}
// === TRACES ===
otelcol.receiver.otlp "default" {
grpc { endpoint = "0.0.0.0:4317" }
output { traces = [otelcol.exporter.otlp.tempo.input] }
}
otelcol.exporter.otlp "tempo" {
client { endpoint = "tempo:4317" }
}One DaemonSet. Three signal types. One config file.
Get weekly IT automation tips
Docker, Ansible, Terraform, MLOps ā curated insights delivered to your inbox. No spam.
Subscribe Free āAuto-Instrumentation
Alloy can inject OpenTelemetry instrumentation into applications without code changes:
// Auto-instrument Java applications
beyla.ebpf "auto" {
open_port = "8080"
output {
traces = [otelcol.exporter.otlp.tempo.input]
}
}Beyla uses eBPF to instrument HTTP and gRPC calls without modifying application code.
Alloy vs Alternatives
| Feature | Alloy | OTel Collector | Prometheus Agent | Promtail |
|---|---|---|---|---|
| Metrics | ā | ā | ā | ā |
| Logs | ā | ā | ā | ā |
| Traces | ā | ā | ā | ā |
| Config language | Alloy (River) | YAML | YAML | YAML |
| Programmable | Yes | Limited | No | Limited |
| Grafana native | Yes | No | Partial | Yes |
Use Alloy if you run the Grafana stack (Mimir, Loki, Tempo). Use OTel Collector for vendor-neutral setups or non-Grafana backends.
---
Ready to go deeper? Build your observability stack with hands-on courses at CopyPasteLearn.
Ready to learn by doing?
Stop reading tutorials ā start building. Expert video courses with hands-on labs in real sandboxed environments.
Related Articles
OpenTelemetry Getting Started Guide
OpenTelemetry is the standard for observability instrumentation. Learn how to add traces, metrics, and logs to your applications with OTel SDKs.
DevOps Metrics That Matter
Most DevOps dashboards track the wrong things. Learn which metrics actually predict engineering performance: DORA metrics, SLOs, and the metrics that drive.
Grafana Tempo Distributed Tracing
Grafana Tempo stores distributed traces at scale with object storage. Learn how Tempo compares to Jaeger, how to deploy it on Kubernetes, and how to correlate.
Grafana Dashboard Best Practices
Build effective Grafana dashboards for monitoring. Layout patterns, template variables, alert integration, and dashboard-as-code.
Grafana Loki Log Aggregation Guide
Grafana Loki indexes log metadata instead of full text, making it cost-effective for Kubernetes log aggregation. Learn how to deploy Loki, query with LogQL.
Grafana Mimir Scalable Metrics Store
Grafana Mimir stores Prometheus metrics at massive scale using object storage. Learn how Mimir compares to Thanos and Cortex, and how to deploy it.
Explore topics
Browse more articles on the topics covered here.