Documentation ¶
Overview ¶
Package service handles the command-line, configuration, and runs the OpenTelemetry Collector.
Index ¶
- Constants
- func NewCommand(set CollectorSettings) *cobra.Command
- type Collector
- type CollectorSettings
- type ConfigProvider
- func MustNewConfigProvider(locations []string, configMapProviders map[string]configmapprovider.Provider, ...) ConfigProvider
- func MustNewDefaultConfigProvider(configLocations []string, properties []string) ConfigProvider
- func NewConfigProvider(locations []string, configMapProviders map[string]configmapprovider.Provider, ...) ConfigProviderdeprecated
- func NewDefaultConfigProvider(configLocations []string, properties []string) ConfigProviderdeprecated
- type State
Constants ¶
const AddCollectorVersionTag = true
AddCollectorVersionTag indicates if the collector version tag should be added to all telemetry metrics
Variables ¶
This section is empty.
Functions ¶
func NewCommand ¶ added in v0.36.0
func NewCommand(set CollectorSettings) *cobra.Command
NewCommand constructs a new cobra.Command using the given Collector. TODO: Make this independent of the collector internals.
Types ¶
type Collector ¶ added in v0.29.0
type Collector struct {
// contains filtered or unexported fields
}
Collector represents a server providing the OpenTelemetry Collector service.
func New ¶
func New(set CollectorSettings) (*Collector, error)
New creates and returns a new instance of Collector.
func (*Collector) GetLogger ¶ added in v0.29.0
GetLogger returns logger used by the Collector. The logger is initialized after collector server start.
func (*Collector) GetState ¶ added in v0.40.0
GetState returns current state of the collector server.
type CollectorSettings ¶ added in v0.29.0
type CollectorSettings struct { // Factories component factories. Factories component.Factories // BuildInfo provides collector start information. BuildInfo component.BuildInfo // DisableGracefulShutdown disables the automatic graceful shutdown // of the collector on SIGINT or SIGTERM. // Users who want to handle signals themselves can disable this behavior // and manually handle the signals to shutdown the collector. DisableGracefulShutdown bool // ConfigProvider provides the service configuration. // If the provider watches for configuration change, collector may reload the new configuration upon changes. ConfigProvider ConfigProvider // LoggingOptions provides a way to change behavior of zap logging. LoggingOptions []zap.Option }
CollectorSettings holds configuration for creating a new Collector.
type ConfigProvider ¶ added in v0.42.0
type ConfigProvider interface { // Get returns the service configuration, or error otherwise. // // Should never be called concurrently with itself, Watch or Shutdown. Get(ctx context.Context, factories component.Factories) (*config.Config, error) // Watch blocks until any configuration change was detected or an unrecoverable error // happened during monitoring the configuration changes. // // Error is nil if the configuration is changed and needs to be re-fetched. Any non-nil // error indicates that there was a problem with watching the config changes. // // Should never be called concurrently with itself or Get. Watch() <-chan error // Shutdown signals that the provider is no longer in use and the that should close // and release any resources that it may have created. // // This function must terminate the Watch channel. // // Should never be called concurrently with itself or Get. Shutdown(ctx context.Context) error }
ConfigProvider provides the service configuration.
The typical usage is the following:
cfgProvider.Get(...) cfgProvider.Watch() // wait for an event. cfgProvider.Get(...) cfgProvider.Watch() // wait for an event. // repeat Get/Watch cycle until it is time to shut down the Collector process. cfgProvider.Shutdown()
func MustNewConfigProvider ¶ added in v0.44.0
func MustNewConfigProvider( locations []string, configMapProviders map[string]configmapprovider.Provider, cfgMapConverters []config.MapConverterFunc, configUnmarshaler configunmarshaler.ConfigUnmarshaler) ConfigProvider
MustNewConfigProvider returns a new ConfigProvider that provides the configuration: * Retrieve the config.Map by merging all retrieved maps from all the configmapprovider.Provider in order. * Then applies all the ConfigMapConverterFunc in the given order. * Then unmarshalls the final config.Config using the given configunmarshaler.ConfigUnmarshaler.
The `configMapProviders` is a map of pairs <scheme,Provider>.
Notice: This API is experimental.
func MustNewDefaultConfigProvider ¶ added in v0.44.0
func MustNewDefaultConfigProvider(configLocations []string, properties []string) ConfigProvider
MustNewDefaultConfigProvider returns the default ConfigProvider, and it creates configuration from a file defined by the given configFile and overwrites fields using properties.
func NewConfigProvider
deprecated
added in
v0.42.0
func NewConfigProvider( locations []string, configMapProviders map[string]configmapprovider.Provider, cfgMapConverters []config.MapConverterFunc, configUnmarshaler configunmarshaler.ConfigUnmarshaler) ConfigProvider
Deprecated: [v0.44.0] use MustNewConfigProvider instead NewConfigProvider returns a new ConfigProvider that provides the configuration: * Retrieve the config.Map by merging all retrieved maps from all the configmapprovider.Provider in order. * Then applies all the config.MapConverterFunc in the given order. * Then unmarshalls the final config.Config using the given configunmarshaler.ConfigUnmarshaler.
The `configMapProviders` is a map of pairs <scheme,Provider>.
Notice: This API is experimental.
func NewDefaultConfigProvider
deprecated
added in
v0.42.0
func NewDefaultConfigProvider(configLocations []string, properties []string) ConfigProvider
Deprecated: [v.0.44.0] use MustNewDefaultConfigProvider instead NewDefaultConfigProvider returns the default ConfigProvider, and it creates configuration from a file defined by the given configFile and overwrites fields using properties.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package defaultcomponents composes the default set of components used by the otel service
|
Package defaultcomponents composes the default set of components used by the otel service |
builder
Package builder handles the options to build the OpenTelemetry collector pipeline.
|
Package builder handles the options to build the OpenTelemetry collector pipeline. |
fanoutconsumer
Package fanoutconsumer contains implementations of Traces/Metrics/Logs consumers that fan out the data to multiple other consumers.
|
Package fanoutconsumer contains implementations of Traces/Metrics/Logs consumers that fan out the data to multiple other consumers. |