Skip to content

Commit

Permalink
[exporter/datadog] Add configurable reporter_period for host metadata
Browse files Browse the repository at this point in the history
* Minimum reporter_period 5-minutes as suggested by @jade-guiton-dd
  • Loading branch information
NassimBtk committed Dec 2, 2024
1 parent feddfd0 commit 2bbe04b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/datadog/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ func (c *Config) Validate() error {
return err
}

if c.HostMetadata.ReporterPeriod <= 0 {
return errors.New("reporter_period must be a positive duration")
if c.HostMetadata.ReporterPeriod < 5*time.Minute {
return errors.New("reporter_period must be 5 minutes or higher")
}

return nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/datadog/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ func TestValidate(t *testing.T) {
name: "Invalid reporter_period",
cfg: &Config{
API: APIConfig{Key: "notnull"},
HostMetadata: HostMetadataConfig{Enabled: true, ReporterPeriod: 0},
HostMetadata: HostMetadataConfig{Enabled: true, ReporterPeriod: 4 * time.Minute},
},
err: "reporter_period must be a positive duration",
err: "reporter_period must be 5 minutes or higher",
},
}
for _, testInstance := range tests {
Expand Down

0 comments on commit 2bbe04b

Please sign in to comment.