# nyulibraries/aswa architecture

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

- Interactive diagram: https://gitdiagram.com/nyulibraries/aswa
- Repository: https://github.com/nyulibraries/aswa

## Overview

ASWA loads a whitelisted YAML application list, optionally selects one application by command-line name, performs HTTP health checks, and reports failures or pushes counters. Checks always probe the configured URL without following redirects; when expected content is configured, they also fetch the redirect-following landing page. In container runs, an entrypoint can post failing output to Slack instead of using metrics. The graph reflects documented behavior and shown calls; Slack delivery is documented in the README, while its implementation is not excerpted.

Main entry points: [`cmd/synthetic_checks.go`](https://github.com/nyulibraries/aswa/blob/main/cmd/synthetic_checks.go) (Check orchestrator), [`pkg/metrics/metrics.go`](https://github.com/nyulibraries/aswa/blob/main/pkg/metrics/metrics.go) (Check counters), [`pkg/application/application.go`](https://github.com/nyulibraries/aswa/blob/main/pkg/application/application.go) (Application check), [`main.go`](https://github.com/nyulibraries/aswa/blob/main/main.go) (Program entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Startup and configuration"]
  node_main["Program entry<br/>[main.go]"]
  node_env["Environment settings<br/>[env_vars.go]"]
  node_loader["Config loader<br/>[config.go]"]
  node_app_configs["Application definitions"]
end

subgraph group_checks["Synthetic checks"]
  node_orchestrator["Check orchestrator"]
  node_application["Application check<br/>[application.go]"]
end

subgraph group_results["Results and notifications"]
  node_result_output["Check result output<br/>[application.go]"]
  node_entrypoint["Container notifier<br/>[entrypoint.sh]"]
end

subgraph group_metrics["Metrics"]
  node_counters["Check counters<br/>[metrics.go]"]
end

node_operator(("Operator"))
node_http_services(("Monitored endpoints"))
node_stdout["Standard output"]
node_slack(("Slack"))
node_pag(("Prom Aggregation Gateway"))

node_operator -->|"runs"| node_main
node_main -->|"starts checks"| node_orchestrator
node_orchestrator -->|"gets settings"| node_env
node_orchestrator -->|"loads config"| node_loader
node_loader -->|"reads YAML"| node_app_configs
node_orchestrator -->|"runs each check"| node_application
node_application -->|"probes and fetches"| node_http_services
node_application -->|"formats status"| node_result_output
node_orchestrator -->|"increments counters"| node_counters
node_counters -->|"gets environment"| node_env
node_orchestrator -->|"pushes metrics"| node_counters
node_counters -->|"pushes metrics"| node_pag
node_orchestrator -->|"writes results"| node_stdout
node_stdout -->|"captures output"| node_entrypoint
node_entrypoint -->|"posts failures"| node_slack

click node_main "https://github.com/nyulibraries/aswa/blob/main/main.go"
click node_env "https://github.com/nyulibraries/aswa/blob/main/pkg/config/env_vars.go"
click node_loader "https://github.com/nyulibraries/aswa/blob/main/pkg/config/config.go"
click node_app_configs "https://github.com/nyulibraries/aswa/tree/main/config"
click node_orchestrator "https://github.com/nyulibraries/aswa/blob/main/cmd/synthetic_checks.go"
click node_application "https://github.com/nyulibraries/aswa/blob/main/pkg/application/application.go"
click node_result_output "https://github.com/nyulibraries/aswa/blob/main/pkg/application/application.go"
click node_entrypoint "https://github.com/nyulibraries/aswa/blob/main/entrypoint.sh"
click node_counters "https://github.com/nyulibraries/aswa/blob/main/pkg/metrics/metrics.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_main,node_env,node_loader,node_app_configs toneBlue
class node_orchestrator,node_application toneAmber
class node_result_output,node_entrypoint toneMint
class node_counters toneRose
class node_operator,node_http_services,node_stdout,node_slack,node_pag toneIndigo
```

## Components

### Startup and configuration

- [Program entry](https://github.com/nyulibraries/aswa/blob/main/main.go): `main.go`
- [Environment settings](https://github.com/nyulibraries/aswa/blob/main/pkg/config/env_vars.go): `pkg/config/env_vars.go`
- [Config loader](https://github.com/nyulibraries/aswa/blob/main/pkg/config/config.go): `pkg/config/config.go`
- [Application definitions](https://github.com/nyulibraries/aswa/tree/main/config): `config`

### Synthetic checks

- [Check orchestrator](https://github.com/nyulibraries/aswa/blob/main/cmd/synthetic_checks.go): `cmd/synthetic_checks.go`
- [Application check](https://github.com/nyulibraries/aswa/blob/main/pkg/application/application.go): `pkg/application/application.go`

### Results and notifications

- [Check result output](https://github.com/nyulibraries/aswa/blob/main/pkg/application/application.go): `pkg/application/application.go`
- [Container notifier](https://github.com/nyulibraries/aswa/blob/main/entrypoint.sh): `entrypoint.sh`

### Metrics

- [Check counters](https://github.com/nyulibraries/aswa/blob/main/pkg/metrics/metrics.go): `pkg/metrics/metrics.go`

### Other components

- **Operator**
- **Monitored endpoints**
- **Standard output**
- **Slack**
- **Prom Aggregation Gateway**

## Connections

- Operator → Program entry: runs (evidence: `README.md`)
- Program entry → Check orchestrator: starts checks (evidence: `main.go`)
- Check orchestrator → Environment settings: gets settings (evidence: `cmd/synthetic_checks.go`)
- Check orchestrator → Config loader: loads config (evidence: `cmd/synthetic_checks.go`)
- Config loader → Application definitions: reads YAML (evidence: `pkg/config/config.go`)
- Check orchestrator → Application check: runs each check (evidence: `cmd/synthetic_checks.go`)
- Application check → Monitored endpoints: probes and fetches (evidence: `README.md`)
- Application check → Check result output: formats status (evidence: `pkg/application/application.go`)
- Check orchestrator → Check counters: increments counters (evidence: `cmd/synthetic_checks.go`)
- Check counters → Environment settings: gets environment (evidence: `pkg/metrics/metrics.go`)
- Check orchestrator → Check counters: pushes metrics (evidence: `cmd/synthetic_checks.go`)
- Check counters → Prom Aggregation Gateway: pushes metrics (evidence: `pkg/metrics/metrics.go`)
- Check orchestrator → Standard output: writes results (evidence: `cmd/synthetic_checks.go`)
- Standard output → Container notifier: captures output (evidence: `README.md`)
- Container notifier → Slack: posts failures (evidence: `README.md`)
