Documentation ¶
Overview ¶
Package config manages helpers to generate opentelemetry-collector configuration.
Currently the Config struct is the overarching configuration that is generated and marshaled to a confmap to be used by the providers in the otel/collector package.
type Config struct { Receivers telemetryComponents `mapstructure:"receivers"` Exporters telemetryComponents `mapstructure:"exporters"` Processors telemetryComponents `mapstructure:"processors"` Connectors telemetryComponents `mapstructure:"connectors"` Extensions telemetryComponents `mapstructure:"extensions"` Service service.Config `mapstructure:"service"` }
First off we setup our extensions. Then we define our pipelines and from those definitions we can build pipeline configuration. The service config below shows how the Pipelines are defined in map of id -> pipeline. Each pipeline is just a list of receivers, exporters and processors that are dynamically built from that list.
Ex: "hcpPipeline"->pipelineConfig of receivers, exporters, processors. /* // Service Configuration type Config struct { Telemetry telemetry.Config `mapstructure:"telemetry"` Extensions []component.ID `mapstructure:"extensions"` Pipelines map[component.ID]*PipelineConfig `mapstructure:"pipelines"` } type PipelineConfig struct { Receivers []component.ID `mapstructure:"receivers"` Processors []component.ID `mapstructure:"processors"` Exporters []component.ID `mapstructure:"exporters"` } */
All of this is marshaled to a configuration that the otel collector sdk will run. The goal of this package is to help build a configuration that the marshaller will run with our defaults. We setup specific IDs for each pipeline
/* receivers: otlp: protocols: http: {} processors: memory_limiter: check_interval: 1s limit_percentage: 50 spike_limit_percentage: 30 batch: exporters: logging: {} service: pipelines: traces: receivers: [otlp] exporters: [logging] */
Index ¶
- func ExtensionBuilder(opts ...Opts) []component.ID
- func PipelineConfigBuilder(p *Params) pipelines.PipelineConfig
- func ProcessorBuilder(opts ...Opts) []component.ID
- func Telemetry(metricsPort int) telemetry.Config
- func WithExtOauthClientID(ext []component.ID) []component.ID
- func WithFilterProcessor(procesors []component.ID) []component.ID
- func WithResourceProcessor(prcs []component.ID) []component.ID
- type Config
- type ExporterConfig
- type Opts
- type Params
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtensionBuilder ¶
ExtensionBuilder builds a list of extension IDs. Optionally we can include more ids with variadic opts.
func PipelineConfigBuilder ¶
func PipelineConfigBuilder(p *Params) pipelines.PipelineConfig
PipelineConfigBuilder defines a basic list of pipeline component IDs for a service.PipelineConfig.
func ProcessorBuilder ¶
ProcessorBuilder returns a list of processor IDs. The provided IDs inserted between the memory limiter and batch processor.
func WithExtOauthClientID ¶
WithExtOauthClientID is an Opt function to add the oauthclient id to the list of extensions NOTE: this extension will require.
func WithFilterProcessor ¶
WithFilterProcessor is an Opt function to add the filter processor to a list of processors.
Types ¶
type Config ¶
type Config struct { Receivers componentMap `mapstructure:"receivers"` Exporters componentMap `mapstructure:"exporters"` Processors componentMap `mapstructure:"processors"` Connectors componentMap `mapstructure:"connectors"` Extensions componentMap `mapstructure:"extensions"` Service service.Config `mapstructure:"service"` }
Config is a helper type to create a new opentelemetry server configuration. It implements a map[string]interface{} representation of the opentelemetry-collector configuration. More information can be found here: https://opentelemetry.io/docs/collector/configuration/
func NewConfig ¶
func NewConfig() *Config
NewConfig creates a new config object with all types initialized.
func (*Config) EnrichWithExtensions ¶
EnrichWithExtensions adds the specific configurations for a given list of extension IDs. The parameters are sometimes required to build an extension so they should be passed through.
func (*Config) EnrichWithPipelineCfg ¶
func (c *Config) EnrichWithPipelineCfg( pCfg pipelines.PipelineConfig, p *Params, pipelineID component.ID, ) error
EnrichWithPipelineCfg enrichs a Config by taking the IDs specified in a pipeline config and builds the corresponding configuration for each component ID. Some of these components require a set of params.
type ExporterConfig ¶ added in v0.1.0
type ExporterConfig struct { ID component.ID Exporter *exporters.ExporterConfig }
ExporterConfig holds a dynamic exporter configuration and corresponding component.ID
type Params ¶
type Params struct { ExporterConfig *ExporterConfig Client hcp.TelemetryClient ClientID string ClientSecret string ResourceID string BatchTimeout time.Duration MetricsPort int EnvoyListenerPort int }
Params are the inputs to the configuration building process. Only some config requires these inputs.
Directories ¶
Path | Synopsis |
---|---|
helpers
|
|
exporters
Package exporters holds the type of exporters that consul telemetery supports
|
Package exporters holds the type of exporters that consul telemetery supports |
extensions
Package extensions holds the type of extensions that consul telemetery supports
|
Package extensions holds the type of extensions that consul telemetery supports |
processors
Package processors holds the type of processors that consul telemetery supports
|
Package processors holds the type of processors that consul telemetery supports |
receivers
Package receivers holds the type of receivers that consul telemetery supports
|
Package receivers holds the type of receivers that consul telemetery supports |
types
Package types is a place to store reused types amongst the helpers
|
Package types is a place to store reused types amongst the helpers |