# hikana/lsa-demo architecture

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

- Interactive diagram: https://gitdiagram.com/hikana/lsa-demo
- Repository: https://github.com/hikana/lsa-demo

## Overview

This is a Prometheus teaching lab built around a Flask course-enrollment service. A student submits a course request; the service checks enrollment rules, updates in-memory capacity state, and returns a result. A separate load generator can exercise that endpoint. The repository also includes Prometheus/Grafana monitoring and an OpenTelemetry demo configuration. The app’s Prometheus counter and metrics endpoint are still TODOs, and monitoring wiring is represented only by repository structure, not inspected configuration; those links are therefore dashed and unverified.

Main entry points: [`app/app.py`](https://github.com/hikana/lsa-demo/blob/main/app/app.py) (Course enrollment), [`prometheus/prometheus.yml`](https://github.com/hikana/lsa-demo/blob/main/prometheus/prometheus.yml) (Prometheus), [`demo/o11y/otel-collector.yaml`](https://github.com/hikana/lsa-demo/blob/main/demo/o11y/otel-collector.yaml) (OTel collector), [`loadgen/loadgen.py`](https://github.com/hikana/lsa-demo/blob/main/loadgen/loadgen.py) (Load generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_enrollment["Enrollment service"]
  node_enrollment_app["Course enrollment<br/>[app.py]"]
  node_course_state[("Course capacity state<br/>[app.py]")]
  node_enrollment_rules["Prerequisite rules<br/>[enroll_rules.py]"]
end

subgraph group_traffic["Traffic generation"]
  node_load_generator["Load generator<br/>[loadgen.py]"]
end

subgraph group_metrics["Metrics and dashboards"]
  node_prometheus["Prometheus<br/>[prometheus.yml]"]
  node_node_exporter["Node exporter<br/>[compose.yaml]"]
  node_grafana["Grafana dashboards<br/>[course.json]"]
end

subgraph group_tracing["Tracing demo"]
  node_otel_instrumentation["Trace instrumentation<br/>[enroll_rules.py]"]
  node_otel_collector["OTel collector"]
  node_tempo["Tempo<br/>[tempo.yaml]"]
end

node_student(("Student"))

node_student -->|"submits enrollment"| node_enrollment_app
node_enrollment_app -->|"checks prerequisites"| node_enrollment_rules
node_enrollment_app -->|"updates capacity"| node_course_state
node_load_generator -->|"posts requests"| node_enrollment_app
node_enrollment_app -.->|"exposes metrics"| node_prometheus
node_prometheus -.->|"scrapes metrics"| node_node_exporter
node_grafana -.->|"queries metrics"| node_prometheus
node_otel_instrumentation -.->|"exports traces"| node_otel_collector
node_otel_collector -.->|"sends traces"| node_tempo

click node_enrollment_app "https://github.com/hikana/lsa-demo/blob/main/app/app.py"
click node_course_state "https://github.com/hikana/lsa-demo/blob/main/app/app.py"
click node_enrollment_rules "https://github.com/hikana/lsa-demo/blob/main/app/enroll_rules.py"
click node_load_generator "https://github.com/hikana/lsa-demo/blob/main/loadgen/loadgen.py"
click node_prometheus "https://github.com/hikana/lsa-demo/blob/main/prometheus/prometheus.yml"
click node_node_exporter "https://github.com/hikana/lsa-demo/blob/main/node-exporter/compose.yaml"
click node_grafana "https://github.com/hikana/lsa-demo/blob/main/grafana/dashboards/course.json"
click node_otel_instrumentation "https://github.com/hikana/lsa-demo/blob/main/app/enroll_rules.py"
click node_otel_collector "https://github.com/hikana/lsa-demo/blob/main/demo/o11y/otel-collector.yaml"
click node_tempo "https://github.com/hikana/lsa-demo/blob/main/demo/o11y/tempo.yaml"

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_enrollment_app,node_course_state,node_enrollment_rules toneBlue
class node_load_generator toneAmber
class node_prometheus,node_node_exporter,node_grafana toneMint
class node_otel_instrumentation,node_otel_collector,node_tempo toneRose
class node_student toneIndigo
```

## Components

### Enrollment service

- [Course enrollment](https://github.com/hikana/lsa-demo/blob/main/app/app.py): `app/app.py`
- [Course capacity state](https://github.com/hikana/lsa-demo/blob/main/app/app.py): `app/app.py`
- [Prerequisite rules](https://github.com/hikana/lsa-demo/blob/main/app/enroll_rules.py): `app/enroll_rules.py`

### Traffic generation

- [Load generator](https://github.com/hikana/lsa-demo/blob/main/loadgen/loadgen.py): `loadgen/loadgen.py`

### Metrics and dashboards

- [Prometheus](https://github.com/hikana/lsa-demo/blob/main/prometheus/prometheus.yml): `prometheus/prometheus.yml`
- [Node exporter](https://github.com/hikana/lsa-demo/blob/main/node-exporter/compose.yaml): `node-exporter/compose.yaml`
- [Grafana dashboards](https://github.com/hikana/lsa-demo/blob/main/grafana/dashboards/course.json): `grafana/dashboards/course.json`

### Tracing demo

- [Trace instrumentation](https://github.com/hikana/lsa-demo/blob/main/app/enroll_rules.py): `app/enroll_rules.py`
- [OTel collector](https://github.com/hikana/lsa-demo/blob/main/demo/o11y/otel-collector.yaml): `demo/o11y/otel-collector.yaml`
- [Tempo](https://github.com/hikana/lsa-demo/blob/main/demo/o11y/tempo.yaml): `demo/o11y/tempo.yaml`

### Other components

- **Student**

## Connections

- Student → Course enrollment: submits enrollment (evidence: `README.md`)
- Course enrollment → Prerequisite rules: checks prerequisites (evidence: `app/app.py`)
- Course enrollment → Course capacity state: updates capacity (evidence: `app/app.py`)
- Load generator → Course enrollment: posts requests (evidence: `loadgen/loadgen.py`)
- Course enrollment → Prometheus: exposes metrics
- Prometheus → Node exporter: scrapes metrics
- Grafana dashboards → Prometheus: queries metrics
- Trace instrumentation → OTel collector: exports traces
- OTel collector → Tempo: sends traces
