Skip to content

Commit 5f72c3f

Browse files
docs: add architecture graph
1 parent 0662118 commit 5f72c3f

1 file changed

Lines changed: 79 additions & 0 deletions

File tree

docs/architecture.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Architecture
2+
3+
## Execution flow
4+
5+
This diagram shows how the CLI commands, project config, orchestrator (with providers), and executors interact during a benchmark run.
6+
7+
```mermaid
8+
graph TD
9+
subgraph "1. CLI Commands"
10+
RUN["codspeed run <command>"]
11+
EXEC["codspeed exec <command>"]
12+
end
13+
14+
subgraph "2. Config"
15+
PROJ_CFG["ProjectConfig<br/>(codspeed.yaml in repo)<br/>benchmark targets, defaults"]
16+
MERGER["ConfigMerger<br/>CLI args > project config > defaults"]
17+
end
18+
19+
subgraph "3. Orchestrator"
20+
ORCH_CFG["OrchestratorConfig<br/>targets, modes, upload settings"]
21+
ORCH["Orchestrator"]
22+
23+
subgraph "Providers"
24+
LOCAL["LocalProvider"]
25+
CI["CI Providers<br/>(GitHub Actions, GitLab, Buildkite)"]
26+
end
27+
28+
subgraph "Executor (per mode × per target)"
29+
SETUP["1. Setup"]
30+
RUN_STEP["2. Run"]
31+
TEARDOWN["3. Teardown"]
32+
end
33+
34+
UPLOAD["Upload all results to CodSpeed"]
35+
end
36+
37+
subgraph "4. Auth"
38+
CS_CFG["CodSpeedConfig<br/>(~/.config/codspeed/config.yaml)"]
39+
OIDC["OIDC / env token"]
40+
end
41+
42+
%% CLI → Config
43+
RUN -->|"merge CLI args<br/>with project config"| MERGER
44+
EXEC -->|"merge CLI args<br/>with project config"| MERGER
45+
MERGER --> PROJ_CFG
46+
47+
%% CLI → Orchestrator
48+
RUN -->|"single command →<br/>Entrypoint target"| ORCH_CFG
49+
RUN -->|"no command + config →<br/>Exec & Entrypoint targets"| ORCH_CFG
50+
EXEC -->|"always creates<br/>Exec target"| ORCH_CFG
51+
52+
%% Orchestrator init
53+
ORCH_CFG -->|"Orchestrator::new()"| ORCH
54+
ORCH -->|"auto-detect env"| LOCAL
55+
ORCH -->|"auto-detect env"| CI
56+
57+
%% Auth → Providers
58+
CS_CFG -->|"auth token"| LOCAL
59+
OIDC -->|"OIDC / env token"| CI
60+
61+
%% Orchestrator spawns executors
62+
ORCH -->|"for each target × mode:<br/>spawn executor"| SETUP
63+
SETUP --> RUN_STEP
64+
RUN_STEP --> TEARDOWN
65+
66+
%% All executors done → upload
67+
TEARDOWN -->|"collect results"| UPLOAD
68+
69+
%% Provider → Upload (token + metadata)
70+
LOCAL -->|"token + run metadata"| UPLOAD
71+
CI -->|"refresh token<br/>+ run metadata"| UPLOAD
72+
```
73+
74+
### Key interactions
75+
76+
- **CLI → Config**: Both `run` and `exec` merge CLI args with `ProjectConfig` (CLI takes precedence). `run` can source targets from project config; `exec` always creates an `Exec` target.
77+
- **CLI → Orchestrator**: The merged config becomes an `OrchestratorConfig` holding all targets and modes.
78+
- **Orchestrator → Providers**: Auto-detects environment (Local vs CI). Local uses the auth token from `CodSpeedConfig`; CI providers handle OIDC tokens.
79+
- **Orchestrator → Executors**: Groups all `Exec` targets into one exec-harness pipe command, runs each `Entrypoint` independently. For each target group, iterates over all modes, creating an `ExecutionContext` per mode and dispatching to the matching executor (`Valgrind`/`WallTime`/`Memory`). After all runs complete, uploads results with provider metadata.

0 commit comments

Comments
 (0)