diff --git a/component/component.go b/component/component.go index 56a8150a10c..21e0038ed70 100644 --- a/component/component.go +++ b/component/component.go @@ -24,7 +24,7 @@ import ( // // A component's lifecycle has the following phases: // -// 1. Creation: The component is create using the factory, via a Create* call. +// 1. Creation: The component is created using its respective factory, via a Create* call. // 2. Start: The component's Start method is called. // 3. Running: The component is up and running. // 4. Shutdown: The component's Shutdown method is called and the lifecycle is complete. @@ -33,7 +33,7 @@ import ( // is created, starts, runs and is shutdown again. type Component interface { // Start tells the component to start. Host parameter can be used for communicating - // with the host after Start() has already returned. If error is returned by + // with the host after Start() has already returned. If an error is returned by // Start() then the collector startup will be aborted. // If this is an exporter component it may prepare for exporting // by connecting to the endpoint. @@ -41,19 +41,19 @@ type Component interface { // If the component needs to perform a long-running starting operation then it is recommended // that Start() returns quickly and the long-running operation is performed in background. // In that case make sure that the long-running operation does not use the context passed - // to Start() function since that context will be cancelled soon and can abort the long-running operation. - // Create a new context from the context.Background() for long-running operations. + // to Start() function since that context will be cancelled soon and can abort the long-running + // operation. Create a new context from the context.Background() for long-running operations. Start(ctx context.Context, host Host) error - // Shutdown is invoked during service shutdown. After Shutdown() is called, if the component accept data in - // any way, it should not accept it anymore. + // Shutdown is invoked during service shutdown. After Shutdown() is called, if the component + // accepted data in any way, it should not accept it anymore. // - // If there are any background operations running by the component they must be aborted as soon as possible. - // Remember that if you started any long-running background operation from the Start() method that operation - // must be also cancelled. If there are any buffer in the component, it should be cleared and the data sent - // immediately to the next component. - // - // Once the Shutdown() method returns the component's lifecycle is completed. No other + // If there are any background operations running by the component they must be aborted as + // soon as possible. Remember that if you started any long-running background operations from + // the Start() method, those operations must be also cancelled. If there are any buffers in the + // component, they should be cleared and the data sent immediately to the next component. + // + // The component's lifecycle is completed once the Shutdown() method returns. No other // methods of the component are called after that. If necessary a new component with // the same or different configuration may be created and started (this may happen // for example if we want to restart the component). diff --git a/component/exporter.go b/component/exporter.go index 76f8e76e86e..b42227123fd 100644 --- a/component/exporter.go +++ b/component/exporter.go @@ -66,25 +66,25 @@ type ExporterFactory interface { // configuration and should not cause side-effects that prevent the creation // of multiple instances of the Exporter. // The object returned by this method needs to pass the checks implemented by - // 'configcheck.ValidateConfig'. It is recommended to have such check in the + // 'configcheck.ValidateConfig'. It is recommended to have these checks in the // tests of any implementation of the Factory interface. CreateDefaultConfig() config.Exporter // CreateTracesExporter creates a trace exporter based on this config. - // If the exporter type does not support tracing or if the config is not valid - // error will be returned instead. + // If the exporter type does not support tracing or if the config is not valid, + // an error will be returned instead. CreateTracesExporter(ctx context.Context, params ExporterCreateParams, cfg config.Exporter) (TracesExporter, error) // CreateMetricsExporter creates a metrics exporter based on this config. - // If the exporter type does not support metrics or if the config is not valid - // error will be returned instead. + // If the exporter type does not support metrics or if the config is not valid, + // an error will be returned instead. CreateMetricsExporter(ctx context.Context, params ExporterCreateParams, cfg config.Exporter) (MetricsExporter, error) // CreateLogsExporter creates an exporter based on the config. - // If the exporter type does not support logs or if the config is not valid - // error will be returned instead. + // If the exporter type does not support logs or if the config is not valid, + // an error will be returned instead. CreateLogsExporter(ctx context.Context, params ExporterCreateParams, cfg config.Exporter) (LogsExporter, error) } diff --git a/component/extension.go b/component/extension.go index d5493829e7e..f296cf2ddbe 100644 --- a/component/extension.go +++ b/component/extension.go @@ -36,13 +36,13 @@ type Extension interface { type PipelineWatcher interface { // Ready notifies the Extension that all pipelines were built and the // receivers were started, i.e.: the service is ready to receive data - // (notice that it may already have received data when this method is called). + // (note that it may already have received data when this method is called). Ready() error // NotReady notifies the Extension that all receivers are about to be stopped, // i.e.: pipeline receivers will not accept new data. // This is sent before receivers are stopped, so the Extension can take any - // appropriate action before that happens. + // appropriate actions before that happens. NotReady() error } @@ -65,7 +65,7 @@ type ExtensionFactory interface { // configuration and should not cause side-effects that prevent the creation // of multiple instances of the Extension. // The object returned by this method needs to pass the checks implemented by - // 'configcheck.ValidateConfig'. It is recommended to have such check in the + // 'configcheck.ValidateConfig'. It is recommended to have these checks in the // tests of any implementation of the Factory interface. CreateDefaultConfig() config.Extension diff --git a/component/host.go b/component/host.go index e8f4d3f381e..73fd4406df2 100644 --- a/component/host.go +++ b/component/host.go @@ -44,8 +44,8 @@ type Host interface { // GetExtensions returns the map of extensions. Only enabled and created extensions will be returned. // Typically is used to find an extension by type or by full config name. Both cases - // can be done by iterating the returned map. There are typically very few extensions - // so there there is no performance implications due to iteration. + // can be done by iterating the returned map. There are typically very few extensions, + // so there are no performance implications due to iteration. // // GetExtensions can be called by the component anytime after Component.Start() begins and // until Component.Shutdown() ends. @@ -53,8 +53,8 @@ type Host interface { // GetExporters returns the map of exporters. Only enabled and created exporters will be returned. // Typically is used to find exporters by type or by full config name. Both cases - // can be done by iterating the returned map. There are typically very few exporters - // so there there is no performance implications due to iteration. + // can be done by iterating the returned map. There are typically very few exporters, + // so there are no performance implications due to iteration. // This returns a map by DataType of maps by exporter configs to the exporter instance. // Note that an exporter with the same name may be attached to multiple pipelines and // thus we may have an instance of the exporter for multiple data types. diff --git a/component/processor.go b/component/processor.go index 2f9ff69f608..70b661beda1 100644 --- a/component/processor.go +++ b/component/processor.go @@ -61,7 +61,7 @@ type ProcessorCreateParams struct { // ProcessorFactory is factory interface for processors. This is the // new factory type that can create new style processors. // -// This interface cannot be directly implemented, implementations need to embed +// This interface cannot be directly implemented. Implementations need to embed // the BaseProcessorFactory or use the processorhelper.NewFactory to implement it. type ProcessorFactory interface { Factory @@ -71,13 +71,13 @@ type ProcessorFactory interface { // configuration and should not cause side-effects that prevent the creation // of multiple instances of the Processor. // The object returned by this method needs to pass the checks implemented by - // 'configcheck.ValidateConfig'. It is recommended to have such check in the + // 'configcheck.ValidateConfig'. It is recommended to have these checks in the // tests of any implementation of the Factory interface. CreateDefaultConfig() config.Processor // CreateTracesProcessor creates a trace processor based on this config. - // If the processor type does not support tracing or if the config is not valid - // error will be returned instead. + // If the processor type does not support tracing or if the config is not valid, + // an error will be returned instead. CreateTracesProcessor( ctx context.Context, params ProcessorCreateParams, @@ -86,8 +86,8 @@ type ProcessorFactory interface { ) (TracesProcessor, error) // CreateMetricsProcessor creates a metrics processor based on this config. - // If the processor type does not support metrics or if the config is not valid - // error will be returned instead. + // If the processor type does not support metrics or if the config is not valid, + // an error will be returned instead. CreateMetricsProcessor( ctx context.Context, params ProcessorCreateParams, @@ -96,8 +96,8 @@ type ProcessorFactory interface { ) (MetricsProcessor, error) // CreateLogsProcessor creates a processor based on the config. - // If the processor type does not support logs or if the config is not valid - // error will be returned instead. + // If the processor type does not support logs or if the config is not valid, + // an error will be returned instead. CreateLogsProcessor( ctx context.Context, params ProcessorCreateParams, @@ -114,27 +114,27 @@ type BaseProcessorFactory struct{} var _ ProcessorFactory = (*BaseProcessorFactory)(nil) -// Type must be override. +// Type must be overridden. func (b BaseProcessorFactory) Type() config.Type { panic("implement me") } -// CreateDefaultConfig must be override. +// CreateDefaultConfig must be overridden. func (b BaseProcessorFactory) CreateDefaultConfig() config.Processor { panic("implement me") } -// CreateTracesProcessor default implemented as not supported date type. +// CreateTracesProcessor default implemented as not supported data type. func (b BaseProcessorFactory) CreateTracesProcessor(context.Context, ProcessorCreateParams, config.Processor, consumer.Traces) (TracesProcessor, error) { return nil, componenterror.ErrDataTypeIsNotSupported } -// CreateMetricsProcessor default implemented as not supported date type. +// CreateMetricsProcessor default implemented as not supported data type. func (b BaseProcessorFactory) CreateMetricsProcessor(context.Context, ProcessorCreateParams, config.Processor, consumer.Metrics) (MetricsProcessor, error) { return nil, componenterror.ErrDataTypeIsNotSupported } -// CreateLogsProcessor default implemented as not supported date type. +// CreateLogsProcessor default implemented as not supported data type. func (b BaseProcessorFactory) CreateLogsProcessor(context.Context, ProcessorCreateParams, config.Processor, consumer.Logs) (LogsProcessor, error) { return nil, componenterror.ErrDataTypeIsNotSupported } diff --git a/component/receiver.go b/component/receiver.go index 24a6f5932e9..102acf1f009 100644 --- a/component/receiver.go +++ b/component/receiver.go @@ -61,7 +61,7 @@ type ReceiverCreateParams struct { // component to be used later as well. Logger *zap.Logger - // BuildInfo can be used by components for informational purposes + // BuildInfo can be used by components for informational purposes. BuildInfo BuildInfo } @@ -75,25 +75,25 @@ type ReceiverFactory interface { // configuration and should not cause side-effects that prevent the creation // of multiple instances of the Receiver. // The object returned by this method needs to pass the checks implemented by - // 'configcheck.ValidateConfig'. It is recommended to have such check in the + // 'configcheck.ValidateConfig'. It is recommended to have these checks in the // tests of any implementation of the Factory interface. CreateDefaultConfig() config.Receiver // CreateTracesReceiver creates a trace receiver based on this config. // If the receiver type does not support tracing or if the config is not valid - // error will be returned instead. + // an error will be returned instead. CreateTracesReceiver(ctx context.Context, params ReceiverCreateParams, cfg config.Receiver, nextConsumer consumer.Traces) (TracesReceiver, error) // CreateMetricsReceiver creates a metrics receiver based on this config. // If the receiver type does not support metrics or if the config is not valid - // error will be returned instead. + // an error will be returned instead. CreateMetricsReceiver(ctx context.Context, params ReceiverCreateParams, cfg config.Receiver, nextConsumer consumer.Metrics) (MetricsReceiver, error) // CreateLogsReceiver creates a log receiver based on this config. // If the receiver type does not support the data type or if the config is not valid - // error will be returned instead. + // an error will be returned instead. CreateLogsReceiver(ctx context.Context, params ReceiverCreateParams, cfg config.Receiver, nextConsumer consumer.Logs) (LogsReceiver, error) }