From d18ff993e67627e8c855c6862670c2aba4057277 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Fri, 28 Jul 2023 21:36:16 -0700 Subject: [PATCH] lib/promscrape: add a comment why `honor_timestamps` is set to false by default This should prevent from returning it back to true in the future Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4697 --- docs/CHANGELOG.md | 2 +- lib/promscrape/config.go | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 157ed265f..f284ace23 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -28,7 +28,7 @@ The following `tip` changes can be tested by building VictoriaMetrics components Released at 2023-07-28 -* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): use local scrape timestamps for the scraped metrics unless `honor_timestamps: true` option is explicitly set at [scrape_config](https://docs.victoriametrics.com/sd_configs.html#scrape_configs). This fixes gaps for metrics collected from [cadvisor](https://github.com/google/cadvisor) or similar exporters, which export metrics with invalid timestamps. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4697) and [this comment](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4697#issuecomment-1654614799) for details. +* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): use local scrape timestamps for the scraped metrics unless `honor_timestamps: true` option is explicitly set at [scrape_config](https://docs.victoriametrics.com/sd_configs.html#scrape_configs). This fixes gaps for metrics collected from [cadvisor](https://github.com/google/cadvisor) or similar exporters, which export metrics with invalid timestamps. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4697) and [this comment](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4697#issuecomment-1654614799) for details. The issue has been introduced in [v1.68.0](#v1680). * BUGFIX: [vmalert](https://docs.victoriametrics.com/vmalert.html): revert unit test feature for alerting and recording rules introduced in [this pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4596). See the following [change](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4734). ## [v1.92.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.92.0) diff --git a/lib/promscrape/config.go b/lib/promscrape/config.go index 0c26bdb0a..5cf006c00 100644 --- a/lib/promscrape/config.go +++ b/lib/promscrape/config.go @@ -239,12 +239,17 @@ type GlobalConfig struct { // // See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config type ScrapeConfig struct { - JobName string `yaml:"job_name"` - ScrapeInterval *promutils.Duration `yaml:"scrape_interval,omitempty"` - ScrapeTimeout *promutils.Duration `yaml:"scrape_timeout,omitempty"` - MetricsPath string `yaml:"metrics_path,omitempty"` - HonorLabels bool `yaml:"honor_labels,omitempty"` - HonorTimestamps bool `yaml:"honor_timestamps,omitempty"` + JobName string `yaml:"job_name"` + ScrapeInterval *promutils.Duration `yaml:"scrape_interval,omitempty"` + ScrapeTimeout *promutils.Duration `yaml:"scrape_timeout,omitempty"` + MetricsPath string `yaml:"metrics_path,omitempty"` + HonorLabels bool `yaml:"honor_labels,omitempty"` + + // HonorTimestamps is set to false by default contrary to Prometheus, which sets it to true by default, + // because of the issue with gaps on graphs when scraping cadvisor or similar targets, which export invalid timestamps. + // See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4697#issuecomment-1654614799 for details. + HonorTimestamps bool `yaml:"honor_timestamps,omitempty"` + Scheme string `yaml:"scheme,omitempty"` Params map[string][]string `yaml:"params,omitempty"` HTTPClientConfig promauth.HTTPClientConfig `yaml:",inline"`