This document provides a high-level overview of the metrics-processor crate modules, their responsibilities, and relationships.
| Module | Primary Responsibility | Key Types | Dependencies | Used By |
|---|---|---|---|---|
lib |
Crate entry point | - | api, common, config, graphite, sd, types |
External consumers |
api |
HTTP API routing | - | api::v1 |
main binary |
api::v1 |
V1 REST endpoints | HealthQuery, ServiceHealthResponse |
common, types |
api |
config |
Configuration parsing | Config, Datasource, ServerConf |
types |
types, main |
types |
Core data structures | AppState, FlagMetric, ServiceHealthDef |
config |
All modules |
graphite |
Graphite TSDB interface | GraphiteData, Metric, RenderRequest |
common, types |
common, api::v1 |
common |
Shared utilities | - | types, graphite |
api::v1, graphite |
sd |
Status Dashboard API | IncidentData, ComponentCache, StatusDashboardComponent |
anyhow, hmac, jwt |
reporter binary |
┌─────────────────────────────────────────────────────────────┐
│ convertor binary │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ config │
│ (Config, Datasource, ServerConf) │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ types │
│ (AppState, FlagMetric, ServiceHealthDef, CloudMonError) │
└─────────────────────────────────────────────────────────────┘
│
┌───────────────────┼───────────────────┐
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ api::v1 │ │ graphite │ │ common │
│ (REST API v1) │ │ (TSDB Client) │ │ (Utilities) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
└───────────────────┴───────────────────┘
│
▼
┌─────────────────┐
│ HTTP Server │
│ (Axum) │
└─────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ reporter binary │
└─────────────────────────────────────────────────────────────┘
│
┌───────────────────┼───────────────────┐
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ config │ │ sd │ │ api::v1 │
│ (Config load) │ │ (Status Dash) │ │ (Query health) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ Status Dashboard│
│ V2 API │
└─────────────────┘
Entry point for the crate, re-exports all public modules:
api- HTTP API handlerscommon- Shared utilitiesconfig- Configuration managementgraphite- Graphite TSDB communicationtypes- Core type definitions
Axum-based HTTP handlers for the REST API. Provides health metrics endpoints.
YAML configuration loading with environment variable merging. Supports conf.d style modular configuration.
Core domain types including metric definitions, application state, and error types.
Graphite TSDB client implementing the render and metrics/find APIs for Grafana compatibility.
Shared business logic for metric flag evaluation and service health calculation.
- Startup:
config::Config::new()loads YAML + env vars - Initialization:
types::AppState::new()builds runtime state with processed metrics - Request Handling: Axum routes to
api::v1orgraphitehandlers - Data Retrieval: Handlers call
commonutilities which querygraphitemodule - Response: Results transformed and returned as JSON