Documentation ¶
Overview ¶
Package service handles the command-line, configuration, and runs the OpenTelemetry Collector.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCommand ¶
func NewCommand(set CollectorSettings) *cobra.Command
NewCommand constructs a new cobra.Command using the given CollectorSettings.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector represents a server providing the OpenTelemetry Collector service.
func NewCollector ¶
func NewCollector(set CollectorSettings) (*Collector, error)
NewCollector creates and returns a new instance of Collector.
type CollectorSettings ¶
type CollectorSettings struct { // Factories service factories. Factories 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 // SkipSettingGRPCLogger avoids setting the grpc logger SkipSettingGRPCLogger bool }
CollectorSettings holds configuration for creating a new Collector.
type Config ¶
type Config struct { // Receivers is a map of ComponentID to Receivers. Receivers map[component.ID]component.Config // Exporters is a map of ComponentID to Exporters. Exporters map[component.ID]component.Config // Processors is a map of ComponentID to Processors. Processors map[component.ID]component.Config // Connectors is a map of ComponentID to connectors. Connectors map[component.ID]component.Config // Extensions is a map of ComponentID to extensions. Extensions map[component.ID]component.Config Service service.Config }
Config defines the configuration for the various elements of collector or agent.
func (*Config) Validate ¶
Validate returns an error if the config is invalid.
This function performs basic validation of configuration. There may be more subtle invalid cases that we currently don't check for but which we may want to add in the future (e.g. disallowing receiving and exporting on the same endpoint).
type ConfigProvider ¶
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 Factories) (*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 NewConfigProvider ¶
func NewConfigProvider(set ConfigProviderSettings) (ConfigProvider, error)
NewConfigProvider returns a new ConfigProvider that provides the service configuration: * Initially it resolves the "configuration map":
- Retrieve the confmap.Conf by merging all retrieved maps from the given `locations` in order.
- Then applies all the confmap.Converter in the given order.
* Then unmarshalls the confmap.Conf into the service Config.
type ConfigProviderSettings ¶
type ConfigProviderSettings struct { // ResolverSettings are the settings to configure the behavior of the confmap.Resolver. ResolverSettings confmap.ResolverSettings }
ConfigProviderSettings are the settings to configure the behavior of the ConfigProvider.
type Factories ¶
type Factories struct { // Receivers maps receiver type names in the config to the respective factory. Receivers map[component.Type]receiver.Factory // Processors maps processor type names in the config to the respective factory. Processors map[component.Type]processor.Factory // Exporters maps exporter type names in the config to the respective factory. Exporters map[component.Type]exporter.Factory // Extensions maps extension type names in the config to the respective factory. Extensions map[component.Type]extension.Factory // Connectors maps connector type names in the config to the respective factory. Connectors map[component.Type]connector.Factory }
Factories struct holds in a single type all component factories that can be handled by the Config.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
sharedgate
Package sharedgate exposes a featuregate that is used by multiple packages.
|
Package sharedgate exposes a featuregate that is used by multiple packages. |