# tsenart/vegeta architecture

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

- Interactive diagram: https://gitdiagram.com/tsenart/vegeta
- Repository: https://github.com/tsenart/vegeta

## Overview

Vegeta is an HTTP load-testing tool exposed as both a CLI and a Go library. The main workflow parses targets, runs a rate-controlled attack against HTTP services, and emits encoded results; separate commands transform, summarize, and plot those results. The README also documents Prometheus metrics and multiple target/result formats. Edges are limited to calls visible in excerpts or relationships documented in the README; unsampled implementation details are not inferred.

Main entry points: [`attack.go`](https://github.com/tsenart/vegeta/blob/master/attack.go) (Attack command), [`main.go`](https://github.com/tsenart/vegeta/blob/master/main.go) (Vegeta CLI), [`lib/attack.go`](https://github.com/tsenart/vegeta/blob/master/lib/attack.go) (Attack engine), [`encode.go`](https://github.com/tsenart/vegeta/blob/master/encode.go) (Encode command)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflow"]
  node_cli["Vegeta CLI<br/>[main.go]"]
  node_attack_cmd["Attack command<br/>[attack.go]"]
  node_encode_cmd["Encode command<br/>[encode.go]"]
  node_report_cmd["Report command<br/>[report.go]"]
  node_plot_cmd["Plot command<br/>[plot.go]"]
end

subgraph group_attack["Load generation"]
  node_target_input["Target input<br/>[targets.go]"]
  node_dns_resolver["DNS resolver<br/>[resolver.go]"]
  node_attacker["Attack engine<br/>[attack.go]"]
  node_pacer["Rate pacer<br/>[pacer.go]"]
end

subgraph group_results["Results and reporting"]
  node_result_model["Attack results<br/>[results.go]"]
  node_metrics["Metrics aggregation<br/>[metrics.go]"]
  node_decoder["Result decoder<br/>[file.go]"]
  node_encoder["Result encoders<br/>[results.go]"]
  node_reporters["Report generators<br/>[reporters.go]"]
  node_histogram["Histogram reports<br/>[histogram.go]"]
  node_plot_model["Plot builder<br/>[plot.go]"]
  node_time_series["Compressed series<br/>[timeseries.go]"]
  node_downsampler["LTTB downsampler<br/>[lttb.go]"]
end

subgraph group_integrations["Export integrations"]
  node_prom_export["Prometheus exporter<br/>[prom.go]"]
end

node_user(("CLI user"))
node_http_service(("HTTP service"))

node_user -->|"runs commands"| node_cli
node_cli -->|"runs attack"| node_attack_cmd
node_cli -->|"runs encode"| node_encode_cmd
node_cli -->|"runs report"| node_report_cmd
node_cli -->|"runs plot"| node_plot_cmd
node_attack_cmd -->|"creates targeter"| node_target_input
node_attack_cmd -->|"configures resolver"| node_dns_resolver
node_attack_cmd -->|"starts attack"| node_attacker
node_attacker -.->|"paces requests"| node_pacer
node_attacker -.->|"sends requests"| node_http_service
node_attacker -.->|"produces results"| node_result_model
node_attack_cmd -.->|"encodes results"| node_result_model
node_attack_cmd -->|"observes results"| node_prom_export
node_encode_cmd -->|"decodes input"| node_decoder
node_encode_cmd -->|"encodes output"| node_encoder
node_report_cmd -->|"decodes input"| node_decoder
node_report_cmd -->|"selects reporter"| node_reporters
node_reporters -.->|"uses histogram"| node_histogram
node_plot_cmd -->|"decodes input"| node_decoder
node_plot_cmd -->|"adds results"| node_plot_model
node_plot_model -->|"adds points"| node_time_series
node_plot_model -->|"downsamples series"| node_downsampler
node_prom_export -->|"observes metrics"| node_result_model

click node_cli "https://github.com/tsenart/vegeta/blob/master/main.go"
click node_attack_cmd "https://github.com/tsenart/vegeta/blob/master/attack.go"
click node_encode_cmd "https://github.com/tsenart/vegeta/blob/master/encode.go"
click node_report_cmd "https://github.com/tsenart/vegeta/blob/master/report.go"
click node_plot_cmd "https://github.com/tsenart/vegeta/blob/master/plot.go"
click node_target_input "https://github.com/tsenart/vegeta/blob/master/lib/targets.go"
click node_dns_resolver "https://github.com/tsenart/vegeta/blob/master/internal/resolver/resolver.go"
click node_attacker "https://github.com/tsenart/vegeta/blob/master/lib/attack.go"
click node_pacer "https://github.com/tsenart/vegeta/blob/master/lib/pacer.go"
click node_result_model "https://github.com/tsenart/vegeta/blob/master/lib/results.go"
click node_metrics "https://github.com/tsenart/vegeta/blob/master/lib/metrics.go"
click node_decoder "https://github.com/tsenart/vegeta/blob/master/file.go"
click node_encoder "https://github.com/tsenart/vegeta/blob/master/lib/results.go"
click node_reporters "https://github.com/tsenart/vegeta/blob/master/lib/reporters.go"
click node_histogram "https://github.com/tsenart/vegeta/blob/master/lib/histogram.go"
click node_plot_model "https://github.com/tsenart/vegeta/blob/master/lib/plot/plot.go"
click node_time_series "https://github.com/tsenart/vegeta/blob/master/lib/plot/timeseries.go"
click node_downsampler "https://github.com/tsenart/vegeta/blob/master/lib/lttb/lttb.go"
click node_prom_export "https://github.com/tsenart/vegeta/blob/master/lib/prom/prom.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_cli,node_attack_cmd,node_encode_cmd,node_report_cmd,node_plot_cmd,node_user toneBlue
class node_target_input,node_dns_resolver,node_attacker,node_pacer toneAmber
class node_result_model,node_metrics,node_decoder,node_encoder,node_reporters,node_histogram,node_plot_model,node_time_series,node_downsampler toneMint
class node_prom_export toneRose
class node_http_service toneIndigo
```

## Components

### CLI workflow

- [Vegeta CLI](https://github.com/tsenart/vegeta/blob/master/main.go): `main.go`
- [Attack command](https://github.com/tsenart/vegeta/blob/master/attack.go): `attack.go`
- [Encode command](https://github.com/tsenart/vegeta/blob/master/encode.go): `encode.go`
- [Report command](https://github.com/tsenart/vegeta/blob/master/report.go): `report.go`
- [Plot command](https://github.com/tsenart/vegeta/blob/master/plot.go): `plot.go`

### Load generation

- [Target input](https://github.com/tsenart/vegeta/blob/master/lib/targets.go): `lib/targets.go`
- [DNS resolver](https://github.com/tsenart/vegeta/blob/master/internal/resolver/resolver.go): `internal/resolver/resolver.go`
- [Attack engine](https://github.com/tsenart/vegeta/blob/master/lib/attack.go): `lib/attack.go`
- [Rate pacer](https://github.com/tsenart/vegeta/blob/master/lib/pacer.go): `lib/pacer.go`

### Results and reporting

- [Attack results](https://github.com/tsenart/vegeta/blob/master/lib/results.go): `lib/results.go`
- [Metrics aggregation](https://github.com/tsenart/vegeta/blob/master/lib/metrics.go): `lib/metrics.go`
- [Result decoder](https://github.com/tsenart/vegeta/blob/master/file.go): `file.go`
- [Result encoders](https://github.com/tsenart/vegeta/blob/master/lib/results.go): `lib/results.go`
- [Report generators](https://github.com/tsenart/vegeta/blob/master/lib/reporters.go): `lib/reporters.go`
- [Histogram reports](https://github.com/tsenart/vegeta/blob/master/lib/histogram.go): `lib/histogram.go`
- [Plot builder](https://github.com/tsenart/vegeta/blob/master/lib/plot/plot.go): `lib/plot/plot.go`
- [Compressed series](https://github.com/tsenart/vegeta/blob/master/lib/plot/timeseries.go): `lib/plot/timeseries.go`
- [LTTB downsampler](https://github.com/tsenart/vegeta/blob/master/lib/lttb/lttb.go): `lib/lttb/lttb.go`

### Export integrations

- [Prometheus exporter](https://github.com/tsenart/vegeta/blob/master/lib/prom/prom.go): `lib/prom/prom.go`

### Other components

- **CLI user**
- **HTTP service**

## Connections

- CLI user → Vegeta CLI: runs commands (evidence: `README.md`)
- Vegeta CLI → Attack command: runs attack (evidence: `README.md`)
- Vegeta CLI → Encode command: runs encode (evidence: `README.md`)
- Vegeta CLI → Report command: runs report (evidence: `README.md`)
- Vegeta CLI → Plot command: runs plot (evidence: `README.md`)
- Attack command → Target input: creates targeter (evidence: `attack.go`)
- Attack command → DNS resolver: configures resolver (evidence: `attack.go`)
- Attack command → Attack engine: starts attack (evidence: `attack.go`)
- Attack engine → Rate pacer: paces requests
- Attack engine → HTTP service: sends requests
- Attack engine → Attack results: produces results
- Attack command → Attack results: encodes results
- Attack command → Prometheus exporter: observes results (evidence: `attack.go`)
- Encode command → Result decoder: decodes input (evidence: `encode.go`)
- Encode command → Result encoders: encodes output (evidence: `encode.go`)
- Report command → Result decoder: decodes input (evidence: `report.go`)
- Report command → Report generators: selects reporter (evidence: `report.go`)
- Report generators → Histogram reports: uses histogram
- Plot command → Result decoder: decodes input (evidence: `plot.go`)
- Plot command → Plot builder: adds results (evidence: `plot.go`)
- Plot builder → Compressed series: adds points (evidence: `lib/plot/plot.go`)
- Plot builder → LTTB downsampler: downsamples series (evidence: `lib/plot/plot.go`)
- Prometheus exporter → Attack results: observes metrics (evidence: `lib/prom/prom.go`)
