config

package
v0.24.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

+kubebuilder:validation:Optional

+kubebuilder:validation:Optional

Index

Constants

This section is empty.

Variables

View Source
var BaseFxTag = config.NameTag("base")

BaseFxTag is the base name tag for otel components.

Functions

func AddAlertsPipeline

func AddAlertsPipeline(config *OTELConfig, cfg CommonOTELConfig, extraProcessors ...string)

AddAlertsPipeline adds reusable alerts pipeline.

func AddPrometheusRemoteWriteExporter added in v0.22.0

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

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

func BuildApertureSelfScrapeConfig added in v0.22.0

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 added in v0.22.0

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 added in v0.22.0

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 added in v0.22.0

func NewDefaultCommonOTELConfig() *CommonOTELConfig

NewDefaultCommonOTELConfig creates CommonOTELConfig with all the default values set.

func (*CommonOTELConfig) DeepCopy added in v0.22.0

func (in *CommonOTELConfig) DeepCopy() *CommonOTELConfig

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

func (*CommonOTELConfig) DeepCopyInto added in v0.22.0

func (in *CommonOTELConfig) DeepCopyInto(out *CommonOTELConfig)

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

type FxIn

type FxIn struct {
	fx.In
	Unmarshaller    config.Unmarshaller
	Listener        *listener.Listener
	PromClient      promapi.Client
	TLSConfig       *tls.Config
	ServerTLSConfig tlsconfig.ServerTLSConfig
}

FxIn consumes parameters via Fx.

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"`
	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) 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 receiver 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 receiver 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 OTELConfigUnmarshaller

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

OTELConfigUnmarshaller can be used as an OTEL config map provider.

func NewOTELConfigUnmarshaler

func NewOTELConfigUnmarshaler(config map[string]interface{}) *OTELConfigUnmarshaller

NewOTELConfigUnmarshaler creates a new OTELConfigUnmarshaler instance.

func (*OTELConfigUnmarshaller) Retrieve

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

func (*OTELConfigUnmarshaller) Scheme

func (u *OTELConfigUnmarshaller) Scheme() string

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

func (*OTELConfigUnmarshaller) Shutdown

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

Shutdown indicates the provider should close.

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