factory.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package influxdbreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/influxdbreceiver"
  4. import (
  5. "context"
  6. "go.opentelemetry.io/collector/component"
  7. "go.opentelemetry.io/collector/config/confighttp"
  8. "go.opentelemetry.io/collector/consumer"
  9. "go.opentelemetry.io/collector/receiver"
  10. "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/influxdbreceiver/internal/metadata"
  11. )
  12. func NewFactory() receiver.Factory {
  13. return receiver.NewFactory(
  14. metadata.Type,
  15. createDefaultConfig,
  16. receiver.WithMetrics(createMetricsReceiver, metadata.MetricsStability))
  17. }
  18. // createDefaultConfig creates the default configuration for receiver.
  19. func createDefaultConfig() component.Config {
  20. return &Config{
  21. HTTPServerSettings: confighttp.HTTPServerSettings{
  22. Endpoint: "0.0.0.0:8086",
  23. },
  24. }
  25. }
  26. func createMetricsReceiver(_ context.Context, params receiver.CreateSettings, cfg component.Config, nextConsumer consumer.Metrics) (receiver.Metrics, error) {
  27. return newMetricsReceiver(cfg.(*Config), params, nextConsumer)
  28. }