Skip to content

[receiver/mongodbatlas] add Project Config to metrics #28865

@JonathanWamsley

Description

@JonathanWamsley

Component(s)

receiver/mongodbatlas

Is your feature request related to a problem? Please describe.

Add a Project Config to metrics like the Alerts, Events and Logs configs

type ProjectConfig struct {
	Name            string   `mapstructure:"name"`
	ExcludeClusters []string `mapstructure:"exclude_clusters"`
	IncludeClusters []string `mapstructure:"include_clusters"`

	includesByClusterName map[string]struct{}
	excludesByClusterName map[string]struct{}
}

Adding this feature will help improve performance by selecting specific projects and or clusters instead of collecting every one which may cause rate limiting by MongoDB Atlas.

Describe the solution you'd like

Add in a Project Config for metrics in the config.

Describe alternatives you've considered

The existing config has a MetricsBuilderConfig in the base, so to not creating breaking changes a the ProjectConfig would go directly in the base config for metrics which would like like:

type Config struct {
	scraperhelper.ScraperControllerSettings `mapstructure:",squash"`
	PublicKey                               string                        `mapstructure:"public_key"`
	PrivateKey                              configopaque.String           `mapstructure:"private_key"`
	Granularity                             string                        `mapstructure:"granularity"`
	MetricsBuilderConfig                    metadata.MetricsBuilderConfig `mapstructure:",squash"`
	Projects                                []*ProjectConfig              `mapstructure:"projects"`
	Alerts                                  AlertConfig                   `mapstructure:"alerts"`
	Events                                  *EventsConfig                 `mapstructure:"events"`
	Logs                                    LogConfig                     `mapstructure:"logs"`
	RetrySettings                           exporterhelper.RetrySettings  `mapstructure:"retry_on_failure"`
	StorageID                               *component.ID                 `mapstructure:"storage"`
}

However, an alternative breaking change would create a new Metrics section which would include the ProjectConfig and possibly moving the MetricsBuilderConfig into the Metrics that would look like:

type Config struct {
	scraperhelper.ScraperControllerSettings `mapstructure:",squash"`
	PublicKey                               string                        `mapstructure:"public_key"`
	PrivateKey                              configopaque.String           `mapstructure:"private_key"`
	Granularity                             string                        `mapstructure:"granularity"`
	Metrics                               MetricConfig                 `mapstructure:"metrics"`
	Alerts                                  AlertConfig                   `mapstructure:"alerts"`
	Events                                  *EventsConfig                 `mapstructure:"events"`
	Logs                                    LogConfig                     `mapstructure:"logs"`
	RetrySettings                           exporterhelper.RetrySettings  `mapstructure:"retry_on_failure"`
	StorageID                               *component.ID                 `mapstructure:"storage"`
}

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions