# tvarit-foggy/grafana architecture

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

- Interactive diagram: https://gitdiagram.com/tvarit-foggy/grafana
- Repository: https://github.com/tvarit-foggy/grafana

## Overview

Grafana is a monitoring and observability platform: users query data sources, inspect or transform results, visualize them in panels and dashboards, and can configure alerts. The README also documents templated dashboards, metrics and log exploration, and mixed data sources. The sampled sources show SQL query execution and alert evaluation, plus a few UI state helpers; other major capabilities are represented from the README and tree, so their internal wiring is not inferred.

Main entry points: [`public/app`](https://github.com/tvarit-foggy/grafana/tree/main/public/app) (Grafana UI), [`public/app/features/dashboard`](https://github.com/tvarit-foggy/grafana/tree/main/public/app/features/dashboard) (Dashboards and variables), [`packages/grafana-runtime/src/services/QueryRunner.ts`](https://github.com/tvarit-foggy/grafana/blob/main/packages/grafana-runtime/src/services/QueryRunner.ts) (Query runner), [`pkg/tsdb/sqleng/sql_engine.go`](https://github.com/tvarit-foggy/grafana/blob/main/pkg/tsdb/sqleng/sql_engine.go) (SQL query engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_query["Query and data"]
  node_datasources["Data source runtime<br/>[dataSourceSrv.ts]"]
  node_queryrunner["Query runner<br/>[QueryRunner.ts]"]
  node_sql["SQL query engine<br/>[sql_engine.go]"]
  node_frames["Data frames and transformations<br/>[index.ts]"]
end

subgraph group_visual["Dashboards and exploration"]
  node_grafana["Grafana UI"]
  node_dashboards["Dashboards and variables"]
  node_explore["Metrics and logs exploration"]
  node_panels["Panel plugins and rendering"]
  node_search["Dashboard search<br/>[useSearchQuery.ts]"]
end

subgraph group_alert["Alerting"]
  node_alertui["Alert rule configuration"]
  node_alertengine["Alert evaluation engine<br/>[engine.go]"]
  node_alertsource["Alert source selection"]
end

subgraph group_shared["Shared platform"]
  node_urlstate["URL query state<br/>[useQueryParams.ts]"]
end

node_user(("Grafana user"))
node_database[("SQL data source")]
node_externaldata[("External data sources")]
node_notifiers["Notification services"]

node_user -->|"uses"| node_grafana
node_grafana -->|"creates and views"| node_dashboards
node_grafana -->|"explores"| node_explore
node_grafana -->|"searches"| node_search
node_dashboards -->|"queries"| node_datasources
node_explore -->|"queries"| node_datasources
node_datasources -->|"dispatches queries"| node_queryrunner
node_queryrunner -->|"runs SQL queries"| node_sql
node_sql -->|"queries"| node_database
node_sql -->|"converts rows"| node_frames
node_queryrunner -->|"dispatches queries"| node_externaldata
node_frames -->|"provides results"| node_panels
node_dashboards -->|"renders panels"| node_panels
node_dashboards -->|"reads and updates URL"| node_urlstate
node_user -->|"configures rules"| node_alertui
node_alertengine -.->|"sends notifications"| node_notifiers
node_alertsource -->|"reads and updates URL"| node_urlstate

click node_grafana "https://github.com/tvarit-foggy/grafana/tree/main/public/app"
click node_dashboards "https://github.com/tvarit-foggy/grafana/tree/main/public/app/features/dashboard"
click node_explore "https://github.com/tvarit-foggy/grafana/tree/main/public/app/features/explore"
click node_panels "https://github.com/tvarit-foggy/grafana/tree/main/packages/grafana-runtime/src/components"
click node_search "https://github.com/tvarit-foggy/grafana/blob/main/public/app/features/search/hooks/useSearchQuery.ts"
click node_datasources "https://github.com/tvarit-foggy/grafana/blob/main/packages/grafana-runtime/src/services/dataSourceSrv.ts"
click node_queryrunner "https://github.com/tvarit-foggy/grafana/blob/main/packages/grafana-runtime/src/services/QueryRunner.ts"
click node_sql "https://github.com/tvarit-foggy/grafana/blob/main/pkg/tsdb/sqleng/sql_engine.go"
click node_frames "https://github.com/tvarit-foggy/grafana/blob/main/packages/grafana-data/src/dataframe/index.ts"
click node_alertui "https://github.com/tvarit-foggy/grafana/tree/main/public/app/features/alerting"
click node_alertengine "https://github.com/tvarit-foggy/grafana/blob/main/pkg/services/alerting/engine.go"
click node_urlstate "https://github.com/tvarit-foggy/grafana/blob/main/public/app/core/hooks/useQueryParams.ts"
click node_alertsource "https://github.com/tvarit-foggy/grafana/blob/main/public/app/features/alerting/unified/hooks/useAlertManagerSourceName.ts"

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_datasources,node_queryrunner,node_sql,node_frames,node_user toneBlue
class node_grafana,node_dashboards,node_explore,node_panels,node_search,node_database,node_externaldata toneAmber
class node_alertui,node_alertengine,node_alertsource toneMint
class node_urlstate toneRose
class node_notifiers toneIndigo
```

## Components

### Query and data

- [Data source runtime](https://github.com/tvarit-foggy/grafana/blob/main/packages/grafana-runtime/src/services/dataSourceSrv.ts): `packages/grafana-runtime/src/services/dataSourceSrv.ts`
- [Query runner](https://github.com/tvarit-foggy/grafana/blob/main/packages/grafana-runtime/src/services/QueryRunner.ts): `packages/grafana-runtime/src/services/QueryRunner.ts`
- [SQL query engine](https://github.com/tvarit-foggy/grafana/blob/main/pkg/tsdb/sqleng/sql_engine.go): `pkg/tsdb/sqleng/sql_engine.go`
- [Data frames and transformations](https://github.com/tvarit-foggy/grafana/blob/main/packages/grafana-data/src/dataframe/index.ts): `packages/grafana-data/src/dataframe/index.ts`

### Dashboards and exploration

- [Grafana UI](https://github.com/tvarit-foggy/grafana/tree/main/public/app): `public/app`
- [Dashboards and variables](https://github.com/tvarit-foggy/grafana/tree/main/public/app/features/dashboard): `public/app/features/dashboard`
- [Metrics and logs exploration](https://github.com/tvarit-foggy/grafana/tree/main/public/app/features/explore): `public/app/features/explore`
- [Panel plugins and rendering](https://github.com/tvarit-foggy/grafana/tree/main/packages/grafana-runtime/src/components): `packages/grafana-runtime/src/components`
- [Dashboard search](https://github.com/tvarit-foggy/grafana/blob/main/public/app/features/search/hooks/useSearchQuery.ts): `public/app/features/search/hooks/useSearchQuery.ts`

### Alerting

- [Alert rule configuration](https://github.com/tvarit-foggy/grafana/tree/main/public/app/features/alerting): `public/app/features/alerting`
- [Alert evaluation engine](https://github.com/tvarit-foggy/grafana/blob/main/pkg/services/alerting/engine.go): `pkg/services/alerting/engine.go`
- [Alert source selection](https://github.com/tvarit-foggy/grafana/blob/main/public/app/features/alerting/unified/hooks/useAlertManagerSourceName.ts): `public/app/features/alerting/unified/hooks/useAlertManagerSourceName.ts`

### Shared platform

- [URL query state](https://github.com/tvarit-foggy/grafana/blob/main/public/app/core/hooks/useQueryParams.ts): `public/app/core/hooks/useQueryParams.ts`

### Other components

- **Grafana user**
- **SQL data source**
- **External data sources**
- **Notification services**

## Connections

- Grafana user → Grafana UI: uses
- Grafana UI → Dashboards and variables: creates and views
- Grafana UI → Metrics and logs exploration: explores
- Grafana UI → Dashboard search: searches
- Dashboards and variables → Data source runtime: queries
- Metrics and logs exploration → Data source runtime: queries
- Data source runtime → Query runner: dispatches queries
- Query runner → SQL query engine: runs SQL queries
- SQL query engine → SQL data source: queries
- SQL query engine → Data frames and transformations: converts rows
- Query runner → External data sources: dispatches queries
- Data frames and transformations → Panel plugins and rendering: provides results
- Dashboards and variables → Panel plugins and rendering: renders panels
- Dashboards and variables → URL query state: reads and updates URL
- Grafana user → Alert rule configuration: configures rules
- Alert evaluation engine → Notification services: sends notifications
- Alert source selection → URL query state: reads and updates URL
