config

package
v2.2.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 13 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 *OTelConfig, cfg CommonOTelConfig, extraProcessors ...string)

AddAlertsPipeline adds reusable alerts pipeline.

func AddPrometheusRemoteWriteExporter

func AddPrometheusRemoteWriteExporter(config *OTelConfig, 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 OTelConfig

type OTelConfig 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    *OTelService           `json:"service"`
}

OTelConfig represents OTel Collector configuration.

func NewOTelConfig

func NewOTelConfig() *OTelConfig

NewOTelConfig creates new empty OTelConfig.

func (*OTelConfig) AddBatchProcessor

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

AddBatchProcessor is a helper function for adding batch processor.

func (*OTelConfig) AddConnector

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

AddConnector adds connector to OTel config.

func (*OTelConfig) AddDebugExtensions

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

AddDebugExtensions adds common debug extensions and enables them.

func (*OTelConfig) AddExporter

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

AddExporter adds exporter to OTel config.

func (*OTelConfig) AddExtension

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

AddExtension adds given extension and enables it in service.

func (*OTelConfig) AddProcessor

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

AddProcessor adds processor to OTel config.

func (*OTelConfig) AddReceiver

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

AddReceiver adds receiver to OTel config.

func (*OTelConfig) AsMap

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

AsMap returns map representation of OTelConfig.

func (*OTelConfig) SetDebugPort

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

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

type OTelConfigProvider

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

OTelConfigProvider can be used as an OTel config map provider.

func NewOTelConfigProvider

func NewOTelConfigProvider(scheme string, config *OTelConfig) *OTelConfigProvider

NewOTelConfigProvider creates a new OTelConfigUnmarshaler instance.

func (*OTelConfigProvider) GetConfig

func (u *OTelConfigProvider) GetConfig() *OTelConfig

GetConfig returns the current config.

func (*OTelConfigProvider) Retrieve

Retrieve returns the value to be injected in the configuration and the corresponding watcher.

func (*OTelConfigProvider) Scheme

func (u *OTelConfigProvider) Scheme() string

Scheme returns the scheme name, location scheme used by Retrieve.

func (*OTelConfigProvider) Shutdown

func (u *OTelConfigProvider) Shutdown(ctx context.Context) error

Shutdown indicates the provider should close.

func (*OTelConfigProvider) UpdateConfig

func (u *OTelConfigProvider) UpdateConfig(config *OTelConfig)

UpdateConfig sets the map to the given map.

type OTelService

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

OTelService represents service in OTel Config.

func NewOTelService

func NewOTelService() *OTelService

NewOTelService returns new empty OTel Service.

func (*OTelService) AddPipeline

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

AddPipeline adds pipeline to OTel Service.

func (*OTelService) AsMap

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

AsMap returns map representation of OTelService.

func (*OTelService) Pipeline

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

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

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.

Jump to

Keyboard shortcuts

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