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 AddSetFlagProperties

    func AddSetFlagProperties(cp *config.Parser, cmd *cobra.Command) error

      AddSetFlagProperties overrides properties from set flag(s) in supplied viper instance. The implementation reads set flag(s) from the cmd and passes the content to a new viper instance as .properties file. Then the properties from new viper instance are read and set to the supplied viper.

      func FileLoaderConfigFactory

      func FileLoaderConfigFactory(cmd *cobra.Command, factories component.Factories) (*config.Config, error)

        FileLoaderConfigFactory implements ConfigFactory and it creates configuration from file and from --set command line flag (if the flag is present).

        Types

        type Application

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

          Application represents a collector application

          func New

          func New(params Parameters) (*Application, error)

            New creates and returns a new instance of Application.

            func (*Application) Command

            func (app *Application) Command() *cobra.Command

              Command returns Application's root command.

              func (*Application) GetLogger

              func (app *Application) GetLogger() *zap.Logger

                GetLogger returns logger used by the Application. The logger is initialized after application start.

                func (*Application) GetStateChannel

                func (app *Application) GetStateChannel() chan State

                  GetStateChannel returns state channel of the application.

                  func (*Application) Run

                  func (app *Application) Run() error

                    Run starts the collector according to the command and configuration given by the user, and waits for it to complete.

                    func (*Application) Shutdown

                    func (app *Application) Shutdown()

                      Shutdown shuts down the application.

                      type ConfigFactory

                      type ConfigFactory func(cmd *cobra.Command, factories component.Factories) (*config.Config, error)

                        ConfigFactory creates config. The ConfigFactory implementation should call AddSetFlagProperties to enable configuration passed via `--set` flag. Viper and command instances are passed from the Application. The factories also belong to the Application and are equal to the factories passed via Parameters.

                        type Parameters

                        type Parameters struct {
                        	// Factories component factories.
                        	Factories component.Factories
                        	// ApplicationStartInfo provides application start information.
                        	ApplicationStartInfo component.ApplicationStartInfo
                        	// ConfigFactory that creates the configuration.
                        	// If it is not provided the default factory (FileLoaderConfigFactory) is used.
                        	// The default factory loads the configuration file and overrides component's configuration
                        	// properties supplied via --set command line flag.
                        	ConfigFactory ConfigFactory
                        	// LoggingOptions provides a way to change behavior of zap logging.
                        	LoggingOptions []zap.Option
                        }

                          Parameters holds configuration for creating a new Application.

                          type State

                          type State int

                            State defines Application's state.

                            const (
                            	Starting State = iota
                            	Running
                            	Closing
                            	Closed
                            )

                            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
                            internal
                            builder
                            Package builder handles the options to build the OpenTelemetry collector pipeline.
                            Package builder handles the options to build the OpenTelemetry collector pipeline.