How ashishkarnad/grafana works
(minimal) file structure
• Top-level only contains README.md, but the README tells us the key pieces:
• Grafana (visualization)
• Prometheus (metrics collection & storage)
• Loki (log aggregation & storage)
• cAdvisor (container metrics exporter)
README for additional insights
• We’ll assume standard integrations: Prometheus scrapes cAdvisor; Promtail (implied) tails logs into Loki; Grafana sits on top of both data sources.
a. Main components:
• Instrumented containers (your app or other Docker workloads)
• cAdvisor (exporter for container metrics)
• Prometheus server (scrape cAdvisor & other exporters)
• Loki (log store) with Promtail or Fluentd as log collector
• Grafana (UI for dashboards)
• (Optional) Alertmanager for alerts, external notification channels (Slack, e-mail).
b. Relationships & interactions:
1. cAdvisor runs alongside containers → exposes container metrics on HTTP endpoint
2. Prometheus → scrapes cAdvisor endpoint at intervals → stores time-series data
3. Promtail (agent) → tails container/stdout logs → pushes to Loki
4. Loki → indexes and stores log streams (labels for filtering)
5. Grafana → connects to Prometheus & Loki as data sources → renders dashboards & log panels
6. (Optional) Prometheus → forwards alerts to Alertmanager → notifies external services
c. Architectural patterns & principles:
• “Pull-based” metrics collection (Prometheus scrapes exporters).
• “Push-based” log aggregation (Promtail pushes to Loki).
• Decoupled data plane (metrics vs logs) with unified visualization.
• Containerized, modular services (each tool runs in its own container or service).
d. Key technologies/frameworks:
• Docker / Kubernetes (implied by cAdvisor usage)
• cAdvisor
• Prometheus (yaml config files, rule files)
• Loki (config for ingesters, compactor, retention)
• Promtail (or other log forwarder)
• Grafana (dashboards, datasources)
• (Optional) Alertmanager
Detailing for maximum clarity
• Which components run side-by-side (e.g., cAdvisor as a Docker daemon plugin).
• Time-series DB vs log index store.
• If using Docker Compose or Kubernetes, overlay a rectangle (“cluster boundary”) to group services.