# k-yo/splunk_exporter architecture

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

- Interactive diagram: https://gitdiagram.com/k-yo/splunk_exporter
- Repository: https://github.com/k-yo/splunk_exporter

## Overview

##### Main Components Identification

a) Core Components:
- Splunk Instance (External System)
- Splunk Exporter (Main Application)
- Prometheus (Target System)
- Grafana (Visualization Layer)

##### Component Relationships

**Splunk Instance -> Splunk Exporter:**
- Index data
- Health status
- Metrics data

**Splunk Exporter -> Prometheus:**
- Exported metrics
- Health metrics
- Index metrics

**Prometheus -> Grafana:**
- Visualization data

##### Detailed Component Breakdown

For the Splunk Exporter core, show these elements:

**Config Manager:**
- YAML configuration handling
- Authentication settings

**Metrics Manager:**
- Index metrics
- Metric indexes
- Saved searches (planned)

**Health Manager:**
- Splunkd health
- Deployment health

**Splunk API Client:**
- API communication
- Query handling
- Response parsing

##### Additional Elements

Supporting elements:
- Configuration file input
- Metrics endpoints (/metrics)
- Health check endpoints

##### Technical Details

Specifications:
- Go-based implementation
- Docker deployment support
- Prometheus metric format
- Grafana dashboard integration

Remember to:
- Clear separation of concerns
- Monitoring and metrics flow
- Supported metric types from the README
- Both current and planned features (from roadmap)

- Nested components
- Export to common formats (PNG, SVG)
- Easy updates for future modifications

This design will provide a clear understanding of how the Splunk Exporter interacts with various systems while maintaining its internal organization and data flow patterns.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph External["External Systems"]
        Splunk[("Splunk Instance")]
        Prom[("Prometheus")]
        Graf["Grafana Dashboard"]:::visualization
    end

    subgraph SplunkExporter["Splunk Exporter Core"]
        direction TB
        Main["Main Application"]:::core
        Config["Config Manager"]:::config
        MetricsM["Metrics Manager"]:::component
        HealthM["Health Manager"]:::component
        
        subgraph SplunkAPI["Splunk API Client"]
            direction TB
            APIImpl["API Implementation"]:::api
            QueryHandler["Query Handler"]:::api
            CoreClient["Core Client"]:::api
        end
    end

    subgraph Deploy["Deployment Layer"]
        Docker["Docker Container"]:::deploy
        PromConfig["Prometheus Config"]:::config
        GrafConfig["Grafana Config"]:::config
    end

    %% Relationships
    Splunk -->|"Metrics & Health Data"| SplunkAPI
    SplunkAPI -->|"Processed Data"| MetricsM
    SplunkAPI -->|"Health Status"| HealthM
    Config -->|"Settings"| Main
    Main -->|"Initialize"| MetricsM
    Main -->|"Initialize"| HealthM
    MetricsM -->|"Export Metrics"| Prom
    HealthM -->|"Health Metrics"| Prom
    Prom -->|"Visualization Data"| Graf

    %% Click Events
    click Config "https://github.com/K-Yo/splunk_exporter/blob/main/config/config.go"
    click MetricsM "https://github.com/K-Yo/splunk_exporter/blob/main/exporter/metrics_manager.go"
    click HealthM "https://github.com/K-Yo/splunk_exporter/blob/main/exporter/health_manager.go"
    click SplunkAPI "https://github.com/K-Yo/splunk_exporter/tree/main/splunk/"
    click APIImpl "https://github.com/K-Yo/splunk_exporter/blob/main/splunk/api.go"
    click QueryHandler "https://github.com/K-Yo/splunk_exporter/blob/main/splunk/queries.go"
    click CoreClient "https://github.com/K-Yo/splunk_exporter/blob/main/splunk/splunk.go"
    click Main "https://github.com/K-Yo/splunk_exporter/blob/main/main.go"
    click Docker "https://github.com/K-Yo/splunk_exporter/tree/main/Dockerfile"
    click GrafConfig "https://github.com/K-Yo/splunk_exporter/tree/main/deploy/grafana/"
    click PromConfig "https://github.com/K-Yo/splunk_exporter/blob/main/deploy/prometheus.yml"

    %% Styles
    classDef core fill:#90EE90,stroke:#333,stroke-width:2px
    classDef component fill:#FFE5CC,stroke:#333,stroke-width:1px
    classDef config fill:#FFB366,stroke:#333,stroke-width:1px
    classDef api fill:#E6E6FA,stroke:#333,stroke-width:1px
    classDef visualization fill:#87CEEB,stroke:#333,stroke-width:1px
    classDef deploy fill:#F0F8FF,stroke:#333,stroke-width:1px

    %% Legend
    subgraph Legend
        L1["Core Application"]:::core
        L2["Component"]:::component
        L3["Configuration"]:::config
        L4["API Layer"]:::api
        L5["Visualization"]:::visualization
        L6["Deployment"]:::deploy
    end
```
