config

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

+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(cfg *OTELParams, extraProcessors ...string)

AddAlertsPipeline adds reusable alerts pipeline.

func AddControllerMetricsPipeline

func AddControllerMetricsPipeline(cfg *OTELParams)

AddControllerMetricsPipeline adds metrics to pipeline for controller OTEL collector.

func AddMetricsPipeline

func AddMetricsPipeline(cfg *OTELParams)

AddMetricsPipeline adds metrics to pipeline for agent OTEL collector.

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 BatchPostrollupConfig

type BatchPostrollupConfig 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"`
}

BatchPostrollupConfig defines configuration for OTEL batch processor. swagger:model +kubebuilder:object:generate=true

func (*BatchPostrollupConfig) DeepCopy

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

func (*BatchPostrollupConfig) DeepCopyInto

func (in *BatchPostrollupConfig) DeepCopyInto(out *BatchPostrollupConfig)

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

type BatchPrerollupConfig

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

	// 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:"10000"`

	// 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:"10000"`
}

BatchPrerollupConfig defines configuration for OTEL batch processor. swagger:model +kubebuilder:object:generate=true

func (*BatchPrerollupConfig) DeepCopy

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

func (*BatchPrerollupConfig) DeepCopyInto

func (in *BatchPrerollupConfig) DeepCopyInto(out *BatchPrerollupConfig)

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 *UserOTELConfig)

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 *UserOTELConfig)

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 OTELParams

type OTELParams struct {
	Config   *OTELConfig
	Listener *listener.Listener

	UserOTELConfig
	// contains filtered or unexported fields
}

OTELParams contains parameters for otel collector factories for agent and controller.

func NewOTELParams

func NewOTELParams(in FxIn) (*OTELParams, error)

NewOTELParams returns OTEL parameters for OTEL collectors.

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.

type UserOTELConfig

type UserOTELConfig struct {
	// BatchPrerollup configures batch prerollup processor.
	BatchPrerollup BatchPrerollupConfig `json:"batch_prerollup"`
	// BatchPostrollup configures batch postrollup processor.
	BatchPostrollup BatchPostrollupConfig `json:"batch_postrollup"`
	// BatchAlerts configures batch alerts processor.
	BatchAlerts BatchAlertsConfig `json:"batch_alerts"`
	// Ports configures debug, health and extension ports values.
	Ports PortsConfig `json:"ports"`
}

UserOTELConfig is the configuration for the OTEL collector. swagger:model +kubebuilder:object:generate=true

func NewDefaultUserOTELConfig

func NewDefaultUserOTELConfig() *UserOTELConfig

NewDefaultUserOTELConfig creates UserOTELConfig with all the default values set.

func (*UserOTELConfig) DeepCopy

func (in *UserOTELConfig) DeepCopy() *UserOTELConfig

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

func (*UserOTELConfig) DeepCopyInto

func (in *UserOTELConfig) DeepCopyInto(out *UserOTELConfig)

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