# kumailr7/locust-grafana-docker architecture

> Architecture diagram of the GitHub repository kumailr7/locust-grafana-docker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kumailr7/locust-grafana-docker
- Repository: https://github.com/kumailr7/locust-grafana-docker

## Overview

##### Main Services Layer
- Locust Master Node
- Locust Worker Nodes (scalable)
- Prometheus (Monitoring)
- Grafana (Visualization)
- Target API (System Under Test)

##### Data Flow Layer
- Metrics collection
- Load test execution
- Results visualization

##### Component Representations
- Use rectangles for main services (Locust Master, Workers, Prometheus, Grafana)
- Use cloud symbols for the Target API
- Blue: Locust components
- Orange: Monitoring components
- Green: Target system
- Gray: Infrastructure components

##### Specific Elements

a. Control Plane:
- [Locust Web UI (8089)] <- User Interaction

- [Locust Master]

- [Worker 1] [Worker 2] ... [Worker N]

- [Target API]

b. Monitoring Plane:
- [Locust Exporter] -> [Prometheus] -> [Grafana]

##### Additional Details
- Port numbers (8089, 3000)
- Docker container boundaries
- Volume mounts for configuration files
- Scaling capabilities of worker nodes

##### Notes Section
A small notes section indicating:
- Docker Compose orchestration
- Configuration file locations
- Scaling capabilities
- Authentication points (Grafana login)

Key Relationships to Highlight:
##### Configuration management

Remember to:
- Use consistent sizing for similar components
- Clear labels and annotations
- Both control and data flows
- Scalability points
- Configuration touchpoints

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Control
        UI[Locust Web UI]
        Master[Locust Master]
        UI --> Master
    end

    subgraph Workers
        W1[Worker Node 1]
        W2[Worker Node 2]
        W3[Worker Node N]
    end

    subgraph Monitoring
        direction TB
        P[(Prometheus)]
        G[Grafana Dashboard]
        EXP[Locust Exporter]
    end

    subgraph Target
        API[Target API System]:::target
    end

    %% Connections
    Master --> W1
    Master --> W2
    Master --> W3
    W1 --> API
    W2 --> API
    W3 --> API
    
    EXP --> P
    P --> G
    Master --> EXP

    %% Click events
    click Master "https://github.com/kumailr7/locust-grafana-docker/blob/main/load_tests.py"
    click P "https://github.com/kumailr7/locust-grafana-docker/blob/main/prometheus.yml"
    click G "https://github.com/kumailr7/locust-grafana-docker/blob/main/grafana_dashboard.json"

    %% Styles
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef master fill:#4a90e2,stroke:#2171c7,color:white
    classDef worker fill:#5cb85c,stroke:#4cae4c,color:white
    classDef monitoring fill:#f0ad4e,stroke:#eea236,color:white
    classDef target fill:#d9534f,stroke:#d43f3a,color:white

    class Master master
    class W1,W2,W3 worker
    class P,G,EXP monitoring
    class API target

    %% Legend
    subgraph Legend
        L1[Master Node]:::master
        L2[Worker Nodes]:::worker
        L3[Monitoring Tools]:::monitoring
        L4[Target System]:::target
    end
```
