# coroot/coroot-aws-agent architecture

> Architecture diagram of the GitHub repository coroot/coroot-aws-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/coroot/coroot-aws-agent
- Repository: https://github.com/coroot/coroot-aws-agent

## Overview

##### Component Interactions

- Discovery flows from AWS Services to respective Discovery components
- Metric collection flows from AWS Services to respective Collectors
- Enhanced monitoring flows for RDS
- Log collection flows for RDS
- Metric export flow to Prometheus

##### Detailed Component Breakdown

For each major component, create a sub-section showing:

RDS Package:
**collector.go ─→ Enhanced Monitoring**
- → Log Collection
**discovery.go ─→ Auto-discovery**
**enhanced.go ─→ Enhanced metrics processing**
**logs.go ─→ Log processing**

ElastiCache Package:
**collector.go ─→ Metrics Collection**
**discovery.go ─→ Auto-discovery**

##### Additional Elements

Supporting elements:
- Configuration flow from flags package
- Utility functions from utils package
- Docker container boundary (since Dockerfile is present)
- GitHub Actions workflow for CI/CD (indicated by docker-publish.yml)

##### Technical Details

Annotations showing:
- Supported AWS services (RDS PostgreSQL/MySQL, ElastiCache Redis/Memcached)
- Metric types collected (OS metrics, database metrics, log-based metrics)
- Auto-discovery capabilities
- Enhanced Monitoring integration

##### Design Principles to Highlight

Emphasize:
- Modular architecture (separate packages for different services)
- Service discovery mechanism
- Metric collection abstraction
- Prometheus export capability

Remember to indicate that this is a containerized application that can be deployed anywhere with AWS access, and show the configuration options available through the flags package.

This design should effectively communicate both the overall system architecture and the specific components that make this AWS metrics exporter function.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style definitions
    classDef aws fill:#FF9900,stroke:#232F3E,color:white
    classDef collector fill:#3B82F6,stroke:#1D4ED8,color:white
    classDef discovery fill:#60A5FA,stroke:#2563EB,color:white
    classDef monitoring fill:#93C5FD,stroke:#3B82F6,color:white
    classDef prometheus fill:#E02F2F,stroke:#C41E3A,color:white
    classDef config fill:#10B981,stroke:#059669,color:white
    classDef container fill:#6B7280,stroke:#4B5563,color:white

    subgraph Schedule["Schedule Organization"]
        subgraph Discovery["Discovery Phase"]
            RDSDiscovery["RDS Discovery"]:::discovery
            ECDiscovery["ElastiCache Discovery"]:::discovery
        end

        subgraph Collection["Collection Phase"]
            RDSCollector["RDS Collection"]:::collector
            ECCollector["ElastiCache Collection"]:::collector
            EnhancedMon["Enhanced Monitoring"]:::monitoring
            LogsComp["Logs Collection"]:::monitoring
        end

        subgraph Export["Export Phase"]
            MetricsEndpoint["Metrics Export"]:::prometheus
        end

        subgraph Config["Configuration"]
            ConfigMgmt["Configuration Management"]:::config
            Utils["Utility Functions"]:::config
        end
    end

    %% Phase connections
    RDSDiscovery --> RDSCollector
    ECDiscovery --> ECCollector
    
    RDSCollector --> MetricsEndpoint
    ECCollector --> MetricsEndpoint
    EnhancedMon --> MetricsEndpoint
    LogsComp --> MetricsEndpoint
    
    ConfigMgmt --> Discovery
    ConfigMgmt --> Collection
    Utils --> Collection

    %% Click events
    click RDSCollector "https://github.com/coroot/coroot-aws-agent/blob/main/rds/collector.go"
    click RDSDiscovery "https://github.com/coroot/coroot-aws-agent/blob/main/rds/discovery.go"
    click EnhancedMon "https://github.com/coroot/coroot-aws-agent/blob/main/rds/enhanced.go"
    click LogsComp "https://github.com/coroot/coroot-aws-agent/blob/main/rds/logs.go"
    click ECCollector "https://github.com/coroot/coroot-aws-agent/blob/main/elasticache/collector.go"
    click ECDiscovery "https://github.com/coroot/coroot-aws-agent/blob/main/elasticache/discovery.go"
    click ConfigMgmt "https://github.com/coroot/coroot-aws-agent/blob/main/flags/flags.go"
    click Utils "https://github.com/coroot/coroot-aws-agent/blob/main/utils/utils.go"
```
