Skip to content

Commit

Permalink
Correcting period for Prometheus remote_write
Browse files Browse the repository at this point in the history
  • Loading branch information
gizas committed Mar 22, 2024
1 parent fc75d6c commit 102f805
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion x-pack/metricbeat/module/prometheus/remote_write/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ var defaultConfig = config{
TypesPatterns: TypesPatterns{
CounterPatterns: nil,
HistogramPatterns: nil},
Period: time.Minute * 1,
}

func (c *config) Validate() error {
Expand Down
7 changes: 5 additions & 2 deletions x-pack/metricbeat/module/prometheus/remote_write/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 102f805

Please sign in to comment.