otelconfig

package
v2.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

+kubebuilder:validation:Optional

+kubebuilder:validation:Optional

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAlertsPipeline

func AddAlertsPipeline(config *Config, cfg CommonOTelConfig, extraProcessors ...string)

AddAlertsPipeline adds reusable alerts pipeline.

func AddHighCardinalityMetricsFilterProcessor added in v2.5.0

func AddHighCardinalityMetricsFilterProcessor(config *Config)

AddHighCardinalityMetricsFilterProcessor adds filter processor which filters out high cardinality Aperture platform metrics.

func AddPrometheusRemoteWriteExporter

func AddPrometheusRemoteWriteExporter(config *Config, promClient promapi.Client)

AddPrometheusRemoteWriteExporter adds Prometheus remote write exporter which writes to controller Prometheus instance.

func BuildApertureSelfScrapeConfig

func BuildApertureSelfScrapeConfig(
	name string,
	tlsConfig *tls.Config,
	lis *listener.Listener,
) map[string]any

BuildApertureSelfScrapeConfig is a helper to create prometheus configuration which scrapes localhost.

func BuildOTelScrapeConfig

func BuildOTelScrapeConfig(name string, cfg CommonOTelConfig) map[string]any

BuildOTelScrapeConfig is a helper to create prometheus sonfiguration which scrapes OTel instance running on localhost.

Types

type BatchAlertsConfig

type BatchAlertsConfig struct {
	// Timeout sets the time after which a batch will be sent regardless of size.
	Timeout config.Duration `json:"timeout" validate:"gt=0" default:"1s"`

	// SendBatchSize is the size of a batch which after hit, will trigger it to be sent.
	SendBatchSize uint32 `json:"send_batch_size" validate:"gt=0" default:"100"`

	// SendBatchMaxSize is the upper limit of the batch size. Bigger batches will be split
	// into smaller units.
	SendBatchMaxSize uint32 `json:"send_batch_max_size" validate:"gte=0" default:"100"`
}

BatchAlertsConfig defines configuration for OTel batch processor. swagger:model +kubebuilder:object:generate=true

func (*BatchAlertsConfig) DeepCopy

func (in *BatchAlertsConfig) DeepCopy() *BatchAlertsConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchAlertsConfig.

func (*BatchAlertsConfig) DeepCopyInto

func (in *BatchAlertsConfig) DeepCopyInto(out *BatchAlertsConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CommonOTelConfig

type CommonOTelConfig struct {
	// BatchAlerts configures batch alerts processor.
	BatchAlerts BatchAlertsConfig `json:"batch_alerts"`
	// Ports configures debug, health and extension ports values.
	Ports PortsConfig `json:"ports"`
}

CommonOTelConfig is the configuration for the OTel collector. swagger:model +kubebuilder:object:generate=true

func NewDefaultCommonOTelConfig

func NewDefaultCommonOTelConfig() *CommonOTelConfig

NewDefaultCommonOTelConfig creates CommonOTelConfig with all the default values set.

func (*CommonOTelConfig) DeepCopy

func (in *CommonOTelConfig) DeepCopy() *CommonOTelConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonOTelConfig.

func (*CommonOTelConfig) DeepCopyInto

func (in *CommonOTelConfig) DeepCopyInto(out *CommonOTelConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Config added in v2.3.1

type Config struct {
	Extensions map[string]interface{} `json:"extensions,omitempty"`
	Receivers  map[string]interface{} `json:"receivers,omitempty"`
	Processors map[string]interface{} `json:"processors,omitempty"`
	Exporters  map[string]interface{} `json:"exporters,omitempty"`
	Connectors map[string]interface{} `json:"connectors,omitempty"`
	Service    *Service               `json:"service"`
}

Config represents OTel Collector configuration.

func New added in v2.3.1

func New() *Config

New creates new empty Config.

func (*Config) AddBatchProcessor added in v2.3.1

func (o *Config) AddBatchProcessor(
	name string,
	timeout time.Duration,
	sendBatchSize uint32,
	sendBatchMaxSize uint32,
)

AddBatchProcessor is a helper function for adding batch processor.

func (*Config) AddConnector added in v2.3.1

func (o *Config) AddConnector(name string, value interface{})

AddConnector adds connector to OTel config.

func (*Config) AddDebugExtensions added in v2.3.1

func (o *Config) AddDebugExtensions(userCfg *CommonOTelConfig)

AddDebugExtensions adds common debug extensions and enables them.

func (*Config) AddExporter added in v2.3.1

func (o *Config) AddExporter(name string, value interface{})

AddExporter adds exporter to OTel config.

func (*Config) AddExtension added in v2.3.1

func (o *Config) AddExtension(name string, value interface{})

AddExtension adds given extension and enables it in service.

func (*Config) AddProcessor added in v2.3.1

func (o *Config) AddProcessor(name string, value interface{})

AddProcessor adds processor to OTel config.

func (*Config) AddReceiver added in v2.3.1

func (o *Config) AddReceiver(name string, value interface{})

AddReceiver adds receiver to OTel config.

func (*Config) AsMap added in v2.3.1

func (o *Config) AsMap() map[string]interface{}

AsMap returns map representation of Config.

func (*Config) Copy added in v2.3.1

func (o *Config) Copy() (*Config, error)

Copy returns a deep copy of the config.

This should error only in pathological cases.

func (*Config) MustCopy added in v2.3.1

func (o *Config) MustCopy() *Config

MustCopy returns a deep copy of the config or panics.

func (*Config) SetDebugPort added in v2.3.1

func (o *Config) SetDebugPort(userCfg *CommonOTelConfig)

SetDebugPort configures debug port on which OTel server /metrics as specified by user.

type Pipeline

type Pipeline struct {
	Receivers  []string
	Processors []string
	Exporters  []string
}

Pipeline represents OTel Config pipeline.

func (*Pipeline) AsMap

func (p *Pipeline) AsMap() map[string]interface{}

AsMap returns map representation of Pipeline.

type PortsConfig

type PortsConfig struct {
	// Port on which OTel collector exposes Prometheus metrics on /metrics path.
	DebugPort uint32 `json:"debug_port" validate:"gte=0" default:"8888"`
	// Port on which health check extension in exposed.
	HealthCheckPort uint32 `json:"health_check_port" validate:"gte=0" default:"13133"`
	// Port on which `pprof` extension in exposed.
	PprofPort uint32 `json:"pprof_port" validate:"gte=0" default:"1777"`
	// Port on which `zpages` extension in exposed.
	ZpagesPort uint32 `json:"zpages_port" validate:"gte=0" default:"55679"`
}

PortsConfig defines configuration for OTel debug and extension ports. swagger:model +kubebuilder:object:generate=true

func (*PortsConfig) DeepCopy

func (in *PortsConfig) DeepCopy() *PortsConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortsConfig.

func (*PortsConfig) DeepCopyInto

func (in *PortsConfig) DeepCopyInto(out *PortsConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Provider added in v2.3.1

type Provider struct {
	// contains filtered or unexported fields
}

Provider is an OTel config map provider.

It allows updating the config and registering hooks.

func NewProvider added in v2.3.1

func NewProvider(scheme string, config *Config) *Provider

NewProvider creates a new OTelConfigProvider.

func (*Provider) AddMutatingHook added in v2.3.1

func (p *Provider) AddMutatingHook(hook func(*Config))

AddMutatingHook adds a hook to be run before applying config.

The hook should treat the given config as temporary. The hook will also be executed immediately, to ensure that current config was passed through all the added hooks.

func (*Provider) MustGetConfig added in v2.3.1

func (p *Provider) MustGetConfig() *Config

MustGetConfig returns a snapshot of the current config.

func (*Provider) Retrieve added in v2.3.1

func (p *Provider) Retrieve(
	_ context.Context,
	_ string,
	watchFn confmap.WatcherFunc,
) (*confmap.Retrieved, error)

Retrieve implements confmap.Provider.

func (*Provider) Scheme added in v2.3.1

func (p *Provider) Scheme() string

Scheme implements confmap.Provider.

func (*Provider) Shutdown added in v2.3.1

func (p *Provider) Shutdown(ctx context.Context) error

Shutdown implements confmap.Provider.

func (*Provider) UpdateConfig added in v2.3.1

func (p *Provider) UpdateConfig(config *Config)

UpdateConfig sets the new config, replacing the old one. Before new config is set, hooks are allowed to modify the config. Collector update is triggered asynchronously.

Note: Caller should not use the passed config object after calling this function.

type Service added in v2.3.1

type Service struct {
	Telemetry  map[string]interface{}
	Pipelines  map[string]Pipeline
	Extensions []string
}

Service represents service in OTel Config.

func NewService added in v2.3.1

func NewService() *Service

NewService returns new empty OTel Service.

func (*Service) AddPipeline added in v2.3.1

func (o *Service) AddPipeline(name string, pipeline Pipeline)

AddPipeline adds pipeline to OTel Service.

func (*Service) AsMap added in v2.3.1

func (o *Service) AsMap() map[string]interface{}

AsMap returns map representation of OTelService.

func (*Service) DeletePipeline added in v2.8.0

func (o *Service) DeletePipeline(name string)

DeletePipeline deletes pipeline from the OTel Service.

func (*Service) Pipeline added in v2.3.1

func (o *Service) Pipeline(name string) (Pipeline, bool)

Pipeline gets pipeline with given name from OTel Service together with `exists` bool.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL