# stivio00/otel-viewer architecture

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

- Interactive diagram: https://gitdiagram.com/stivio00/otel-viewer
- Repository: https://github.com/stivio00/otel-viewer
- Video tour (about a minute): https://gitdiagram.com/stivio00/otel-viewer/video

## Overview

otel-viewer combines an OTLP/gRPC collector, embedded DuckDB, HTTP REST API, and web UI, with an optional Tauri desktop shell. Exporters send traces, metrics, and logs to the collector; the gRPC service converts and persists telemetry, which API queries and UI panels expose for exploration, SQL, and YAML-defined dashboards. The graph follows explicit startup and frontend fetch paths; README-described capabilities are included where implementation excerpts were not sampled, using their documented enclosing modules.

Main entry points: [`web/src/App.tsx`](https://github.com/stivio00/otel-viewer/blob/master/web/src/App.tsx) (Web application), [`web/src/lib/api.ts`](https://github.com/stivio00/otel-viewer/blob/master/web/src/lib/api.ts) (API client), [`src/api.rs`](https://github.com/stivio00/otel-viewer/blob/master/src/api.rs) (REST router), [`src/grpc.rs`](https://github.com/stivio00/otel-viewer/blob/master/src/grpc.rs) (OTLP gRPC)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Telemetry ingestion"]
  node_grpc["OTLP gRPC<br/>[grpc.rs]"]
  node_convert["Signal conversion<br/>[convert.rs]"]
  node_proto["OTLP types<br/>[proto.rs]"]
end

subgraph group_backend["Query and storage"]
  node_server["Server runtime<br/>[lib.rs]"]
  node_db[("DuckDB store<br/>[db.rs]")]
  node_rows["Telemetry rows<br/>[rows.rs]"]
  node_api["REST router<br/>[api.rs]"]
  node_queries["Query logic<br/>[queries.rs]"]
  node_sqlguard["SQL guard<br/>[sqlguard.rs]"]
  node_dashboards["Dashboard definitions<br/>[dashboards.rs]"]
end

subgraph group_frontend["Viewer experience"]
  node_ui["Web application<br/>[App.tsx]"]
  node_header["Global controls<br/>[AppHeader.tsx]"]
  node_panels["Signal panels<br/>[TracesPanel.tsx]"]
  node_logs["Logs panel<br/>[LogsPanel.tsx]"]
  node_metrics["Metrics panel<br/>[MetricsPanel.tsx]"]
  node_sqlpanel["SQL console<br/>[SqlPanel.tsx]"]
  node_dashpanel["Dashboard viewer"]
  node_client["API client<br/>[api.ts]"]
end

subgraph group_desktop["Desktop shell"]
  node_tauri["Tauri desktop<br/>[lib.rs]"]
  node_webview["Native webview<br/>[lib.rs]"]
end

node_exporters(("OTLP exporters"))
node_user(("Viewer user"))

node_exporters -->|"export signals"| node_grpc
node_server -->|"starts receiver"| node_grpc
node_server -->|"starts HTTP"| node_api
node_grpc -->|"decodes OTLP"| node_proto
node_grpc -->|"converts signals"| node_convert
node_grpc -->|"persists telemetry"| node_db
node_convert -->|"builds rows"| node_rows
node_api -->|"runs queries"| node_queries
node_api -->|"validates SQL"| node_sqlguard
node_api -->|"lists dashboards"| node_dashboards
node_queries -->|"reads telemetry"| node_db
node_sqlguard -->|"executes SQL"| node_db
node_ui -->|"renders controls"| node_header
node_ui -->|"renders traces"| node_panels
node_ui -->|"renders logs"| node_logs
node_ui -->|"renders metrics"| node_metrics
node_ui -->|"renders console"| node_sqlpanel
node_ui -->|"renders dashboards"| node_dashpanel
node_header -->|"fetches status"| node_client
node_header -->|"resets data"| node_client
node_panels -->|"fetches traces"| node_client
node_logs -->|"fetches logs"| node_client
node_metrics -->|"fetches metrics"| node_client
node_sqlpanel -->|"submits SQL"| node_client
node_dashpanel -->|"fetches dashboards"| node_client
node_client -->|"HTTP requests"| node_api
node_user -->|"explores telemetry"| node_ui
node_tauri -->|"runs in process"| node_server
node_tauri -->|"serves router"| node_api
node_webview -->|"scheme requests"| node_tauri

click node_server "https://github.com/stivio00/otel-viewer/blob/master/src/lib.rs"
click node_grpc "https://github.com/stivio00/otel-viewer/blob/master/src/grpc.rs"
click node_convert "https://github.com/stivio00/otel-viewer/blob/master/src/convert.rs"
click node_proto "https://github.com/stivio00/otel-viewer/blob/master/src/proto.rs"
click node_db "https://github.com/stivio00/otel-viewer/blob/master/src/db.rs"
click node_rows "https://github.com/stivio00/otel-viewer/blob/master/src/rows.rs"
click node_api "https://github.com/stivio00/otel-viewer/blob/master/src/api.rs"
click node_queries "https://github.com/stivio00/otel-viewer/blob/master/src/queries.rs"
click node_sqlguard "https://github.com/stivio00/otel-viewer/blob/master/src/sqlguard.rs"
click node_dashboards "https://github.com/stivio00/otel-viewer/blob/master/src/dashboards.rs"
click node_ui "https://github.com/stivio00/otel-viewer/blob/master/web/src/App.tsx"
click node_header "https://github.com/stivio00/otel-viewer/blob/master/web/src/components/AppHeader.tsx"
click node_panels "https://github.com/stivio00/otel-viewer/blob/master/web/src/components/panels/TracesPanel.tsx"
click node_logs "https://github.com/stivio00/otel-viewer/blob/master/web/src/components/panels/LogsPanel.tsx"
click node_metrics "https://github.com/stivio00/otel-viewer/blob/master/web/src/components/panels/MetricsPanel.tsx"
click node_sqlpanel "https://github.com/stivio00/otel-viewer/blob/master/web/src/components/panels/SqlPanel.tsx"
click node_dashpanel "https://github.com/stivio00/otel-viewer/blob/master/web/src/components/panels/DashboardsPanel.tsx"
click node_client "https://github.com/stivio00/otel-viewer/blob/master/web/src/lib/api.ts"
click node_tauri "https://github.com/stivio00/otel-viewer/blob/master/src-tauri/src/lib.rs"
click node_webview "https://github.com/stivio00/otel-viewer/blob/master/src-tauri/src/lib.rs"

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_grpc,node_convert,node_proto,node_user toneBlue
class node_server,node_db,node_rows,node_api,node_queries,node_sqlguard,node_dashboards toneAmber
class node_ui,node_header,node_panels,node_logs,node_metrics,node_sqlpanel,node_dashpanel,node_client toneMint
class node_tauri,node_webview toneRose
class node_exporters toneIndigo
```

## Components

### Telemetry ingestion

- [OTLP gRPC](https://github.com/stivio00/otel-viewer/blob/master/src/grpc.rs): `src/grpc.rs`
- [Signal conversion](https://github.com/stivio00/otel-viewer/blob/master/src/convert.rs): `src/convert.rs`
- [OTLP types](https://github.com/stivio00/otel-viewer/blob/master/src/proto.rs): `src/proto.rs`

### Query and storage

- [Server runtime](https://github.com/stivio00/otel-viewer/blob/master/src/lib.rs): `src/lib.rs`
- [DuckDB store](https://github.com/stivio00/otel-viewer/blob/master/src/db.rs): `src/db.rs`
- [Telemetry rows](https://github.com/stivio00/otel-viewer/blob/master/src/rows.rs): `src/rows.rs`
- [REST router](https://github.com/stivio00/otel-viewer/blob/master/src/api.rs): `src/api.rs`
- [Query logic](https://github.com/stivio00/otel-viewer/blob/master/src/queries.rs): `src/queries.rs`
- [SQL guard](https://github.com/stivio00/otel-viewer/blob/master/src/sqlguard.rs): `src/sqlguard.rs`
- [Dashboard definitions](https://github.com/stivio00/otel-viewer/blob/master/src/dashboards.rs): `src/dashboards.rs`

### Viewer experience

- [Web application](https://github.com/stivio00/otel-viewer/blob/master/web/src/App.tsx): `web/src/App.tsx`
- [Global controls](https://github.com/stivio00/otel-viewer/blob/master/web/src/components/AppHeader.tsx): `web/src/components/AppHeader.tsx`
- [Signal panels](https://github.com/stivio00/otel-viewer/blob/master/web/src/components/panels/TracesPanel.tsx): `web/src/components/panels/TracesPanel.tsx`
- [Logs panel](https://github.com/stivio00/otel-viewer/blob/master/web/src/components/panels/LogsPanel.tsx): `web/src/components/panels/LogsPanel.tsx`
- [Metrics panel](https://github.com/stivio00/otel-viewer/blob/master/web/src/components/panels/MetricsPanel.tsx): `web/src/components/panels/MetricsPanel.tsx`
- [SQL console](https://github.com/stivio00/otel-viewer/blob/master/web/src/components/panels/SqlPanel.tsx): `web/src/components/panels/SqlPanel.tsx`
- [Dashboard viewer](https://github.com/stivio00/otel-viewer/blob/master/web/src/components/panels/DashboardsPanel.tsx): `web/src/components/panels/DashboardsPanel.tsx`
- [API client](https://github.com/stivio00/otel-viewer/blob/master/web/src/lib/api.ts): `web/src/lib/api.ts`

### Desktop shell

- [Tauri desktop](https://github.com/stivio00/otel-viewer/blob/master/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`
- [Native webview](https://github.com/stivio00/otel-viewer/blob/master/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`

### Other components

- **OTLP exporters**
- **Viewer user**

## Connections

- OTLP exporters → OTLP gRPC: export signals
- Server runtime → OTLP gRPC: starts receiver
- Server runtime → REST router: starts HTTP
- OTLP gRPC → OTLP types: decodes OTLP
- OTLP gRPC → Signal conversion: converts signals
- OTLP gRPC → DuckDB store: persists telemetry
- Signal conversion → Telemetry rows: builds rows
- REST router → Query logic: runs queries
- REST router → SQL guard: validates SQL
- REST router → Dashboard definitions: lists dashboards
- Query logic → DuckDB store: reads telemetry
- SQL guard → DuckDB store: executes SQL
- Web application → Global controls: renders controls
- Web application → Signal panels: renders traces
- Web application → Logs panel: renders logs
- Web application → Metrics panel: renders metrics
- Web application → SQL console: renders console
- Web application → Dashboard viewer: renders dashboards
- Global controls → API client: fetches status
- Global controls → API client: resets data
- Signal panels → API client: fetches traces
- Logs panel → API client: fetches logs
- Metrics panel → API client: fetches metrics
- SQL console → API client: submits SQL
- Dashboard viewer → API client: fetches dashboards
- API client → REST router: HTTP requests
- Viewer user → Web application: explores telemetry
- Tauri desktop → Server runtime: runs in process
- Tauri desktop → REST router: serves router
- Native webview → Tauri desktop: scheme requests
