Skip to content

Repository files navigation

Observability Stack

A runnable monitoring lab: a Python service exposes Prometheus metrics, Prometheus scrapes it, and Grafana displays a provisioned dashboard.

Start the stack

docker compose up --build

Open the application at http://localhost:8000, Prometheus at http://localhost:9090, and Grafana at http://localhost:3000. The dashboard and data source are provisioned automatically.

Portfolio highlights

  • metrics endpoint and scrape configuration;
  • Docker Compose service dependencies and read-only configuration mounts;
  • Grafana dashboard as code;
  • Kubernetes Deployment, Service and Prometheus Operator ServiceMonitor;
  • CI checks tests, JSON configuration and image build.

Replace OWNER in k8s/app.yaml before pushing the image. The ServiceMonitor requires the Prometheus Operator or kube-prometheus-stack.

Architecture

App (/metrics) -> Prometheus (scrape) -> Grafana (provisioned dashboard)
                                    -> Prometheus Operator ServiceMonitor (k8s)

Key files

  • app/main.py — exposes app_uptime_seconds and serves the app.
  • prometheus/prometheus.yml — scrape config; grafana/provisioning/* — dashboard and data source as code.
  • compose.yaml — service dependencies and read-only config mounts.

What I learned

"Dashboards as code" means the Grafana provisioning YAML is version controlled and reviewed like everything else, so a broken dashboard is a merge conflict, not a manual click. Sharing the metrics port across the Compose stack and giving Prometheus a service dependency ordering keeps the scrape loop stable during startup, and the same manifest works unchanged for the k8s ServiceMonitor.

Ports

Service Port Use
App 8000 http://localhost:8000
Prometheus 9090 metrics browser
Grafana 3000 dashboards
(Prod) ServiceMonitor cluster-IP cluster scraping

About

Prometheus and Grafana observability demo

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages