From 22f93e2cae21e5a2a7c1209f7c3e396a8bc7b26c Mon Sep 17 00:00:00 2001 From: Andreas Gkizas Date: Fri, 22 Mar 2024 15:13:54 +0200 Subject: [PATCH 01/15] Correcting period for Prometheus remote_write --- x-pack/metricbeat/module/prometheus/remote_write/config.go | 7 ++++++- x-pack/metricbeat/module/prometheus/remote_write/data.go | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/x-pack/metricbeat/module/prometheus/remote_write/config.go b/x-pack/metricbeat/module/prometheus/remote_write/config.go index 8c5fe12a659..e673bcfa5bb 100644 --- a/x-pack/metricbeat/module/prometheus/remote_write/config.go +++ b/x-pack/metricbeat/module/prometheus/remote_write/config.go @@ -4,12 +4,16 @@ package remote_write -import "errors" +import ( + "errors" + "time" +) type config struct { UseTypes bool `config:"use_types"` RateCounters bool `config:"rate_counters"` TypesPatterns TypesPatterns `config:"types_patterns" yaml:"types_patterns,omitempty"` + Period time.Duration `config:"period" validate:"positive"` } type TypesPatterns struct { @@ -21,6 +25,7 @@ var defaultConfig = config{ TypesPatterns: TypesPatterns{ CounterPatterns: nil, HistogramPatterns: nil}, + Period: time.Minute * 1, } func (c *config) Validate() error { diff --git a/x-pack/metricbeat/module/prometheus/remote_write/data.go b/x-pack/metricbeat/module/prometheus/remote_write/data.go index a1bdbd58c20..237e4d1d153 100644 --- a/x-pack/metricbeat/module/prometheus/remote_write/data.go +++ b/x-pack/metricbeat/module/prometheus/remote_write/data.go @@ -46,7 +46,12 @@ func remoteWriteEventsGeneratorFactory(base mb.BaseMetricSet) (remote_write.Remo if config.UseTypes { // use a counter cache with a timeout of 5x the period, as a safe value // to make sure that all counters are available between fetches - counters := collector.NewCounterCache(base.Module().Config().Period * 5) + duration := base.Module().Config().Period + if time.Duration(base.Module().Config().Period.Seconds()) < 60*time.Second { + duration = 60 * time.Second + } + + counters := collector.NewCounterCache(duration * 5) g := remoteWriteTypedGenerator{ counterCache: counters, From 102f805ed41ce7c60c6b53000aade24446e01509 Mon Sep 17 00:00:00 2001 From: Andreas Gkizas Date: Fri, 22 Mar 2024 15:25:17 +0200 Subject: [PATCH 02/15] Correcting period for Prometheus remote_write --- x-pack/metricbeat/module/prometheus/remote_write/config.go | 1 - x-pack/metricbeat/module/prometheus/remote_write/data.go | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/x-pack/metricbeat/module/prometheus/remote_write/config.go b/x-pack/metricbeat/module/prometheus/remote_write/config.go index e673bcfa5bb..83bc00dc41e 100644 --- a/x-pack/metricbeat/module/prometheus/remote_write/config.go +++ b/x-pack/metricbeat/module/prometheus/remote_write/config.go @@ -25,7 +25,6 @@ var defaultConfig = config{ TypesPatterns: TypesPatterns{ CounterPatterns: nil, HistogramPatterns: nil}, - Period: time.Minute * 1, } func (c *config) Validate() error { diff --git a/x-pack/metricbeat/module/prometheus/remote_write/data.go b/x-pack/metricbeat/module/prometheus/remote_write/data.go index 237e4d1d153..c0f8bb86a5f 100644 --- a/x-pack/metricbeat/module/prometheus/remote_write/data.go +++ b/x-pack/metricbeat/module/prometheus/remote_write/data.go @@ -44,13 +44,16 @@ func remoteWriteEventsGeneratorFactory(base mb.BaseMetricSet) (remote_write.Remo } if config.UseTypes { - // use a counter cache with a timeout of 5x the period, as a safe value - // to make sure that all counters are available between fetches + + // /metricbeat/module/mb/mb.go defines default as Period: time.Second * 10, + // We are setting Period at least 60secs because of issue https://github.com/elastic/beats/issues/38458 duration := base.Module().Config().Period if time.Duration(base.Module().Config().Period.Seconds()) < 60*time.Second { duration = 60 * time.Second } + // use a counter cache with a timeout of 5x the period, as a safe value + // to make sure that all counters are available between fetches counters := collector.NewCounterCache(duration * 5) g := remoteWriteTypedGenerator{ From d905adf352d2e6bd4bd6bb814e840bc8f47cc91e Mon Sep 17 00:00:00 2001 From: Andreas Gkizas Date: Fri, 22 Mar 2024 15:35:06 +0200 Subject: [PATCH 03/15] Adding changelog --- CHANGELOG.next.asciidoc | 2 +- x-pack/metricbeat/module/prometheus/remote_write/config.go | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 15ed3e8b2cb..f5b69130f81 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -33,7 +33,7 @@ fields added to events containing the Beats version. {pull}37553[37553] *Heartbeat* *Metricbeat* - +- Setting period of counetr cache for Prometheus remote_write at least to 60sec {pull}38553[38553] *Osquerybeat* diff --git a/x-pack/metricbeat/module/prometheus/remote_write/config.go b/x-pack/metricbeat/module/prometheus/remote_write/config.go index 83bc00dc41e..c1028fa1dd3 100644 --- a/x-pack/metricbeat/module/prometheus/remote_write/config.go +++ b/x-pack/metricbeat/module/prometheus/remote_write/config.go @@ -6,14 +6,12 @@ package remote_write import ( "errors" - "time" ) type config struct { UseTypes bool `config:"use_types"` RateCounters bool `config:"rate_counters"` TypesPatterns TypesPatterns `config:"types_patterns" yaml:"types_patterns,omitempty"` - Period time.Duration `config:"period" validate:"positive"` } type TypesPatterns struct { From f0ec4f77889c75447859f4137db857cca576baf9 Mon Sep 17 00:00:00 2001 From: Andreas Gkizas Date: Fri, 22 Mar 2024 15:39:03 +0200 Subject: [PATCH 04/15] Updating metricbeat.reference.yaml file --- x-pack/metricbeat/metricbeat.reference.yml | 3 +++ x-pack/metricbeat/module/prometheus/remote_write/config.go | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/x-pack/metricbeat/metricbeat.reference.yml b/x-pack/metricbeat/metricbeat.reference.yml index f71e58904fd..71b23191d65 100644 --- a/x-pack/metricbeat/metricbeat.reference.yml +++ b/x-pack/metricbeat/metricbeat.reference.yml @@ -1334,6 +1334,9 @@ metricbeat.modules: # Store counter rates instead of original cumulative counters (experimental, default: false) #rate_counters: true + # Set period of counter cache timeout. This cache is used to calculate the rates of counters between fetches (experimental, default: 60sec) + #period: 1m + # Define patterns for counter and histogram types so as to identify metrics' types according to these patterns #types_patterns: # counter_patterns: [] diff --git a/x-pack/metricbeat/module/prometheus/remote_write/config.go b/x-pack/metricbeat/module/prometheus/remote_write/config.go index c1028fa1dd3..8c5fe12a659 100644 --- a/x-pack/metricbeat/module/prometheus/remote_write/config.go +++ b/x-pack/metricbeat/module/prometheus/remote_write/config.go @@ -4,9 +4,7 @@ package remote_write -import ( - "errors" -) +import "errors" type config struct { UseTypes bool `config:"use_types"` From 0517a07db636123513359efd877cda3c0251c98b Mon Sep 17 00:00:00 2001 From: Andrew Gizas Date: Wed, 27 Mar 2024 10:56:29 +0200 Subject: [PATCH 05/15] Update x-pack/metricbeat/metricbeat.reference.yml Co-authored-by: Tetiana Kravchenko --- x-pack/metricbeat/metricbeat.reference.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/metricbeat/metricbeat.reference.yml b/x-pack/metricbeat/metricbeat.reference.yml index 71b23191d65..ddf87ff6fe2 100644 --- a/x-pack/metricbeat/metricbeat.reference.yml +++ b/x-pack/metricbeat/metricbeat.reference.yml @@ -1334,7 +1334,7 @@ metricbeat.modules: # Store counter rates instead of original cumulative counters (experimental, default: false) #rate_counters: true - # Set period of counter cache timeout. This cache is used to calculate the rates of counters between fetches (experimental, default: 60sec) + # Set timeout period for the counter cache. This cache is used to calculate the rates of counters between fetches (experimental, default: 60sec) #period: 1m # Define patterns for counter and histogram types so as to identify metrics' types according to these patterns From cd5056b209d501611d60a907777483e49da9b572 Mon Sep 17 00:00:00 2001 From: Andrew Gizas Date: Wed, 27 Mar 2024 10:56:36 +0200 Subject: [PATCH 06/15] Update x-pack/metricbeat/module/prometheus/remote_write/data.go Co-authored-by: Tetiana Kravchenko --- x-pack/metricbeat/module/prometheus/remote_write/data.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/metricbeat/module/prometheus/remote_write/data.go b/x-pack/metricbeat/module/prometheus/remote_write/data.go index c0f8bb86a5f..537c61f0842 100644 --- a/x-pack/metricbeat/module/prometheus/remote_write/data.go +++ b/x-pack/metricbeat/module/prometheus/remote_write/data.go @@ -48,7 +48,7 @@ func remoteWriteEventsGeneratorFactory(base mb.BaseMetricSet) (remote_write.Remo // /metricbeat/module/mb/mb.go defines default as Period: time.Second * 10, // We are setting Period at least 60secs because of issue https://github.com/elastic/beats/issues/38458 duration := base.Module().Config().Period - if time.Duration(base.Module().Config().Period.Seconds()) < 60*time.Second { + if time.Duration(duration.Seconds()) < 60*time.Second { duration = 60 * time.Second } From f5c20ab7a125ea4f945940830b2e8c93c9080582 Mon Sep 17 00:00:00 2001 From: Andrew Gizas Date: Wed, 27 Mar 2024 10:57:34 +0200 Subject: [PATCH 07/15] Update CHANGELOG.next.asciidoc Co-authored-by: Tetiana Kravchenko --- CHANGELOG.next.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index f5b69130f81..5a0b5305349 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -33,7 +33,7 @@ fields added to events containing the Beats version. {pull}37553[37553] *Heartbeat* *Metricbeat* -- Setting period of counetr cache for Prometheus remote_write at least to 60sec {pull}38553[38553] +- Setting period for counter cache for Prometheus remote_write at least to 60sec {pull}38553[38553] *Osquerybeat* From 89369c7ecf1e00c1680db36b93305c24f693ffb0 Mon Sep 17 00:00:00 2001 From: Andreas Gkizas Date: Thu, 28 Mar 2024 12:26:12 +0200 Subject: [PATCH 08/15] Correcting typos and referring to correct variable --- x-pack/metricbeat/module/prometheus/remote_write/config.go | 6 +++++- x-pack/metricbeat/module/prometheus/remote_write/data.go | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/x-pack/metricbeat/module/prometheus/remote_write/config.go b/x-pack/metricbeat/module/prometheus/remote_write/config.go index 8c5fe12a659..9e66c01d829 100644 --- a/x-pack/metricbeat/module/prometheus/remote_write/config.go +++ b/x-pack/metricbeat/module/prometheus/remote_write/config.go @@ -4,12 +4,16 @@ package remote_write -import "errors" +import ( + "errors" + "time" +) type config struct { UseTypes bool `config:"use_types"` RateCounters bool `config:"rate_counters"` TypesPatterns TypesPatterns `config:"types_patterns" yaml:"types_patterns,omitempty"` + Period time.Duration `config:"period" validate:"positive"` } type TypesPatterns struct { diff --git a/x-pack/metricbeat/module/prometheus/remote_write/data.go b/x-pack/metricbeat/module/prometheus/remote_write/data.go index c0f8bb86a5f..a025be75368 100644 --- a/x-pack/metricbeat/module/prometheus/remote_write/data.go +++ b/x-pack/metricbeat/module/prometheus/remote_write/data.go @@ -45,12 +45,13 @@ func remoteWriteEventsGeneratorFactory(base mb.BaseMetricSet) (remote_write.Remo if config.UseTypes { - // /metricbeat/module/mb/mb.go defines default as Period: time.Second * 10, + // /metricbeat/mb/mb.go defines default as Period: time.Second * 10, // We are setting Period at least 60secs because of issue https://github.com/elastic/beats/issues/38458 - duration := base.Module().Config().Period - if time.Duration(base.Module().Config().Period.Seconds()) < 60*time.Second { + duration := time.Duration(config.Period.Seconds()) + if duration < 60*time.Second { duration = 60 * time.Second } + logp.Debug("Period for counter cache for remote_write", duration.String()) // use a counter cache with a timeout of 5x the period, as a safe value // to make sure that all counters are available between fetches From cbc2d4c6e8953c5e2c5ce55d9e5947d5f6971f8f Mon Sep 17 00:00:00 2001 From: Andreas Gkizas Date: Thu, 28 Mar 2024 13:27:13 +0200 Subject: [PATCH 09/15] Adding default value to config period of remote_write --- .../module/prometheus/remote_write/config.go | 1 + .../module/prometheus/remote_write/data.go | 13 +++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/x-pack/metricbeat/module/prometheus/remote_write/config.go b/x-pack/metricbeat/module/prometheus/remote_write/config.go index 9e66c01d829..8266d05eeb8 100644 --- a/x-pack/metricbeat/module/prometheus/remote_write/config.go +++ b/x-pack/metricbeat/module/prometheus/remote_write/config.go @@ -25,6 +25,7 @@ var defaultConfig = config{ TypesPatterns: TypesPatterns{ CounterPatterns: nil, HistogramPatterns: nil}, + Period: time.Second * 60, } func (c *config) Validate() error { diff --git a/x-pack/metricbeat/module/prometheus/remote_write/data.go b/x-pack/metricbeat/module/prometheus/remote_write/data.go index a025be75368..415459758fb 100644 --- a/x-pack/metricbeat/module/prometheus/remote_write/data.go +++ b/x-pack/metricbeat/module/prometheus/remote_write/data.go @@ -44,18 +44,15 @@ func remoteWriteEventsGeneratorFactory(base mb.BaseMetricSet) (remote_write.Remo } if config.UseTypes { - - // /metricbeat/mb/mb.go defines default as Period: time.Second * 10, - // We are setting Period at least 60secs because of issue https://github.com/elastic/beats/issues/38458 - duration := time.Duration(config.Period.Seconds()) - if duration < 60*time.Second { - duration = 60 * time.Second + // By default prometheus in remote_write pushes data with the interval of 60s. In order to calculate counter rate we are setting Period to 60secs accordingly + if time.Duration(config.Period)*time.Second < 60*time.Second { + config.Period = time.Second * 60 } - logp.Debug("Period for counter cache for remote_write", duration.String()) + logp.Debug("Period for counter cache for remote_write", config.Period.String()) // use a counter cache with a timeout of 5x the period, as a safe value // to make sure that all counters are available between fetches - counters := collector.NewCounterCache(duration * 5) + counters := collector.NewCounterCache(config.Period * 5) g := remoteWriteTypedGenerator{ counterCache: counters, From 08026216eb76a4a35831b1c35d76c7d8efe6ef10 Mon Sep 17 00:00:00 2001 From: Andreas Gkizas Date: Thu, 28 Mar 2024 14:55:39 +0200 Subject: [PATCH 10/15] Adding default value to config period of remote_write --- .../module/prometheus/remote_write/_meta/docs.asciidoc | 8 ++++++++ x-pack/metricbeat/metricbeat.reference.yml | 4 ++-- x-pack/metricbeat/module/prometheus/remote_write/data.go | 9 +++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/metricbeat/module/prometheus/remote_write/_meta/docs.asciidoc b/metricbeat/module/prometheus/remote_write/_meta/docs.asciidoc index 2e1cc2ca4f0..4d2e0a87563 100644 --- a/metricbeat/module/prometheus/remote_write/_meta/docs.asciidoc +++ b/metricbeat/module/prometheus/remote_write/_meta/docs.asciidoc @@ -86,6 +86,9 @@ metricbeat.modules: metricsets: ["remote_write"] host: "localhost" port: "9201" + use_types: true + rate_counters: true + period: 60s ------------------------------------------------------------------------------------- `use_types` parameter (default: false) enables a different layout for metrics storage, leveraging Elasticsearch @@ -95,6 +98,11 @@ types, including https://www.elastic.co/guide/en/elasticsearch/reference/current the counter increment since the last collection. This metric should make some aggregations easier and with better performance. This parameter can only be enabled in combination with `use_types`. +`period` parameter (default: 60s) configures the timeout of internal cache, which stores counter values in order to calculate rates between consecutive fetches. +Note that by default prometheus pushes data with the interval of 60s (in remote write). In case that prometheus push rate is changed, the `period` parameter needs to be configured accordingly. + + + When `use_types` and `rate_counters` are enabled, metrics are stored like this: [source,json] diff --git a/x-pack/metricbeat/metricbeat.reference.yml b/x-pack/metricbeat/metricbeat.reference.yml index ddf87ff6fe2..04f35be38cf 100644 --- a/x-pack/metricbeat/metricbeat.reference.yml +++ b/x-pack/metricbeat/metricbeat.reference.yml @@ -1334,8 +1334,8 @@ metricbeat.modules: # Store counter rates instead of original cumulative counters (experimental, default: false) #rate_counters: true - # Set timeout period for the counter cache. This cache is used to calculate the rates of counters between fetches (experimental, default: 60sec) - #period: 1m + # Set timeout period for the counter cache. This cache is used to calculate the rates of counters between fetches (experimental, default: 60s) + #period: 60s # Define patterns for counter and histogram types so as to identify metrics' types according to these patterns #types_patterns: diff --git a/x-pack/metricbeat/module/prometheus/remote_write/data.go b/x-pack/metricbeat/module/prometheus/remote_write/data.go index 415459758fb..183fe82e3ae 100644 --- a/x-pack/metricbeat/module/prometheus/remote_write/data.go +++ b/x-pack/metricbeat/module/prometheus/remote_write/data.go @@ -45,14 +45,15 @@ func remoteWriteEventsGeneratorFactory(base mb.BaseMetricSet) (remote_write.Remo if config.UseTypes { // By default prometheus in remote_write pushes data with the interval of 60s. In order to calculate counter rate we are setting Period to 60secs accordingly - if time.Duration(config.Period)*time.Second < 60*time.Second { - config.Period = time.Second * 60 + duration, err := time.ParseDuration(config.Period.String()) + if duration < 60*time.Second || err != nil { + duration = time.Second * 60 } - logp.Debug("Period for counter cache for remote_write", config.Period.String()) + logp.Debug("Period for counter cache for remote_write", duration.String()) // use a counter cache with a timeout of 5x the period, as a safe value // to make sure that all counters are available between fetches - counters := collector.NewCounterCache(config.Period * 5) + counters := collector.NewCounterCache(duration * 5) g := remoteWriteTypedGenerator{ counterCache: counters, From 11831b4d3b76668d88e43bed66269c3f1ac49d2f Mon Sep 17 00:00:00 2001 From: Andreas Gkizas Date: Thu, 28 Mar 2024 15:10:12 +0200 Subject: [PATCH 11/15] Removing spaces from doc --- metricbeat/module/prometheus/remote_write/_meta/docs.asciidoc | 2 -- 1 file changed, 2 deletions(-) diff --git a/metricbeat/module/prometheus/remote_write/_meta/docs.asciidoc b/metricbeat/module/prometheus/remote_write/_meta/docs.asciidoc index 4d2e0a87563..bd1a5f64a98 100644 --- a/metricbeat/module/prometheus/remote_write/_meta/docs.asciidoc +++ b/metricbeat/module/prometheus/remote_write/_meta/docs.asciidoc @@ -101,8 +101,6 @@ performance. This parameter can only be enabled in combination with `use_types`. `period` parameter (default: 60s) configures the timeout of internal cache, which stores counter values in order to calculate rates between consecutive fetches. Note that by default prometheus pushes data with the interval of 60s (in remote write). In case that prometheus push rate is changed, the `period` parameter needs to be configured accordingly. - - When `use_types` and `rate_counters` are enabled, metrics are stored like this: [source,json] From 4cfcf016092a21fae39a7dec5bb030222d3f894c Mon Sep 17 00:00:00 2001 From: Andreas Gkizas Date: Fri, 29 Mar 2024 10:59:11 +0200 Subject: [PATCH 12/15] Moving check functions to validate inside config --- x-pack/metricbeat/metricbeat.reference.yml | 1 + .../module/prometheus/remote_write/config.go | 10 +++++++++- .../metricbeat/module/prometheus/remote_write/data.go | 10 ++-------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/x-pack/metricbeat/metricbeat.reference.yml b/x-pack/metricbeat/metricbeat.reference.yml index 04f35be38cf..97f92c1156b 100644 --- a/x-pack/metricbeat/metricbeat.reference.yml +++ b/x-pack/metricbeat/metricbeat.reference.yml @@ -1335,6 +1335,7 @@ metricbeat.modules: #rate_counters: true # Set timeout period for the counter cache. This cache is used to calculate the rates of counters between fetches (experimental, default: 60s) + # Period parameter will be validated and all values lower than 60sec will be reset to the default value #period: 60s # Define patterns for counter and histogram types so as to identify metrics' types according to these patterns diff --git a/x-pack/metricbeat/module/prometheus/remote_write/config.go b/x-pack/metricbeat/module/prometheus/remote_write/config.go index 8266d05eeb8..9e86facb1d0 100644 --- a/x-pack/metricbeat/module/prometheus/remote_write/config.go +++ b/x-pack/metricbeat/module/prometheus/remote_write/config.go @@ -32,6 +32,14 @@ func (c *config) Validate() error { if c.RateCounters && !c.UseTypes { return errors.New("'rate_counters' can only be enabled when `use_types` is also enabled") } - + duration, err := time.ParseDuration(c.Period.String()) + { + if err != nil { + return err + } else if duration < 60*time.Second { + // by default prometheus push data with the interval 60s, in order to calculate counter rate we are setting Period to 60secs accordingly + c.Period = time.Second * 60 + } + } return nil } diff --git a/x-pack/metricbeat/module/prometheus/remote_write/data.go b/x-pack/metricbeat/module/prometheus/remote_write/data.go index 183fe82e3ae..5161d785fb0 100644 --- a/x-pack/metricbeat/module/prometheus/remote_write/data.go +++ b/x-pack/metricbeat/module/prometheus/remote_write/data.go @@ -44,16 +44,10 @@ func remoteWriteEventsGeneratorFactory(base mb.BaseMetricSet) (remote_write.Remo } if config.UseTypes { - // By default prometheus in remote_write pushes data with the interval of 60s. In order to calculate counter rate we are setting Period to 60secs accordingly - duration, err := time.ParseDuration(config.Period.String()) - if duration < 60*time.Second || err != nil { - duration = time.Second * 60 - } - logp.Debug("Period for counter cache for remote_write", duration.String()) - + logp.Debug("prometheus.remote_write.cache", "Period for counter cache for remote_write: %v", config.Period.String()) // use a counter cache with a timeout of 5x the period, as a safe value // to make sure that all counters are available between fetches - counters := collector.NewCounterCache(duration * 5) + counters := collector.NewCounterCache(config.Period * 5) g := remoteWriteTypedGenerator{ counterCache: counters, From f82c624c70e1e3e9698b3ff2ed42c3bfa045822d Mon Sep 17 00:00:00 2001 From: Andreas Gkizas Date: Fri, 29 Mar 2024 11:14:43 +0200 Subject: [PATCH 13/15] Moving check functions to validate inside config --- metricbeat/module/prometheus/remote_write/_meta/docs.asciidoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metricbeat/module/prometheus/remote_write/_meta/docs.asciidoc b/metricbeat/module/prometheus/remote_write/_meta/docs.asciidoc index bd1a5f64a98..d99f9837160 100644 --- a/metricbeat/module/prometheus/remote_write/_meta/docs.asciidoc +++ b/metricbeat/module/prometheus/remote_write/_meta/docs.asciidoc @@ -98,7 +98,8 @@ types, including https://www.elastic.co/guide/en/elasticsearch/reference/current the counter increment since the last collection. This metric should make some aggregations easier and with better performance. This parameter can only be enabled in combination with `use_types`. -`period` parameter (default: 60s) configures the timeout of internal cache, which stores counter values in order to calculate rates between consecutive fetches. +`period` parameter (default: 60s) configures the timeout of internal cache, which stores counter values in order to calculate rates between consecutive fetches. The parameter will be validated and all values lower than 60sec will be reset to the default value. + Note that by default prometheus pushes data with the interval of 60s (in remote write). In case that prometheus push rate is changed, the `period` parameter needs to be configured accordingly. When `use_types` and `rate_counters` are enabled, metrics are stored like this: From d1d18f49bee656ceabd24d8706d497bafb875770 Mon Sep 17 00:00:00 2001 From: Andreas Gkizas Date: Fri, 29 Mar 2024 11:43:53 +0200 Subject: [PATCH 14/15] Updating reference file --- x-pack/metricbeat/metricbeat.reference.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/x-pack/metricbeat/metricbeat.reference.yml b/x-pack/metricbeat/metricbeat.reference.yml index 97f92c1156b..f71e58904fd 100644 --- a/x-pack/metricbeat/metricbeat.reference.yml +++ b/x-pack/metricbeat/metricbeat.reference.yml @@ -1334,10 +1334,6 @@ metricbeat.modules: # Store counter rates instead of original cumulative counters (experimental, default: false) #rate_counters: true - # Set timeout period for the counter cache. This cache is used to calculate the rates of counters between fetches (experimental, default: 60s) - # Period parameter will be validated and all values lower than 60sec will be reset to the default value - #period: 60s - # Define patterns for counter and histogram types so as to identify metrics' types according to these patterns #types_patterns: # counter_patterns: [] From 6ae51f8d8b684b7e9db671deba8386a278988f5e Mon Sep 17 00:00:00 2001 From: Andreas Gkizas Date: Fri, 29 Mar 2024 12:16:01 +0200 Subject: [PATCH 15/15] After running make check --- x-pack/filebeat/input/internal/httplog/roundtripper.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/filebeat/input/internal/httplog/roundtripper.go b/x-pack/filebeat/input/internal/httplog/roundtripper.go index e8d5f8765ca..642245603f8 100644 --- a/x-pack/filebeat/input/internal/httplog/roundtripper.go +++ b/x-pack/filebeat/input/internal/httplog/roundtripper.go @@ -17,10 +17,11 @@ import ( "strconv" "time" - "github.com/elastic/elastic-agent-libs/logp" "go.uber.org/atomic" "go.uber.org/zap" "go.uber.org/zap/zapcore" + + "github.com/elastic/elastic-agent-libs/logp" ) var _ http.RoundTripper = (*LoggingRoundTripper)(nil)