From baa1c24b368ccecf1ad243e571fe4ae5a2d15b5f Mon Sep 17 00:00:00 2001 From: Nikolay Date: Sat, 16 Apr 2022 13:22:11 +0300 Subject: [PATCH] lib/promscrape: removes omitempty for ScrapeConfig (#2457) This change fixes incorrect marshalling for ScrapeConfig it affects http endpoint and ScrapeConfig checksum. With omitempty, custom Marshaller is not called if field is not a pointer. Previously this issue happened at vmalert --- lib/promscrape/config.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/promscrape/config.go b/lib/promscrape/config.go index 15e2feef6..bca411b2f 100644 --- a/lib/promscrape/config.go +++ b/lib/promscrape/config.go @@ -134,8 +134,8 @@ 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"` + ScrapeInterval promutils.Duration `yaml:"scrape_interval"` + ScrapeTimeout promutils.Duration `yaml:"scrape_timeout"` MetricsPath string `yaml:"metrics_path,omitempty"` HonorLabels bool `yaml:"honor_labels,omitempty"` HonorTimestamps *bool `yaml:"honor_timestamps,omitempty"` @@ -168,8 +168,8 @@ type ScrapeConfig struct { DisableCompression bool `yaml:"disable_compression,omitempty"` DisableKeepAlive bool `yaml:"disable_keepalive,omitempty"` StreamParse bool `yaml:"stream_parse,omitempty"` - ScrapeAlignInterval promutils.Duration `yaml:"scrape_align_interval,omitempty"` - ScrapeOffset promutils.Duration `yaml:"scrape_offset,omitempty"` + ScrapeAlignInterval promutils.Duration `yaml:"scrape_align_interval"` + ScrapeOffset promutils.Duration `yaml:"scrape_offset"` SeriesLimit int `yaml:"series_limit,omitempty"` ProxyClientConfig promauth.ProxyClientConfig `yaml:",inline"`