diff options
| author | Paul Buetow <paul@buetow.org> | 2025-12-31 10:34:45 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-12-31 10:34:45 +0200 |
| commit | 966d9dc8919cd6985d733809b7d94f0215491082 (patch) | |
| tree | 20af4b2a6a9034cd63fc63ab5899a1b0d7df5dbb /f3s/prometheus-pusher/internal/parser/parser_test.go | |
| parent | 448474ece746bfbd484fe80fa2c2742fc5d45c99 (diff) | |
Enable Prometheus historic data ingestion with out-of-order support
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>
Diffstat (limited to 'f3s/prometheus-pusher/internal/parser/parser_test.go')
| -rw-r--r-- | f3s/prometheus-pusher/internal/parser/parser_test.go | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/f3s/prometheus-pusher/internal/parser/parser_test.go b/f3s/prometheus-pusher/internal/parser/parser_test.go deleted file mode 100644 index 05255a5..0000000 --- a/f3s/prometheus-pusher/internal/parser/parser_test.go +++ /dev/null @@ -1,99 +0,0 @@ -package parser - -import ( - "context" - "strings" - "testing" -) - -func TestParseFile_CSV(t *testing.T) { - // We can't easily test file operations without creating temp files - // So we'll test the error case - ctx := context.Background() - _, err := ParseFile(ctx, "/nonexistent/file.csv", "csv") - - if err == nil { - t.Error("Expected error for nonexistent file") - } -} - -func TestParseWithFormat_CSV(t *testing.T) { - ctx := context.Background() - input := `test_metric,env=prod,100,1234567890000` - reader := strings.NewReader(input) - - samples, err := parseWithFormat(ctx, reader, "csv") - if err != nil { - t.Fatalf("parseWithFormat(csv) error = %v", err) - } - if len(samples) != 1 { - t.Errorf("Expected 1 sample, got %d", len(samples)) - } -} - -func TestParseWithFormat_JSON(t *testing.T) { - ctx := context.Background() - input := `[{"metric": "test_metric", "value": 100, "timestamp_ms": 1234567890000}]` - reader := strings.NewReader(input) - - samples, err := parseWithFormat(ctx, reader, "json") - if err != nil { - t.Fatalf("parseWithFormat(json) error = %v", err) - } - if len(samples) != 1 { - t.Errorf("Expected 1 sample, got %d", len(samples)) - } -} - -func TestParseWithFormat_UnsupportedFormat(t *testing.T) { - ctx := context.Background() - reader := strings.NewReader("") - - _, err := parseWithFormat(ctx, reader, "xml") - if err == nil { - t.Error("Expected error for unsupported format") - } - if err.Error() != "unsupported format: xml (use csv or json)" { - t.Errorf("Unexpected error message: %v", err) - } -} - -func TestParseWithFormat_EmptyResult(t *testing.T) { - ctx := context.Background() - input := `[]` // Empty JSON array - reader := strings.NewReader(input) - - _, err := parseWithFormat(ctx, reader, "json") - if err == nil { - t.Error("Expected error for empty samples") - } - if err.Error() != "no valid samples found" { - t.Errorf("Expected 'no valid samples found' error, got: %v", err) - } -} - -func TestParseStdin_Format(t *testing.T) { - // We can't easily test stdin without mocking, - // but we can verify the error path - ctx := context.Background() - - // Test with invalid format - _, err := parseWithFormat(ctx, strings.NewReader(""), "invalid_format") - if err == nil { - t.Error("Expected error for invalid format") - } -} - -func TestNewCSVParser(t *testing.T) { - parser := NewCSVParser() - if parser == nil { - t.Error("NewCSVParser() returned nil") - } -} - -func TestNewJSONParser(t *testing.T) { - parser := NewJSONParser() - if parser == nil { - t.Error("NewJSONParser() returned nil") - } -} |
