# adtigupta/observability_scope architecture

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

- Interactive diagram: https://gitdiagram.com/adtigupta/observability_scope
- Repository: https://github.com/adtigupta/observability_scope

## Overview

##### Project type and purpose
- This is an observability‐focused DevOps stack that demonstrates real‐time infrastructure and application monitoring.  It uses Docker Compose to orchestrate:
- Prometheus (metrics collector)
- Grafana (visualization)
- cAdvisor (container resource monitoring)
- Node Exporter (host OS/hardware metrics)
- A sample “Notes App” (Django + React) to generate custom application metrics

##### File structure
- Top-level files:
- docker-compose.yaml – defines all services (Prometheus, Grafana, cAdvisor, Node Exporter, Notes App) on a custom “monitoring” network.
- prometheus.yml – scrape targets and job definitions.
- notes-app/ – full-stack sample application:
- api/ – Django REST API (models, serializers, views, URLs, migrations)
- notesapp/ – Django project settings, wsgi/asgi, URL routing
- staticfiles/ – collected Django static + React build artifacts
- mynotes/ – React code (src/, public/, package.json) and Dockerfile
- Dockerfile, Jenkinsfile – CI/CD and containerization for Notes App

##### Extract architecture details from README
- Custom bridge network “monitoring” for inter‐service communication
- Persisted volumes: prometheus_data, grafana_data
- Grafana dashboards preconfigured to query Prometheus
- Notes App exposes both UI (React) and REST API + metrics endpoint

##### Main components
a. Docker Host
b. Docker Network: “monitoring”
c. Containers:
– Node Exporter (9100)
– cAdvisor (8080)
– Prometheus (9090) with attached volume (prometheus_data)
– Grafana (3000) with attached volume (grafana_data)
– Notes App container:
- Django REST API (8000)
- React static UI
- DB: SQLite (embedded file inside container)
d. External Users/Clients:
– DevOps engineer accessing Grafana & Prometheus UI
– End-users interacting with Notes App UI/API

##### Relationships & interactions
- Node Exporter → exposes /metrics → scraped by Prometheus
- cAdvisor → exposes container metrics → scraped by Prometheus
- Notes App → application metrics endpoint → scraped by Prometheus
- Prometheus → stores time‐series data in prometheus_data volume
- Grafana → queries Prometheus API → renders dashboards → data persisted in grafana_data
- Users → HTTP → Grafana (3000), Prometheus (9090), Notes App UI (8000) / API

##### Architectural patterns
- Microservices style (monitoring stack + sample app each in its own container)
- Shared network for service discovery
- Persistent volumes for stateful services (Prometheus, Grafana)
- Single Docker Compose file as orchestration layer
- Full-stack sample app separation: React front-end vs Django back-end

##### Essential elements
- Component labels (e.g., “Prometheus (9090)”)
- Monitoring agents
- Data stores
- Application services
- Users/clients

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Users
    subgraph "Users"
        U1["DevOps Engineer"]:::user
        U2["End-User"]:::user
    end

    %% Docker Host and Network
    subgraph "Docker Host"
        subgraph "monitoring (bridge network)"        
            NE["Node Exporter (9100)"]:::monitor
            CA["cAdvisor (8080)"]:::monitor
            PR["Prometheus (9090)"]:::monitor
            PC["prometheus.yml"]:::config
            GF["Grafana (3000)"]:::monitor
            V1["prometheus_data"]:::volume
            V2["grafana_data"]:::volume

            subgraph "Notes App"
                NAC["Notes App Container"]:::app
                UI["React UI (8000)"]:::app
                API["Django API (8000) + /metrics"]:::app
                DB["SQLite DB"]:::db
                UI -->|"serves static build"| SF["staticfiles"]:::storage
            end
        end
    end

    Assets["assets/images/"]:::assets

    %% Interactions
    NE -->|"scrape /metrics"| PR
    CA -->|"scrape /metrics"| PR
    API -->|"scrape /metrics"| PR
    PR -->|"store data"| V1
    GF -->|"store dashboards"| V2
    PR -->|"query API"| GF
    U1 -->|"HTTP GET"| GF
    U1 -->|"HTTP GET"| PR
    U2 -->|"HTTP GET UI/API"| UI
    U2 -->|"HTTP GET UI/API"| API

    %% Click Events
    click NE "https://github.com/adtigupta/observability_scope/blob/master/docker-compose.yaml"
    click CA "https://github.com/adtigupta/observability_scope/blob/master/docker-compose.yaml"
    click PR "https://github.com/adtigupta/observability_scope/blob/master/docker-compose.yaml"
    click GF "https://github.com/adtigupta/observability_scope/blob/master/docker-compose.yaml"
    click PC "https://github.com/adtigupta/observability_scope/blob/master/prometheus.yml"
    click NAC "https://github.com/adtigupta/observability_scope/tree/master/notes-app/Dockerfile"
    click NAC "https://github.com/adtigupta/observability_scope/tree/master/notes-app/Jenkinsfile"
    click API "https://github.com/adtigupta/observability_scope/tree/master/notes-app/api/"
    click UI "https://github.com/adtigupta/observability_scope/tree/master/notes-app/mynotes/build/"
    click SF "https://github.com/adtigupta/observability_scope/tree/master/notes-app/staticfiles/"
    click Assets "https://github.com/adtigupta/observability_scope/tree/master/assets/images/"

    %% Styles
    classDef user fill:#f9f,stroke:#333,stroke-width:1px
    classDef monitor fill:#ccf,stroke:#006,stroke-width:1px
    classDef app fill:#cfc,stroke:#060,stroke-width:1px
    classDef db fill:#fcf,stroke:#606,stroke-width:1px
    classDef volume fill:#ffe699,stroke:#b58900,stroke-width:1px
    classDef config fill:#ffd1dc,stroke:#b2001a,stroke-width:1px
    classDef storage fill:#ddd,stroke:#888,stroke-width:1px
    classDef assets fill:#eee,stroke:#666,stroke-width:1px,nodePadding:4px,nodeMargin:6px
```
