# nvidia/dcgm-exporter architecture

> Architecture diagram of the GitHub repository nvidia/dcgm-exporter, 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/nvidia/dcgm-exporter
- Repository: https://github.com/nvidia/dcgm-exporter

## Overview

DCGM Exporter is a Go service that exposes NVIDIA GPU telemetry as Prometheus text metrics. Its primary workflow starts in the exporter command, initializes configuration and GPU telemetry providers, watches selected device fields, collects and transforms values into a registry, then serves rendered metrics to Prometheus scrapes. The source tree also identifies Kubernetes-related metadata and specialized collectors for GPU health, XID errors, clocks, peer-to-peer status, and profiling. The sampled excerpts confirm CLI initialization, watch-list setup, reload coordination, and serving behavior; some subsystem links are therefore omitted where call ownership was not visible.

Main entry points: [`pkg/cmd/app.go`](https://github.com/nvidia/dcgm-exporter/blob/main/pkg/cmd/app.go) (Reload coordinator), [`internal/pkg/devicewatchlistmanager`](https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/devicewatchlistmanager) (Watch-list manager), [`internal/pkg/registry`](https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/registry) (Metric registry), [`internal/pkg/collector`](https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/collector) (Metric collectors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Startup and lifecycle"]
  node_exporter["Exporter CLI<br/>[app.go]"]
  node_config["Configuration"]
  node_reload["Reload coordinator<br/>[app.go]"]
end

subgraph group_telemetry["Telemetry collection"]
  node_dcgm["DCGM provider"]
  node_nvml["NVML provider"]
  node_deviceinfo["Device inventory"]
  node_watchlists["Watch-list manager"]
  node_watcher["Field watcher"]
end

subgraph group_metrics["Metric processing"]
  node_collectors["Metric collectors"]
  node_counters["Counter definitions"]
  node_transform["Metric transformation"]
  node_registry["Metric registry"]
  node_kube["Kubernetes metadata"]
end

subgraph group_serving["HTTP serving"]
  node_render["Prometheus rendering"]
  node_server["Metrics server"]
end

node_operator(("Operator"))
node_prometheus(("Prometheus"))

node_operator -->|"starts"| node_exporter
node_exporter -->|"loads"| node_config
node_exporter -->|"coordinates"| node_reload
node_reload -->|"initializes"| node_dcgm
node_reload -->|"initializes"| node_nvml
node_reload -->|"builds"| node_registry
node_watchlists -->|"reads policy"| node_config
node_watchlists -->|"initializes"| node_deviceinfo
node_watchlists -->|"registers fields"| node_watcher
node_watcher -->|"watches fields"| node_dcgm
node_collectors -->|"uses definitions"| node_counters
node_collectors -->|"reads watched values"| node_watchlists
node_collectors -->|"registers metrics"| node_registry
node_registry -->|"transforms metrics"| node_transform
node_server -->|"serves registry"| node_registry
node_server -->|"renders metrics"| node_render
node_prometheus -->|"scrapes"| node_server

click node_exporter "https://github.com/nvidia/dcgm-exporter/blob/main/pkg/cmd/app.go"
click node_config "https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/appconfig"
click node_reload "https://github.com/nvidia/dcgm-exporter/blob/main/pkg/cmd/app.go"
click node_dcgm "https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/dcgmprovider"
click node_nvml "https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/nvmlprovider"
click node_deviceinfo "https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/deviceinfo"
click node_watchlists "https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/devicewatchlistmanager"
click node_watcher "https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/devicewatcher"
click node_collectors "https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/collector"
click node_counters "https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/counters"
click node_transform "https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/transformation"
click node_registry "https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/registry"
click node_kube "https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/kubeclient"
click node_render "https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/rendermetrics"
click node_server "https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/server"

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_exporter,node_config,node_reload toneBlue
class node_dcgm,node_nvml,node_deviceinfo,node_watchlists,node_watcher toneAmber
class node_collectors,node_counters,node_transform,node_registry,node_kube toneMint
class node_render,node_server toneRose
class node_operator,node_prometheus toneIndigo
```

## Components

### Startup and lifecycle

- [Exporter CLI](https://github.com/nvidia/dcgm-exporter/blob/main/pkg/cmd/app.go): `pkg/cmd/app.go`
- [Configuration](https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/appconfig): `internal/pkg/appconfig`
- [Reload coordinator](https://github.com/nvidia/dcgm-exporter/blob/main/pkg/cmd/app.go): `pkg/cmd/app.go`

### Telemetry collection

- [DCGM provider](https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/dcgmprovider): `internal/pkg/dcgmprovider`
- [NVML provider](https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/nvmlprovider): `internal/pkg/nvmlprovider`
- [Device inventory](https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/deviceinfo): `internal/pkg/deviceinfo`
- [Watch-list manager](https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/devicewatchlistmanager): `internal/pkg/devicewatchlistmanager`
- [Field watcher](https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/devicewatcher): `internal/pkg/devicewatcher`

### Metric processing

- [Metric collectors](https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/collector): `internal/pkg/collector`
- [Counter definitions](https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/counters): `internal/pkg/counters`
- [Metric transformation](https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/transformation): `internal/pkg/transformation`
- [Metric registry](https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/registry): `internal/pkg/registry`
- [Kubernetes metadata](https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/kubeclient): `internal/pkg/kubeclient`

### HTTP serving

- [Prometheus rendering](https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/rendermetrics): `internal/pkg/rendermetrics`
- [Metrics server](https://github.com/nvidia/dcgm-exporter/tree/main/internal/pkg/server): `internal/pkg/server`

### Other components

- **Operator**
- **Prometheus**

## Connections

- Operator → Exporter CLI: starts
- Exporter CLI → Configuration: loads
- Exporter CLI → Reload coordinator: coordinates
- Reload coordinator → DCGM provider: initializes
- Reload coordinator → NVML provider: initializes
- Reload coordinator → Metric registry: builds
- Watch-list manager → Configuration: reads policy
- Watch-list manager → Device inventory: initializes
- Watch-list manager → Field watcher: registers fields
- Field watcher → DCGM provider: watches fields
- Metric collectors → Counter definitions: uses definitions
- Metric collectors → Watch-list manager: reads watched values
- Metric collectors → Metric registry: registers metrics
- Metric registry → Metric transformation: transforms metrics
- Metrics server → Metric registry: serves registry
- Metrics server → Prometheus rendering: renders metrics
- Prometheus → Metrics server: scrapes
