$ show prometheus/cloudwatch_exporter
The CloudWatch Exporter is a Java-based Prometheus exporter that collects metrics from AWS CloudWatch and exposes them in Prometheus format. It runs as a standalone web server with an embedded Jetty server, periodically polling AWS CloudWatch APIs based on YAML configuration. The architecture features clear separation of concerns with distinct components for configuration management, AWS API interaction, dimension caching, and metric collection. Key entry points include the WebServer main method which takes port and config file arguments, and the CloudWatchCollector which handles the core metrics collection logic. The exporter supports both GetMetricStatistics and GetMetricData APIs, includes special handling for services like DynamoDB, and provides configuration reload via SIGHUP or HTTP endpoint. External dependencies include AWS SDK, Prometheus Java client, Jetty, Caffeine for caching, and Snakeyaml for YAML parsing.
The LLM identified 1 files worth highlighting for reuse:
A generic caching decorator for DimensionSource that implements configurable TTL with per-key overrides using Caffeine cache. Demonstrates strong separation of concerns by wrapping any DimensionSource implementation to add caching without modifying the original code. The component shows advanced cache management through custom Expiry implementation that supports both global and per-metric TTL configurations, making it reusable in any context requiring cached access to external resources with flexible expiration policies.