factory.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package activedirectorydsreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/activedirectorydsreceiver"
  4. import (
  5. "time"
  6. "go.opentelemetry.io/collector/component"
  7. "go.opentelemetry.io/collector/receiver"
  8. "go.opentelemetry.io/collector/receiver/scraperhelper"
  9. "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/activedirectorydsreceiver/internal/metadata"
  10. )
  11. const (
  12. defaultCollectionInterval = 10 * time.Second
  13. )
  14. func NewFactory() receiver.Factory {
  15. return receiver.NewFactory(
  16. metadata.Type,
  17. createDefaultConfig,
  18. receiver.WithMetrics(createMetricsReceiver, metadata.MetricsStability),
  19. )
  20. }
  21. func createDefaultConfig() component.Config {
  22. cfg := scraperhelper.NewDefaultScraperControllerSettings(metadata.Type)
  23. cfg.CollectionInterval = defaultCollectionInterval
  24. return &Config{
  25. ScraperControllerSettings: cfg,
  26. MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(),
  27. }
  28. }