# saurabhmahawar/presto_observability_pipeline architecture

> Architecture diagram of the GitHub repository saurabhmahawar/presto_observability_pipeline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saurabhmahawar/presto_observability_pipeline
- Repository: https://github.com/saurabhmahawar/presto_observability_pipeline

## Overview

#### Purpose and Entry Points
This is a self-contained Docker Compose sandbox for observing a three-node Presto distributed SQL cluster: one coordinator and two workers. It demonstrates JMX-to-Prometheus telemetry, dashboards, alert evaluation, and Slack delivery. Start the stack with `docker-compose up -d`; orchestration, service networking, mounts, and exposed ports are defined in `docker-compose.yml`.

#### Presto Cluster and Workload Boundaries
The coordinator accepts SQL/UI traffic, provides discovery, and centrally manages query scheduling and resource groups. Workers execute distributed tasks and can spill intermediate query data to host-mounted disk.
- `config/presto-coordinator/etc/config.properties`
- `config/presto-worker-1/etc/config.properties`
- `config/presto-worker-2/etc/config.properties`

Resource-group policy is coordinator-owned and establishes team/query concurrency and queue boundaries; therefore queued/rejected-query telemetry originates from actual admission control.
- `config/presto-coordinator/etc/resource-groups.properties`
- `config/presto-coordinator/etc/resource-groups.json`

#### JVM Telemetry Export Stage
Each Presto JVM loads the Prometheus JMX exporter as a Java agent. JVM launch settings wire the agent to its common MBean selection/translation rules, exposing HTTP metrics on port 8081. The coordinator exporter is host-accessible; worker exporters remain on the Compose network.
- `bin/jmx_prometheus_javaagent.jar`
- `config/presto-shared/presto-jmx-exporter.yaml`
- `config/presto-coordinator/etc/jvm.config`

The exporter is the key schema boundary: raw Java/Presto MBeans become normalized Prometheus metrics for query state, resource groups, JVM memory/GC, task scheduling, spills, and related engine behavior.

#### Prometheus Collection, Storage, and Rule Evaluation
Prometheus pulls each coordinator/worker exporter at configured intervals, attaching `role` labels that distinguish coordinator from workers. It stores time-series metrics, evaluates PromQL alert rules, and forwards firing/resolved alerts to Alertmanager.
- `config/prometheus/prometheus.yml`
- `config/prometheus/alert.rules.yml`

The scrape boundary is pull-based over the internal Docker bridge network; Presto does not push telemetry. Alert rules cover node availability and operational symptoms such as heap pressure, queues/rejections, failures, and GC overhead.

#### Alert Routing and External Notification
Alertmanager receives Prometheus alerts, groups and deduplicates them, then formats and routes notifications to a Slack incoming-webhook receiver. The webhook URL/channel are external integration points and operational secrets/configuration.
- `config/alertmanager/alertmanager.yml`

This separates alert detection (Prometheus PromQL and durations) from notification policy (grouping, routing, Slack presentation).

#### Grafana Visualization Plane
Grafana is provisioned at startup with Prometheus as its default data source and imports a prebuilt Presto dashboard. Dashboard panels issue PromQL against Prometheus for cluster KPIs, query load/latency/failures, worker resource usage, spill behavior, scheduling, exchange, and metadata telemetry.
- `config/grafana/provisioning/datasources/prometheus.yaml`
- `config/grafana/provisioning/dashboards/presto.yaml`
- `config/grafana/dashboards/presto-dashboard.json`

#### Queryable Metrics and Spill Storage
All Presto nodes configure the Prometheus connector, allowing SQL queries over Prometheus data as a secondary path distinct from monitoring collection. Worker spill directories are mounted persistent host paths; they support memory-constrained joins/aggregations and produce spill-related operational signals.
- `config/presto-coordinator/etc/catalog/prometheus.properties`
- `config/presto-worker-1/etc/catalog/prometheus.properties`
- `spill/worker-1`

Main entry points: [`config/prometheus/prometheus.yml`](https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/prometheus/prometheus.yml) (Prometheus), [`docker-compose.yml`](https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/docker-compose.yml) (Docker Compose stack), [`config/presto-coordinator/etc/config.properties`](https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/presto-coordinator/etc/config.properties) (Presto coordinator), [`config/presto-worker-1/etc/config.properties`](https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/presto-worker-1/etc/config.properties) (Presto workers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presto["Presto cluster"]
  node_coordinator["Presto coordinator<br/>sql coordinator<br/>[config.properties]"]
  node_workers["Presto workers<br/>sql workers<br/>[config.properties]"]
  node_resource_groups["Resource-group policy<br/>admission policy"]
  node_spill[("Worker spill storage<br/>persistent disk")]
  node_prometheus_connector["Prometheus SQL connector<br/>Presto catalog"]
end

subgraph group_telemetry["Telemetry pipeline"]
  node_jmx_agent["JMX Prometheus agent<br/>JVM exporter"]
  node_jmx_rules["JMX metric rules<br/>exporter schema"]
end

subgraph group_observability["Observability"]
  node_prometheus[("Prometheus<br/>metrics collector<br/>[prometheus.yml]")]
  node_alert_rules["PromQL alert rules<br/>detection rules<br/>[alert.rules.yml]"]
  node_alertmanager["Alertmanager<br/>alert router<br/>[alertmanager.yml]"]
  node_grafana["Grafana<br/>dashboard service<br/>[prometheus.yaml]"]
  node_presto_dashboard["Presto dashboard<br/>Grafana dashboard"]
end

node_compose{{"Docker Compose stack<br/>orchestration<br/>[docker-compose.yml]"}}
node_slack(("Slack webhook<br/>external notification"))

node_compose -->|"runs"| node_coordinator
node_compose -->|"runs"| node_workers
node_compose -->|"runs"| node_prometheus
node_compose -->|"runs"| node_alertmanager
node_compose -->|"runs"| node_grafana
node_coordinator -->|"enforces"| node_resource_groups
node_coordinator -->|"schedules tasks"| node_workers
node_workers -->|"spills intermediate data"| node_spill
node_coordinator -->|"loads"| node_jmx_agent
node_workers -->|"load"| node_jmx_agent
node_jmx_rules -->|"configures translation"| node_jmx_agent
node_jmx_agent -->|"serves pull metrics"| node_prometheus
node_alert_rules -->|"evaluated by"| node_prometheus
node_prometheus -->|"forwards firing/resolved alerts"| node_alertmanager
node_alertmanager -->|"routes webhook notifications"| node_slack
node_grafana -->|"queries PromQL"| node_prometheus
node_presto_dashboard -->|"imported by"| node_grafana
node_coordinator -->|"loads catalog"| node_prometheus_connector
node_prometheus_connector -.->|"queries metrics via SQL"| node_prometheus

click node_compose "https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/docker-compose.yml"
click node_coordinator "https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/presto-coordinator/etc/config.properties"
click node_workers "https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/presto-worker-1/etc/config.properties"
click node_resource_groups "https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/presto-coordinator/etc/resource-groups.properties"
click node_spill "https://github.com/saurabhmahawar/presto_observability_pipeline/tree/main/spill/worker-1"
click node_prometheus_connector "https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/presto-coordinator/etc/catalog/prometheus.properties"
click node_jmx_agent "https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/bin/jmx_prometheus_javaagent.jar"
click node_jmx_rules "https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/presto-shared/presto-jmx-exporter.yaml"
click node_prometheus "https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/prometheus/prometheus.yml"
click node_alert_rules "https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/prometheus/alert.rules.yml"
click node_alertmanager "https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/alertmanager/alertmanager.yml"
click node_grafana "https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/grafana/provisioning/datasources/prometheus.yaml"
click node_presto_dashboard "https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/grafana/dashboards/presto-dashboard.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_coordinator,node_workers,node_resource_groups,node_spill,node_prometheus_connector toneBlue
class node_jmx_agent,node_jmx_rules toneAmber
class node_prometheus,node_alert_rules,node_alertmanager,node_grafana,node_presto_dashboard toneMint
class node_compose,node_slack toneNeutral
```

## Components

### Presto cluster

- [Presto coordinator](https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/presto-coordinator/etc/config.properties): sql coordinator · Accepts SQL/UI traffic, discovery, scheduling, and resource-group admission. · `config/presto-coordinator/etc/config.properties`
- [Presto workers](https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/presto-worker-1/etc/config.properties): sql workers · Execute distributed query tasks. · `config/presto-worker-1/etc/config.properties`
- [Resource-group policy](https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/presto-coordinator/etc/resource-groups.properties): admission policy · Sets team concurrency and queue boundaries. · `config/presto-coordinator/etc/resource-groups.properties`
- [Worker spill storage](https://github.com/saurabhmahawar/presto_observability_pipeline/tree/main/spill/worker-1): persistent disk · Stores intermediate data for memory-constrained operations. · `spill/worker-1`
- [Prometheus SQL connector](https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/presto-coordinator/etc/catalog/prometheus.properties): Presto catalog · Makes Prometheus data queryable through SQL. · `config/presto-coordinator/etc/catalog/prometheus.properties`

### Telemetry pipeline

- [JMX Prometheus agent](https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/bin/jmx_prometheus_javaagent.jar): JVM exporter · Normalizes Java and Presto MBeans into HTTP metrics. · `bin/jmx_prometheus_javaagent.jar`
- [JMX metric rules](https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/presto-shared/presto-jmx-exporter.yaml): exporter schema · Selects and translates MBeans into Prometheus metric names. · `config/presto-shared/presto-jmx-exporter.yaml`

### Observability

- [Prometheus](https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/prometheus/prometheus.yml): metrics collector · Pulls, stores, and evaluates cluster metrics. · `config/prometheus/prometheus.yml`
- [PromQL alert rules](https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/prometheus/alert.rules.yml): detection rules · Detects availability, memory, queue, failure, and GC symptoms. · `config/prometheus/alert.rules.yml`
- [Alertmanager](https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/alertmanager/alertmanager.yml): alert router · Groups, deduplicates, and routes alerts. · `config/alertmanager/alertmanager.yml`
- [Grafana](https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/grafana/provisioning/datasources/prometheus.yaml): dashboard service · Visualizes cluster and query KPIs from Prometheus. · `config/grafana/provisioning/datasources/prometheus.yaml`
- [Presto dashboard](https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/config/grafana/dashboards/presto-dashboard.json): Grafana dashboard · Provides prebuilt Presto operational panels. · `config/grafana/dashboards/presto-dashboard.json`

### Other components

- [Docker Compose stack](https://github.com/saurabhmahawar/presto_observability_pipeline/blob/main/docker-compose.yml): orchestration · Defines services, network, mounts, and exposed ports. · `docker-compose.yml`
- **Slack webhook**: external notification · Receives routed operational notifications.

## Connections

- Docker Compose stack → Presto coordinator: runs
- Docker Compose stack → Presto workers: runs
- Docker Compose stack → Prometheus: runs
- Docker Compose stack → Alertmanager: runs
- Docker Compose stack → Grafana: runs
- Presto coordinator → Resource-group policy: enforces
- Presto coordinator → Presto workers: schedules tasks
- Presto workers → Worker spill storage: spills intermediate data
- Presto coordinator → JMX Prometheus agent: loads
- Presto workers → JMX Prometheus agent: load
- JMX metric rules → JMX Prometheus agent: configures translation
- JMX Prometheus agent → Prometheus: serves pull metrics · Prometheus scrapes coordinator and workers with role labels.
- PromQL alert rules → Prometheus: evaluated by
- Prometheus → Alertmanager: forwards firing/resolved alerts
- Alertmanager → Slack webhook: routes webhook notifications
- Grafana → Prometheus: queries PromQL
- Presto dashboard → Grafana: imported by
- Presto coordinator → Prometheus SQL connector: loads catalog
- Prometheus SQL connector → Prometheus: queries metrics via SQL
