# devsecopsmaturitymodel/metricca architecture

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

- Interactive diagram: https://gitdiagram.com/devsecopsmaturitymodel/metricca
- Repository: https://github.com/devsecopsmaturitymodel/metricca

## Overview

##### Main Components
- Data Collection Modules:
- Collector (e.g., “collector-confluence”) that fetches data from external platforms (e.g., Confluence, and potentially Jira/GitHub as mentioned).
- Data Processing Module:
- Metric Analyzer that processes the collected data.
- Data Visualization Module:
- Kubernetes Infrastructure:
- Since the deployment is managed via Kubernetes (using kustomizations for base and overlay configurations), include a block representing the Kubernetes Cluster.
- Additional Elements:
- External Services: Indicate external data sources or APIs (e.g., Confluence, GitHub, Jira).
- Secrets Management: Represent the mechanism of configuration and secrets that are applied from the “overlay/secrets” directory.
- Persistent Volumes: Note the use of PVCs (e.g., there’s a PVC configuration for Grafana) for storage.

##### Relationships and Interactions
- That all these components (collector-confluence, metric-analyzer, grafana) are deployed and managed within a Kubernetes cluster.
- Configuration management and secrets injection from the Kubernetes overlay layer, showing how these secure aspects feed into the respective services.

##### Architectural Patterns and Design Principles
- Microservices Architecture: The separation into discrete components (collector, analyzer, visualization), each packaged and deployed as a Kubernetes service.
- Kubernetes-based Deployment: Emphasize that components are containerized and orchestrated via Kubernetes, which provides scalability and reliability.
- YAML-driven Configuration: The design leverages YAML manifests, kustomizations, and overlays for managing different deployment aspects (base configurations, PVC, secrets, etc.). Acknowledge that this allows non-technical modifications (e.g., by product owners or security teams).

##### Relevant Technologies & Frameworks
- Kubernetes: For orchestration and service management.
- Kustomize: As evidenced by the “kustomizations” directories, used for managing configurations.
- Grafana: For data visualization.
- Custom Services: Such as collector-confluence and metric-analyzer for data ingestion and processing.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "External Data Sources"
        EC["Confluence API"]:::external
        GH["GitHub API"]:::external
        JI["Jira API"]:::external
    end

    subgraph "Kubernetes Configurations"
        BaseConfig["K8s Base Config"]:::config
        OverlayConfig["K8s Overlay Config"]:::config
        Secrets["Secrets Management"]:::config
    end

    subgraph "Persistent Volumes"
        PVCBase["Grafana PVC (Base)"]:::pvc
        PVCOverlay["Grafana PVC (Overlay)"]:::pvc
    end

    subgraph "Kubernetes Cluster"
        K8sDep["K8s Deployment"]:::configManagement
        Collector["Collector (Confluence)"]:::service
        Analyzer["Metric Analyzer"]:::service
        Grafana["Grafana Dashboard"]:::service
    end

    Users["Dashboard Users"]:::external

    %% External data flows
    EC -->|"fetchData"| Collector
    GH -->|"fetchData"| Collector
    JI -->|"fetchData"| Collector

    %% Configuration flows to Kubernetes deployment
    BaseConfig --> K8sDep
    OverlayConfig --> K8sDep
    Secrets --> K8sDep

    %% Deployment distributes to services
    K8sDep --> Collector
    K8sDep --> Analyzer
    K8sDep --> Grafana

    %% Internal service interactions
    Collector -->|"sendData"| Analyzer
    Analyzer -->|"sendMetrics"| Grafana

    %% Persistent volumes attached to Grafana
    PVCBase -->|"attachStorage"| Grafana
    PVCOverlay -->|"attachStorage"| Grafana

    %% Grafana delivers data to users
    Grafana -->|"displayMetrics"| Users

    %% Click Events
    click Collector "https://github.com/devsecopsmaturitymodel/metricca/tree/master/deployment/kustomizations/base/collector-confluence"
    click Analyzer "https://github.com/devsecopsmaturitymodel/metricca/tree/master/deployment/kustomizations/base/metricAnalyzer"
    click Grafana "https://github.com/devsecopsmaturitymodel/metricca/tree/master/deployment/kustomizations/base/grafana"
    click BaseConfig "https://github.com/devsecopsmaturitymodel/metricca/tree/master/deployment/kustomizations/base"
    click OverlayConfig "https://github.com/devsecopsmaturitymodel/metricca/tree/master/deployment/kustomizations/overlay"
    click Secrets "https://github.com/devsecopsmaturitymodel/metricca/tree/master/deployment/kustomizations/overlay/secrets"
    click PVCBase "https://github.com/devsecopsmaturitymodel/metricca/blob/master/deployment/kustomizations/base/grafana/pvc.yaml"
    click PVCOverlay "https://github.com/devsecopsmaturitymodel/metricca/tree/master/deployment/kustomizations/overlay/pvc"

    %% Styles
    classDef service fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef config fill:#F4A460,stroke:#333,stroke-width:2px;
    classDef external fill:#FFDEAD,stroke:#333,stroke-width:2px;
    classDef configManagement fill:#D3D3D3,stroke:#333,stroke-width:2px;
    classDef pvc fill:#98FB98,stroke:#333,stroke-width:2px,shape: cylinder;
```
