Skip to content

Commit

Permalink
[receiver/mongodbatlas] Change default collection interval to 3 minut…
Browse files Browse the repository at this point in the history
…es (open-telemetry#20439)

* change receiver to default to 3 minute collection interval for metrics
  • Loading branch information
schmikei committed Mar 29, 2023
1 parent 317491f commit e6e329d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .chloggen/mongodbatlas-collection-interval-default-change.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: mongodbatlasreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Fix issue where default collection interval of 1 minute was too short to collect several metrics.

# One or more tracking issues related to the change
issues: [18032]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: Default collection interval is now 3 minutes.
1 change: 1 addition & 0 deletions receiver/mongodbatlasreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ MongoDB Atlas [Documentation](https://www.mongodb.com/docs/atlas/reference/api/l
- `public_key` (required for metrics, logs, or alerts in `poll` mode)
- `private_key` (required for metrics, logs, or alerts in `poll` mode)
- `granularity` (default `PT1M` - See [MongoDB Atlas Documentation](https://docs.atlas.mongodb.com/reference/api/process-measurements/))
- `collection_interval` (default `3m`) This receiver collects metrics on an interval. Valid time units are `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`.
- `storage` (optional) The component ID of a storage extension which can be used when polling for `alerts` or `events` . The storage extension prevents duplication of data after a collector restart by remembering which data were previously collected.
- `retry_on_failure`
- `enabled` (default true)
Expand Down
7 changes: 6 additions & 1 deletion receiver/mongodbatlasreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"errors"
"fmt"
"time"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/consumer"
Expand Down Expand Up @@ -99,7 +100,7 @@ func createCombinedLogReceiver(
}

func createDefaultConfig() component.Config {
return &Config{
c := &Config{
ScraperControllerSettings: scraperhelper.NewDefaultScraperControllerSettings(typeStr),
Granularity: defaultGranularity,
RetrySettings: exporterhelper.NewDefaultRetrySettings(),
Expand All @@ -116,4 +117,8 @@ func createDefaultConfig() component.Config {
Projects: []*ProjectConfig{},
},
}
// reset default of 1 minute to be 3 minutes in order to avoid null values for some metrics that do not publish
// more frequently
c.ScraperControllerSettings.CollectionInterval = 3 * time.Minute
return c
}
1 change: 1 addition & 0 deletions receiver/mongodbatlasreceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
func TestDefaultConfig(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
require.Equal(t, cfg.(*Config).ScraperControllerSettings.CollectionInterval, 3*time.Minute)
recv, err := createMetricsReceiver(context.Background(), receivertest.NewNopCreateSettings(), cfg, consumertest.NewNop())
require.NoError(t, err)
require.NotNil(t, recv, "receiver creation failed")
Expand Down

0 comments on commit e6e329d

Please sign in to comment.