config

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package config implements loading of configuration from Viper configuration. The implementation relies on registered factories that allow creating default configuration for each type of receiver/exporter/processor.

Index

Constants

View Source
const (
	// ViperDelimiter is used as the default key delimiter in the default viper instance
	ViperDelimiter = "::"
)

Variables

This section is empty.

Functions

func DecodeTypeAndName

func DecodeTypeAndName(key string) (typeStr configmodels.Type, fullName string, err error)

DecodeTypeAndName decodes a key in type[/name] format into type and fullName. fullName is the key normalized such that type and name components have spaces trimmed. The "type" part must be present, the forward slash and "name" are optional. typeStr will be non-empty if err is nil.

func Load

func Load(
	v *viper.Viper,
	factories component.Factories,
) (*configmodels.Config, error)

Load loads a Config from Viper. After loading the config, need to check if it is valid by calling `ValidateConfig`.

func LoadReceiver

func LoadReceiver(componentConfig *viper.Viper, typeStr configmodels.Type, fullName string, factory component.ReceiverFactory) (configmodels.Receiver, error)

LoadReceiver loads a receiver config from componentConfig using the provided factories.

func NewViper

func NewViper() *viper.Viper

Creates a new Viper instance with a different key-delimitor "::" instead of the default ".". This way configs can have keys that contain ".".

func ValidateConfig

func ValidateConfig(cfg *configmodels.Config, _ *zap.Logger) error

ValidateConfig validates config.

func ViperSubExact added in v0.10.0

func ViperSubExact(v *viper.Viper, key string) (*viper.Viper, error)

Copied from the Viper but changed to use the same delimiter and return error if the sub is not a map. See https://github.com/spf13/viper/issues/871

Types

This section is empty.

Directories

Path Synopsis
Package configcheck has checks to be applied to configuration objects implemented by factories of components used in the OpenTelemetry collector.
Package configcheck has checks to be applied to configuration objects implemented by factories of components used in the OpenTelemetry collector.
Package configerror contains the common errors caused by malformed configs.
Package configerror contains the common errors caused by malformed configs.
Package configgrpc defines the gRPC configuration settings.
Package configgrpc defines the gRPC configuration settings.
Package configmodels defines the data models for entities.
Package configmodels defines the data models for entities.
configopaque module
configretry module
internal module

Jump to

Keyboard shortcuts

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