# aizikfriedman/synthetic-exporter architecture

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

- Interactive diagram: https://gitdiagram.com/aizikfriedman/synthetic-exporter
- Repository: https://github.com/aizikfriedman/synthetic-exporter

## Overview

Synthetic Exporter runs configured API/TLS checks and Playwright UI journeys in a background worker, then serves cached Prometheus metrics for scraping. Configuration, check execution, metrics, and the scrape endpoint all live in main.go. The README documents YAML scenarios, API headers, environment-variable secrets, error labels, and metric types; source excerpts confirm the worker, checks, browser actions, and HTTP server. The repository is a compact single-file runtime, so several responsibilities share one source path.

Main entry points: [`main.go`](https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go) (Background worker), [`config.yaml`](https://github.com/aizikfriedman/synthetic-exporter/blob/main/config.yaml) (YAML config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_configuration["Configuration"]
  node_yaml_config["YAML config<br/>[config.yaml]"]
  node_config_loader["Config loader<br/>[main.go]"]
  node_secret_resolution["Secret resolution<br/>[main.go]"]
  node_api_targets["Configured API targets<br/>[config.yaml]"]
end

subgraph group_checks["Synthetic checks"]
  node_background_worker["Background worker<br/>[main.go]"]
  node_api_checks["API and TLS checks<br/>[main.go]"]
  node_ui_scenarios["UI scenarios<br/>[main.go]"]
  node_scenario_runner["Scenario runner<br/>[main.go]"]
  node_step_actions["Browser step actions<br/>[main.go]"]
end

subgraph group_observability["Metrics and serving"]
  node_metrics_registry[("Metrics registry<br/>[main.go]")]
  node_metrics_endpoint["Metrics endpoint<br/>[main.go]"]
  node_health_endpoint["Health endpoint<br/>[main.go]"]
end

node_operator(("Operator"))
node_prometheus(("Prometheus"))
node_web_services["Monitored services"]

node_operator -->|"defines checks"| node_yaml_config
node_yaml_config -->|"loads configuration"| node_config_loader
node_config_loader -->|"resolves secrets"| node_secret_resolution
node_config_loader -->|"starts checks"| node_background_worker
node_background_worker -->|"runs checks"| node_api_checks
node_background_worker -->|"runs journeys"| node_ui_scenarios
node_ui_scenarios -->|"dispatches scenarios"| node_scenario_runner
node_scenario_runner -->|"executes steps"| node_step_actions
node_api_checks -->|"reads targets"| node_api_targets
node_api_checks -->|"checks HTTP and TLS"| node_web_services
node_step_actions -->|"drives browser"| node_web_services
node_background_worker -->|"updates metrics"| node_metrics_registry
node_metrics_endpoint -->|"serves metrics"| node_metrics_registry
node_prometheus -->|"scrapes"| node_metrics_endpoint
node_operator -->|"checks health"| node_health_endpoint

click node_yaml_config "https://github.com/aizikfriedman/synthetic-exporter/blob/main/config.yaml"
click node_config_loader "https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go"
click node_secret_resolution "https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go"
click node_background_worker "https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go"
click node_api_checks "https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go"
click node_ui_scenarios "https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go"
click node_scenario_runner "https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go"
click node_step_actions "https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go"
click node_api_targets "https://github.com/aizikfriedman/synthetic-exporter/blob/main/config.yaml"
click node_metrics_registry "https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go"
click node_metrics_endpoint "https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go"
click node_health_endpoint "https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.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_yaml_config,node_config_loader,node_secret_resolution,node_api_targets toneBlue
class node_background_worker,node_api_checks,node_ui_scenarios,node_scenario_runner,node_step_actions toneAmber
class node_metrics_registry,node_metrics_endpoint,node_health_endpoint toneMint
class node_operator,node_prometheus,node_web_services toneIndigo
```

## Components

### Configuration

- [YAML config](https://github.com/aizikfriedman/synthetic-exporter/blob/main/config.yaml): `config.yaml`
- [Config loader](https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go): `main.go`
- [Secret resolution](https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go): `main.go`
- [Configured API targets](https://github.com/aizikfriedman/synthetic-exporter/blob/main/config.yaml): `config.yaml`

### Synthetic checks

- [Background worker](https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go): `main.go`
- [API and TLS checks](https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go): `main.go`
- [UI scenarios](https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go): `main.go`
- [Scenario runner](https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go): `main.go`
- [Browser step actions](https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go): `main.go`

### Metrics and serving

- [Metrics registry](https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go): `main.go`
- [Metrics endpoint](https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go): `main.go`
- [Health endpoint](https://github.com/aizikfriedman/synthetic-exporter/blob/main/main.go): `main.go`

### Other components

- **Operator**
- **Prometheus**
- **Monitored services**

## Connections

- Operator → YAML config: defines checks (evidence: `README.md`)
- YAML config → Config loader: loads configuration (evidence: `main.go`)
- Config loader → Secret resolution: resolves secrets (evidence: `main.go`)
- Config loader → Background worker: starts checks (evidence: `main.go`)
- Background worker → API and TLS checks: runs checks (evidence: `main.go`)
- Background worker → UI scenarios: runs journeys (evidence: `main.go`)
- UI scenarios → Scenario runner: dispatches scenarios (evidence: `main.go`)
- Scenario runner → Browser step actions: executes steps (evidence: `main.go`)
- API and TLS checks → Configured API targets: reads targets (evidence: `main.go`)
- API and TLS checks → Monitored services: checks HTTP and TLS (evidence: `main.go`)
- Browser step actions → Monitored services: drives browser (evidence: `main.go`)
- Background worker → Metrics registry: updates metrics (evidence: `main.go`)
- Metrics endpoint → Metrics registry: serves metrics (evidence: `main.go`)
- Prometheus → Metrics endpoint: scrapes (evidence: `README.md`)
- Operator → Health endpoint: checks health (evidence: `main.go`)
