From 88a14361f2645b47238d41dde221ef5617870533 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 1 May 2026 18:27:45 +0000 Subject: [PATCH] feat(monitoring): parametrize data retention for plan-based config Expose VM_RETENTION_PERIOD and QUERYID_RETENTION_HOURS through docker-compose so retention can be tuned per plan (Starter 7d, Scale 6mo). Defaults preserve previous hardcoded values. Helm chart already exposes both knobs via values.yaml. --- .env.example | 15 +++++++++++++++ docker-compose.yml | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 8440eb3..5c5557c 100644 --- a/.env.example +++ b/.env.example @@ -21,3 +21,18 @@ PGAI_TAG=0.14.0 REPLICATOR_PASSWORD= VM_AUTH_USERNAME=vmauth VM_AUTH_PASSWORD= + +# VictoriaMetrics retention period — set per plan. +# Accepts VictoriaMetrics duration formats (e.g. 168h, 30d, 6, 12). +# Suggested values: +# Starter (7-day history): 168h +# Scale (6-month history): 6 +# Default below preserves the previous hardcoded value. +# VM_RETENTION_PERIOD=336h + +# Postgres queryid mapping retention (hours) — set per plan. +# Suggested values: +# Starter (7-day history): 168 +# Scale (6-month history): 4380 +# Default below preserves the previous in-code default. +# QUERYID_RETENTION_HOURS=720 diff --git a/docker-compose.yml b/docker-compose.yml index 2415876..78823ed 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -152,7 +152,7 @@ services: if [ -n "$$VM_AUTH_USERNAME" ] && [ -n "$$VM_AUTH_PASSWORD" ]; then AUTH_ARGS="-httpAuth.username=$$VM_AUTH_USERNAME -httpAuth.password=$$VM_AUTH_PASSWORD" fi - exec /victoria-metrics-prod -storageDataPath=/victoria-metrics-data -retentionPeriod=336h -httpListenAddr=:9090 -promscrape.config=/postgres_ai_configs/prometheus/prometheus.yml -promscrape.config.strictParse=false -promscrape.maxScrapeSize=128000000 -search.maxQueryDuration=30s -search.maxConcurrentRequests=16 $$AUTH_ARGS + exec /victoria-metrics-prod -storageDataPath=/victoria-metrics-data -retentionPeriod=${VM_RETENTION_PERIOD:-336h} -httpListenAddr=:9090 -promscrape.config=/postgres_ai_configs/prometheus/prometheus.yml -promscrape.config.strictParse=false -promscrape.maxScrapeSize=128000000 -search.maxQueryDuration=30s -search.maxConcurrentRequests=16 $$AUTH_ARGS depends_on: config-init: condition: service_completed_successfully @@ -260,6 +260,7 @@ services: - POSTGRES_SINK_URL=postgresql://pgwatch@sink-postgres:5432/measurements - VM_AUTH_USERNAME=${VM_AUTH_USERNAME:-} - VM_AUTH_PASSWORD=${VM_AUTH_PASSWORD:-} + - QUERYID_RETENTION_HOURS=${QUERYID_RETENTION_HOURS:-720} # Optional overrides: # - ENABLE_AMP=true (enable Amazon Managed Prometheus support) # - AWS_REGION=us-east-1 (AWS region for Amazon Managed Prometheus)