config.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package simpleprometheusreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/simpleprometheusreceiver"
  4. import (
  5. "net/url"
  6. "time"
  7. "go.opentelemetry.io/collector/config/confighttp"
  8. )
  9. // Config defines configuration for simple prometheus receiver.
  10. type Config struct {
  11. confighttp.HTTPClientSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
  12. // Deprecated: [v0.55.0] Use confighttp.HTTPClientSettings instead.
  13. httpConfig `mapstructure:",squash"`
  14. // CollectionInterval is the interval at which metrics should be collected
  15. CollectionInterval time.Duration `mapstructure:"collection_interval"`
  16. // MetricsPath the path to the metrics endpoint.
  17. MetricsPath string `mapstructure:"metrics_path"`
  18. // Params the parameters to the metrics endpoint.
  19. Params url.Values `mapstructure:"params,omitempty"`
  20. // Labels static labels
  21. Labels map[string]string `mapstructure:"labels,omitempty"`
  22. // Whether or not to use pod service account to authenticate.
  23. UseServiceAccount bool `mapstructure:"use_service_account"`
  24. }
  25. // TODO: Move to a common package for use by other receivers and also pull
  26. // in other utilities from
  27. // https://github.com/signalfx/signalfx-agent/blob/main/pkg/core/common/httpclient/http.go.
  28. type httpConfig struct {
  29. // Whether not TLS is enabled
  30. TLSEnabled bool `mapstructure:"tls_enabled"`
  31. TLSConfig tlsConfig `mapstructure:"tls_config"`
  32. }
  33. // tlsConfig holds common TLS config options
  34. type tlsConfig struct {
  35. // Path to the CA cert that has signed the TLS cert.
  36. CAFile string `mapstructure:"ca_file"`
  37. // Path to the client TLS cert to use for TLS required connections.
  38. CertFile string `mapstructure:"cert_file"`
  39. // Path to the client TLS key to use for TLS required connections.
  40. KeyFile string `mapstructure:"key_file"`
  41. // Whether or not to verify the exporter's TLS cert.
  42. InsecureSkipVerify bool `mapstructure:"insecure_skip_verify"`
  43. }