Skip to content

Observability - local Grafana session#155

Open
anikaviswa wants to merge 3 commits into
stagingfrom
observability
Open

Observability - local Grafana session#155
anikaviswa wants to merge 3 commits into
stagingfrom
observability

Conversation

@anikaviswa

Copy link
Copy Markdown

No description provided.

anikaviswa and others added 3 commits June 27, 2026 17:11
…shboard

Enables pg_stat_statements on the postgres container and provisions a
Grafana dashboard with panels for slowest queries by mean time, highest
total-time queries, most-called queries, and p50/p95/p99 latency stats.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds postgres_exporter + Prometheus to the compose stack so Grafana reads
query stats from Prometheus time-series rather than hitting the primary DB
on every dashboard refresh. Moves CREATE EXTENSION into a Flyway migration
(V14) instead of a manual step. Updates the Grafana dashboard to use PromQL.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@anikaviswa anikaviswa requested a review from jaeheonshim June 30, 2026 01:36
Comment thread docker-compose.yml
postgres_exporter:
image: prometheuscommunity/postgres-exporter:latest
command:
- '--extend.query-path=/etc/postgres_exporter/queries.yaml'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --extend.query-path option seems to be deprecated (see: https://github.com/prometheus-community/postgres_exporter). Please remove it for now.

Comment thread docker-compose.yml
- postgres
volumes:
- grafana_data:/var/lib/grafana
- ./config/grafana/provisioning:/etc/grafana/provisioning:ro

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I think having our data sources configured in-code is a good idea, I think it's out of scope for this current issue and we should try to implement it in a separate pull request

Comment thread docker-compose.yml
volumes:
- grafana_data:/var/lib/grafana
- ./config/grafana/provisioning:/etc/grafana/provisioning:ro
- ./config/grafana/dashboards:/var/lib/grafana/dashboards:ro

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing with dashboards, while defining dashboards in-code might be viable in the future, we should try to change one thing at a time.

Comment thread docker-compose.yml
restart: unless-stopped
environment:
GF_SERVER_ROOT_URL: "${GF_SERVER_ROOT_URL}"
DB_NAME: "${DB_NAME}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove database credentials from Grafana until we're ready to config the datasource in-code (future issue)

Comment thread docker-compose.yml
- '--storage.tsdb.retention.time=30d'
volumes:
- ./config/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please name the in-container folder something more descriptive, e.g. prometheus_data

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is not mounted anywhere and I believe its contents are handled by the flyway migration file you wrote. So it can be safely deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants