categories.observability Basic

How does Prometheus work? How does it integrate with Grafana?

AI Practice

How Prometheus Works

Prometheus is a pull-based monitoring system that actively scrapes metrics endpoints exposed by services on a regular schedule.

Core Components

Prometheus Server: The core — responsible for scraping, storing metrics data, and supporting PromQL queries

Exporters: Convert non-native Prometheus metrics and expose them, for example:

  • node_exporter: System metrics (CPU, memory, disk)
  • mysqld_exporter: MySQL metrics
  • blackbox_exporter: Probe HTTP/TCP endpoint availability

Alertmanager: Receives alert rule triggers from Prometheus, handles deduplication, silencing, and routing to Slack/PagerDuty

Pushgateway: Allows batch jobs to push metrics (short-lived jobs can't be scraped)

Metrics Format

Prometheus metrics are exposed in text format at the /metrics endpoint:

http_requests_total{method="GET",status="200"} 1234 http_requests_total{method="POST",status="500"} 5

Format: metric_name{label1="value1"} value [timestamp]

PromQL Basics

rate(http_requests_total[5m]) # 5-minute request rate histogram_quantile(0.99, http_duration) # P99 latency sum by (service) (up) # Count live instances grouped by service

Grafana's Role

Grafana is a visualization tool that uses Prometheus as a data source, querying with PromQL to build dashboard charts and configure visual alerts.

Typical architecture: Application → Prometheus scrapes → Grafana displays

✦ AI Mock Interview

Type your answer and get instant AI feedback

Sign in to use AI scoring

Copyright © 2026 Wood All Rights Reserved · FE Interview Hub