summaryrefslogtreecommitdiff
path: root/f3s/prometheus-pusher/internal/parser
AgeCommit message (Collapse)Author
2025-12-31Enable Prometheus historic data ingestion with out-of-order supportPaul Buetow
This commit configures Prometheus to accept historic data via the Remote Write API, enabling backfilling of test metrics for development and troubleshooting purposes. Changes: - Enable Remote Write receiver (--web.enable-remote-write-receiver) - Enable out-of-order ingestion with 30-day window (720h) - Enable exemplar-storage and otlp-write-receiver features - Add Epimetheus dashboard ConfigMap for Grafana provisioning - Remove old prometheus-pusher directory (moved to separate repo) - Document configuration, use cases, and performance considerations Configuration allows backfilling data up to 30 days in the past, supporting tools like Epimetheus for generating synthetic historic metrics. Performance note: This is optimized for ad-hoc troubleshooting, not production use. Out-of-order ingestion increases memory usage, TSDB overhead, and may impact query performance. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-30Add comprehensive unit tests with 63.9% coveragePaul Buetow
Implemented unit tests across all internal packages to achieve 63.9% test coverage, exceeding the 60% target. Test coverage by package: - internal/config: 100.0% (config validation, constants) - internal/metrics: 100.0% (Sample methods, Collectors, Simulate) - internal/parser: 92.3% (CSV/JSON parsing, format detection) - internal/ingester: 44.9% (auto routing, time series conversion) New test files: - internal/config/config_test.go: Config creation and constants - internal/metrics/sample_test.go: Sample type methods (Age, IsRecent) - internal/metrics/generator_test.go: Collectors and simulation - internal/parser/csv_test.go: CSV parsing with various inputs - internal/parser/json_test.go: JSON parsing and validation - internal/parser/parser_test.go: Parser factory and format handling - internal/ingester/auto_test.go: Auto mode routing logic - internal/ingester/remotewrite_test.go: Time series conversion - internal/ingester/pushgateway_test.go: Pushgateway ingester Tests cover: - Happy path and error cases - Context cancellation support - Edge cases (empty input, invalid formats) - Label parsing and timestamp handling - Metric type generation (counter, gauge, histogram) - Table-driven tests for comprehensive coverage All 50+ tests passing ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-30Refactor prometheus-pusher following Go best practicesPaul Buetow
Major refactoring to improve code organization and follow Go conventions: - Moved main entry point to cmd/prometheus-pusher/main.go - Organized code into internal packages (config, metrics, parser, ingester, version) - Implemented proper dependency injection (no package-level variables) - Added context.Context to all blocking operations - Used value semantics where feasible (Sample, Config, Ingesters) - Proper error wrapping with %w throughout - All functions under 50 lines, focused and single-purpose - Consistent ordering: constants, types, constructors, public, private - Added -version flag to display version from internal/version package Package structure: - cmd/prometheus-pusher: Main entry point with flag parsing and mode routing - internal/config: Configuration types and constants - internal/version: Version constant (0.0.0) - internal/metrics: Sample type and Collectors for metric generation - internal/parser: CSV/JSON parsers with context support - internal/ingester: Pushgateway, RemoteWrite, and Auto ingesters All modes tested and working: realtime, historic, backfill, auto 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>