From fa2990639fa0d6286fffc1a39803833a1a5e88ee Mon Sep 17 00:00:00 2001 From: dhruv-vora Date: Wed, 28 Apr 2021 19:01:11 -0700 Subject: [PATCH 1/2] renamed ExeName to Command, added Description --- cmd/otelcol/main.go | 5 +++-- component/application_info.go | 10 +++++++--- service/application.go | 4 ++-- testbed/testbed/otelcol_runner.go | 5 +++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/cmd/otelcol/main.go b/cmd/otelcol/main.go index 543af839564..d10b63142e3 100644 --- a/cmd/otelcol/main.go +++ b/cmd/otelcol/main.go @@ -33,8 +33,9 @@ func main() { } info := component.ApplicationStartInfo{ - ExeName: "otelcol", - Version: version.Version, + Command: "otelcol", + Description: "OpenTelemetry Collector", + Version: version.Version, } if err := run(service.Parameters{ApplicationStartInfo: info, Factories: factories}); err != nil { diff --git a/component/application_info.go b/component/application_info.go index f071f509a9c..9c088f9b92e 100644 --- a/component/application_info.go +++ b/component/application_info.go @@ -18,7 +18,10 @@ package component // passed into each component. This information can be overridden in custom builds. type ApplicationStartInfo struct { // Executable file name, e.g. "otelcol". - ExeName string + Command string + + // Full name of the collector, e.g. "OpenTelemetry Collector". + Description string // Version string. Version string @@ -27,7 +30,8 @@ type ApplicationStartInfo struct { // DefaultApplicationStartInfo returns the default ApplicationStartInfo. func DefaultApplicationStartInfo() ApplicationStartInfo { return ApplicationStartInfo{ - ExeName: "otelcol", - Version: "latest", + Command: "otelcol", + Description: "OpenTelemetry Collector", + Version: "latest", } } diff --git a/service/application.go b/service/application.go index 3c4aad92b22..f4e8d9381ca 100644 --- a/service/application.go +++ b/service/application.go @@ -107,7 +107,7 @@ func New(params Parameters) (*Application, error) { } rootCmd := &cobra.Command{ - Use: params.ApplicationStartInfo.ExeName, + Use: params.ApplicationStartInfo.Command, Version: params.ApplicationStartInfo.Version, RunE: func(cmd *cobra.Command, args []string) error { var err error @@ -278,7 +278,7 @@ func (app *Application) setupConfigurationComponents(ctx context.Context) error } func (app *Application) execute(ctx context.Context) error { - app.logger.Info("Starting "+app.info.ExeName+"...", + app.logger.Info("Starting "+app.info.Command+"...", zap.String("Version", app.info.Version), zap.Int("NumCPU", runtime.NumCPU()), ) diff --git a/testbed/testbed/otelcol_runner.go b/testbed/testbed/otelcol_runner.go index 1a5183c3888..db64651bdb9 100644 --- a/testbed/testbed/otelcol_runner.go +++ b/testbed/testbed/otelcol_runner.go @@ -86,8 +86,9 @@ func (ipp *InProcessCollector) PrepareConfig(configStr string) (configCleanup fu func (ipp *InProcessCollector) Start(args StartParams) error { params := service.Parameters{ ApplicationStartInfo: component.ApplicationStartInfo{ - ExeName: "otelcol", - Version: version.Version, + Command: "otelcol", + Description: "OpenTelemetry Collector", + Version: version.Version, }, ParserProvider: parserprovider.NewInMemory(strings.NewReader(ipp.configStr)), Factories: ipp.factories, From ae515f9441a5cf910fed110fa239731aee381d7f Mon Sep 17 00:00:00 2001 From: dhruv-vora Date: Wed, 28 Apr 2021 19:08:50 -0700 Subject: [PATCH 2/2] updated CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ed1ddc12c8..27e0d2d9e62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,10 @@ - Change `With*Unmarshallers` signatures in Kafka exporter/receiver (#2973) - Rename `marshall` to `marshal` in all the occurrences (#2977) - Remove `componenterror.ErrAlreadyStarted` and `componenterror.ErrAlreadyStopped`, components should not protect against this, Service will start/stop once. +- Rename `ApplicationStartInfo.ExeName` to `ApplicationStartInfo.Command` ## 💡 Enhancements 💡 + - Add `Description` to `ApplicationStartInfo` ## 🧰 Bug fixes 🧰