# simpledotorg/rtsl_exporter architecture

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

- Interactive diagram: https://gitdiagram.com/simpledotorg/rtsl_exporter
- Repository: https://github.com/simpledotorg/rtsl_exporter

## Overview

RTSL Exporter is a Go Prometheus exporter that polls configured services and exposes their data at `/metrics`. The principal path is configuration and startup, metric collection by provider-specific exporters, outbound API requests, and Prometheus exposition. AlphaSMS and SendGrid are wired in `main.go`; DHIS2 collection is implemented but its startup wiring is not shown in the sampled entry point. Relationships below follow the excerpts and README; no unsampled wiring is assumed.

Main entry points: [`main.go`](https://github.com/simpledotorg/rtsl_exporter/blob/master/main.go) (Startup and registration), [`dhis2/exporter.go`](https://github.com/simpledotorg/rtsl_exporter/blob/master/dhis2/exporter.go) (DHIS2 collector), [`alphasms/exporter.go`](https://github.com/simpledotorg/rtsl_exporter/blob/master/alphasms/exporter.go) (AlphaSMS collector), [`sendgrid/exporter.go`](https://github.com/simpledotorg/rtsl_exporter/blob/master/sendgrid/exporter.go) (SendGrid collector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Exporter runtime"]
  node_configuration["YAML configuration<br/>[main.go]"]
  node_startup["Startup and registration<br/>[main.go]"]
  node_metrics_http["Metrics endpoint<br/>[main.go]"]
end

subgraph group_providers["Provider collectors"]
  node_alpha_exporter["AlphaSMS collector<br/>[exporter.go]"]
  node_sendgrid_exporter["SendGrid collector<br/>[exporter.go]"]
  node_dhis2_exporter["DHIS2 collector<br/>[exporter.go]"]
end

subgraph group_clients["API clients"]
  node_alpha_client["AlphaSMS client<br/>[client.go]"]
  node_sendgrid_client["SendGrid client<br/>[client.go]"]
  node_dhis2_client["DHIS2 client<br/>[client.go]"]
end

node_operator(("Operator"))
node_prometheus(("Prometheus scraper"))
node_alpha_api{{"AlphaSMS API"}}
node_sendgrid_api{{"SendGrid API"}}
node_dhis2_api{{"DHIS2 API"}}

node_operator -->|"supplies settings"| node_configuration
node_configuration -->|"configures"| node_startup
node_startup -->|"registers"| node_alpha_exporter
node_startup -->|"registers"| node_sendgrid_exporter
node_startup -->|"serves"| node_metrics_http
node_prometheus -->|"scrapes"| node_metrics_http
node_alpha_exporter -->|"requests balance"| node_alpha_client
node_alpha_client -->|"fetches balance"| node_alpha_api
node_sendgrid_exporter -->|"fetches credits"| node_sendgrid_client
node_sendgrid_client -->|"requests credits"| node_sendgrid_api
node_dhis2_exporter -->|"requests system info"| node_dhis2_client
node_dhis2_client -->|"fetches system info"| node_dhis2_api
node_dhis2_exporter -.->|"registration unshown"| node_startup

click node_configuration "https://github.com/simpledotorg/rtsl_exporter/blob/master/main.go"
click node_startup "https://github.com/simpledotorg/rtsl_exporter/blob/master/main.go"
click node_metrics_http "https://github.com/simpledotorg/rtsl_exporter/blob/master/main.go"
click node_alpha_exporter "https://github.com/simpledotorg/rtsl_exporter/blob/master/alphasms/exporter.go"
click node_alpha_client "https://github.com/simpledotorg/rtsl_exporter/blob/master/alphasms/client.go"
click node_sendgrid_exporter "https://github.com/simpledotorg/rtsl_exporter/blob/master/sendgrid/exporter.go"
click node_sendgrid_client "https://github.com/simpledotorg/rtsl_exporter/blob/master/sendgrid/client.go"
click node_dhis2_exporter "https://github.com/simpledotorg/rtsl_exporter/blob/master/dhis2/exporter.go"
click node_dhis2_client "https://github.com/simpledotorg/rtsl_exporter/blob/master/dhis2/client.go"

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_configuration,node_startup,node_metrics_http toneBlue
class node_alpha_exporter,node_sendgrid_exporter,node_dhis2_exporter toneAmber
class node_alpha_client,node_sendgrid_client,node_dhis2_client,node_alpha_api,node_sendgrid_api,node_dhis2_api toneMint
class node_operator,node_prometheus toneIndigo
```

## Components

### Exporter runtime

- [YAML configuration](https://github.com/simpledotorg/rtsl_exporter/blob/master/main.go): `main.go`
- [Startup and registration](https://github.com/simpledotorg/rtsl_exporter/blob/master/main.go): `main.go`
- [Metrics endpoint](https://github.com/simpledotorg/rtsl_exporter/blob/master/main.go): `main.go`

### Provider collectors

- [AlphaSMS collector](https://github.com/simpledotorg/rtsl_exporter/blob/master/alphasms/exporter.go): `alphasms/exporter.go`
- [SendGrid collector](https://github.com/simpledotorg/rtsl_exporter/blob/master/sendgrid/exporter.go): `sendgrid/exporter.go`
- [DHIS2 collector](https://github.com/simpledotorg/rtsl_exporter/blob/master/dhis2/exporter.go): `dhis2/exporter.go`

### API clients

- [AlphaSMS client](https://github.com/simpledotorg/rtsl_exporter/blob/master/alphasms/client.go): `alphasms/client.go`
- [SendGrid client](https://github.com/simpledotorg/rtsl_exporter/blob/master/sendgrid/client.go): `sendgrid/client.go`
- [DHIS2 client](https://github.com/simpledotorg/rtsl_exporter/blob/master/dhis2/client.go): `dhis2/client.go`

### Other components

- **Operator**
- **Prometheus scraper**
- **AlphaSMS API**
- **SendGrid API**
- **DHIS2 API**

## Connections

- Operator → YAML configuration: supplies settings (evidence: `README.md`)
- YAML configuration → Startup and registration: configures (evidence: `main.go`)
- Startup and registration → AlphaSMS collector: registers (evidence: `main.go`)
- Startup and registration → SendGrid collector: registers (evidence: `main.go`)
- Startup and registration → Metrics endpoint: serves (evidence: `main.go`)
- Prometheus scraper → Metrics endpoint: scrapes (evidence: `README.md`)
- AlphaSMS collector → AlphaSMS client: requests balance (evidence: `alphasms/exporter.go`)
- AlphaSMS client → AlphaSMS API: fetches balance (evidence: `alphasms/client.go`)
- SendGrid collector → SendGrid client: fetches credits (evidence: `sendgrid/exporter.go`)
- SendGrid client → SendGrid API: requests credits (evidence: `sendgrid/client.go`)
- DHIS2 collector → DHIS2 client: requests system info (evidence: `dhis2/exporter.go`)
- DHIS2 client → DHIS2 API: fetches system info (evidence: `dhis2/client.go`)
- DHIS2 collector → Startup and registration: registration unshown
