diff --git a/service/internal/components/components.go b/service/internal/components/components.go deleted file mode 100644 index 5cb52f3e910..00000000000 --- a/service/internal/components/components.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package components // import "go.opentelemetry.io/collector/service/internal/components" - -import ( - "go.uber.org/zap" - - "go.opentelemetry.io/collector/component" -) - -// LogStabilityLevel logs the stability level of a component. The log level is set to info for -// undefined, unmaintained, deprecated and development. The log level is set to debug -// for alpha, beta and stable. -func LogStabilityLevel(logger *zap.Logger, sl component.StabilityLevel) { - if sl >= component.StabilityLevelAlpha { - logger.Debug(sl.LogMessage(), zap.String(zapStabilityKey, sl.String())) - } else { - logger.Info(sl.LogMessage(), zap.String(zapStabilityKey, sl.String())) - } -} diff --git a/service/internal/components/components_test.go b/service/internal/components/components_test.go deleted file mode 100644 index 7fcb98486cb..00000000000 --- a/service/internal/components/components_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package components // import "go.opentelemetry.io/collector/service/internal/components" - -import ( - "testing" - - "github.com/stretchr/testify/require" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" - "go.uber.org/zap/zaptest/observer" - - "go.opentelemetry.io/collector/component" -) - -func TestLogStabilityLevel(t *testing.T) { - tests := []struct { - level zapcore.Level - expectedLogs int - }{ - { - level: zapcore.DebugLevel, - expectedLogs: 7, - }, - { - level: zapcore.InfoLevel, - expectedLogs: 4, - }, - } - - for _, tt := range tests { - observed, logs := observer.New(tt.level) - logger := zap.New(observed) - // ensure log levels are set correctly for each stability level - LogStabilityLevel(logger, component.StabilityLevelUndefined) - LogStabilityLevel(logger, component.StabilityLevelUnmaintained) - LogStabilityLevel(logger, component.StabilityLevelDeprecated) - LogStabilityLevel(logger, component.StabilityLevelDevelopment) - LogStabilityLevel(logger, component.StabilityLevelAlpha) - LogStabilityLevel(logger, component.StabilityLevelBeta) - LogStabilityLevel(logger, component.StabilityLevelStable) - require.Equal(t, tt.expectedLogs, logs.Len()) - } -}