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/json.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/json.go')
| -rw-r--r-- | f3s/prometheus-pusher/internal/parser/json.go | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/f3s/prometheus-pusher/internal/parser/json.go b/f3s/prometheus-pusher/internal/parser/json.go deleted file mode 100644 index b6b230c..0000000 --- a/f3s/prometheus-pusher/internal/parser/json.go +++ /dev/null @@ -1,62 +0,0 @@ -package parser - -import ( - "context" - "encoding/json" - "fmt" - "io" - "time" - - "prometheus-pusher/internal/metrics" -) - -// JSONParser parses metrics from JSON format -type JSONParser struct{} - -// NewJSONParser creates a new JSON parser -func NewJSONParser() *JSONParser { - return &JSONParser{} -} - -type jsonSample struct { - Metric string `json:"metric"` - Labels map[string]string `json:"labels"` - Value float64 `json:"value"` - TimestampMs int64 `json:"timestamp_ms,omitempty"` -} - -// Parse reads metrics from JSON format -func (p *JSONParser) Parse(ctx context.Context, reader io.Reader) ([]metrics.Sample, error) { - var rawSamples []jsonSample - - decoder := json.NewDecoder(reader) - if err := decoder.Decode(&rawSamples); err != nil { - return nil, fmt.Errorf("failed to parse JSON: %w", err) - } - - samples := make([]metrics.Sample, 0, len(rawSamples)) - for _, raw := range rawSamples { - select { - case <-ctx.Done(): - return nil, ctx.Err() - default: - } - - if raw.Metric == "" { - continue - } - - timestamp := time.Now() - if raw.TimestampMs > 0 { - timestamp = time.UnixMilli(raw.TimestampMs) - } - - if raw.Labels == nil { - raw.Labels = make(map[string]string) - } - - samples = append(samples, metrics.NewSample(raw.Metric, raw.Labels, raw.Value, timestamp)) - } - - return samples, nil -} |
