Prometheus pulls metrics from targets. InfluxDB receives pushed data. Prometheus is built for Kubernetes monitoring. InfluxDB is a general-purpose time-series database for any data.
Architecture
| Aspect | Prometheus | InfluxDB 3 |
|---|---|---|
| Data model | Multi-dimensional (labels) | Tags + fields |
| Collection | Pull (scrape targets) | Push (write API) |
| Query language | PromQL | SQL + InfluxQL |
| Storage | Local TSDB | Apache Arrow + Parquet |
| Retention | Configurable (default 15d) | Configurable |
| High availability | Thanos / Cortex / Mimir | Built-in clustering |
| License | Apache 2.0 | Apache 2.0 (OSS) / Proprietary (Cloud) |
Data collection
Prometheus (pull)
# prometheus.yml
scrape_configs:
- job_name: 'kubernetes-pods'
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
action: keep
regex: true
- job_name: 'node-exporter'
static_configs:
- targets: ['node1:9100', 'node2:9100']Prometheus discovers and scrapes targets. The target exposes metrics at /metrics. Prometheus controls the collection schedule.
InfluxDB (push)
# Write data via line protocol
curl -X POST "http://influxdb:8086/api/v2/write?bucket=mydb" \
-H "Authorization: Token ${TOKEN}" \
-d "cpu,host=server1,region=eu usage=72.5 $(date +%s)000000000"
# Or via Telegraf agent
# telegraf.conf
[[inputs.cpu]]
percpu = true
[[outputs.influxdb_v2]]
urls = ["http://influxdb:8086"]
token = "${TOKEN}"
organization = "myorg"
bucket = "metrics"InfluxDB relies on agents (Telegraf) or applications pushing data. More flexible for non-infrastructure data (IoT sensors, business metrics, custom events).
Query languages
PromQL
# CPU usage above 80% for 5 minutes
avg by (instance) (rate(node_cpu_seconds_total{mode!="idle"}[5m])) > 0.8
# 99th percentile request latency
histogram_quantile(0.99, rate(http_request_duration_seconds_bucket[5m]))
# Error rate
rate(http_requests_total{status=~"5.."}[5m]) / rate(http_requests_total[5m])InfluxDB SQL
-- CPU usage last hour
SELECT mean(usage) FROM cpu
WHERE time > now() - 1h
GROUP BY host, time(5m)
-- 99th percentile latency
SELECT percentile(duration, 99) FROM requests
WHERE time > now() - 5m
GROUP BY service
-- Error rate
SELECT count(status) FROM requests
WHERE status >= 500 AND time > now() - 5mPromQL is purpose-built for metrics โ powerful but has a learning curve. InfluxDB SQL is familiar to anyone who knows SQL.
Kubernetes monitoring
Prometheus dominates Kubernetes monitoring:
# Install kube-prometheus-stack (Prometheus + Grafana + alerting)
helm install monitoring prometheus-community/kube-prometheus-stack
# Instantly get:
# - Node metrics (CPU, memory, disk, network)
# - Pod metrics (resource usage, restarts)
# - Kubernetes API metrics
# - etcd metrics
# - CoreDNS metrics
# - 100+ pre-built Grafana dashboards
# - 100+ pre-configured alert rulesInfluxDB can monitor Kubernetes via Telegraf, but lacks the native service discovery and pre-built ecosystem.
Long-term storage
| Feature | Prometheus | InfluxDB |
|---|---|---|
| Local retention | 15 days (default) | Unlimited |
| Long-term storage | Thanos / Cortex / Mimir | Built-in |
| Object storage | Via Thanos (S3, GCS) | Native Parquet on S3 |
| Downsampling | Thanos Compactor | Built-in retention policies |
| Query across clusters | Thanos Query / Mimir | Single instance or InfluxDB Cloud |
Prometheus alone is not designed for long-term storage. You need Thanos, Cortex, or Mimir for multi-month retention. InfluxDB handles long-term storage natively.
Decision guide
Choose Prometheus when:
- Kubernetes monitoring โ native service discovery, kube-prometheus-stack
- Pull-based model โ you control what gets scraped and when
- PromQL is acceptable (your team will learn it)
- Alerting with Alertmanager is needed
- Grafana dashboards (Prometheus is the #1 data source)
- CNCF ecosystem โ every cloud-native tool exposes Prometheus metrics
Choose InfluxDB when:
- IoT / sensor data โ high-cardinality, high-write-volume time-series
- Push-based collection โ devices push data, not scraped
- SQL familiarity โ team prefers SQL over PromQL
- Business metrics โ custom events, financial data, application KPIs
- Long-term storage built-in without external components
- Non-Kubernetes environments where Prometheus service discovery does not apply