From b96caa73fb1a1edcc84d5f43e141a7f3876d85b6 Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Sun, 8 Dec 2024 12:03:47 +0100 Subject: [PATCH] [mdatagen]: fix unused and missing imports Signed-off-by: Matthieu MOREL --- .../samplereceiver/internal/metadata/generated_telemetry.go | 4 ++-- .../internal/templates/component_telemetry_test.go.tmpl | 3 --- cmd/mdatagen/internal/templates/telemetry.go.tmpl | 3 ++- cmd/mdatagen/internal/templates/telemetry_test.go.tmpl | 1 - .../exporterhelper/internal/metadata/generated_telemetry.go | 4 ++-- .../batchprocessor/internal/metadata/generated_telemetry.go | 4 ++-- .../internal/metadata/generated_telemetry.go | 4 ++-- .../processorhelper/internal/metadata/generated_telemetry.go | 4 ++-- .../receiverhelper/internal/metadata/generated_telemetry.go | 4 ++-- .../scraperhelper/internal/metadata/generated_telemetry.go | 4 ++-- service/internal/metadata/generated_telemetry.go | 4 ++-- 11 files changed, 18 insertions(+), 21 deletions(-) diff --git a/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry.go b/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry.go index 99c7017b575..b44d14a8c70 100644 --- a/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry.go +++ b/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry.go @@ -7,7 +7,7 @@ import ( "errors" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" + noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/collector/component" @@ -109,5 +109,5 @@ func getLeveledMeter(meter metric.Meter, cfgLevel, srvLevel configtelemetry.Leve if cfgLevel <= srvLevel { return meter } - return noop.Meter{} + return noopmetric.Meter{} } diff --git a/cmd/mdatagen/internal/templates/component_telemetry_test.go.tmpl b/cmd/mdatagen/internal/templates/component_telemetry_test.go.tmpl index 93949f9f60b..79c01ae0ef2 100644 --- a/cmd/mdatagen/internal/templates/component_telemetry_test.go.tmpl +++ b/cmd/mdatagen/internal/templates/component_telemetry_test.go.tmpl @@ -7,9 +7,6 @@ import ( "testing" "github.com/stretchr/testify/require" - {{- if or isConnector isExporter isExtension isProcessor isReceiver }} - "go.opentelemetry.io/otel/metric" - {{- end }} "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" sdkmetric "go.opentelemetry.io/otel/sdk/metric" diff --git a/cmd/mdatagen/internal/templates/telemetry.go.tmpl b/cmd/mdatagen/internal/templates/telemetry.go.tmpl index 3f365e45167..bb85316467b 100644 --- a/cmd/mdatagen/internal/templates/telemetry.go.tmpl +++ b/cmd/mdatagen/internal/templates/telemetry.go.tmpl @@ -14,6 +14,7 @@ import ( {{- end }} "go.opentelemetry.io/otel/metric" + noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/collector/component" @@ -128,7 +129,7 @@ func getLeveledMeter(meter metric.Meter, cfgLevel, srvLevel configtelemetry.Leve if cfgLevel <= srvLevel { return meter } - return noop.Meter{} + return noopmetric.Meter{} } {{- end }} diff --git a/cmd/mdatagen/internal/templates/telemetry_test.go.tmpl b/cmd/mdatagen/internal/templates/telemetry_test.go.tmpl index 170ad0872ea..55c1579e685 100644 --- a/cmd/mdatagen/internal/templates/telemetry_test.go.tmpl +++ b/cmd/mdatagen/internal/templates/telemetry_test.go.tmpl @@ -15,7 +15,6 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" - "go.opentelemetry.io/collector/config/configtelemetry" ) type mockMeter struct { diff --git a/exporter/exporterhelper/internal/metadata/generated_telemetry.go b/exporter/exporterhelper/internal/metadata/generated_telemetry.go index 41bea2f8ce1..bef767b0a89 100644 --- a/exporter/exporterhelper/internal/metadata/generated_telemetry.go +++ b/exporter/exporterhelper/internal/metadata/generated_telemetry.go @@ -7,7 +7,7 @@ import ( "errors" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" + noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/collector/component" @@ -156,5 +156,5 @@ func getLeveledMeter(meter metric.Meter, cfgLevel, srvLevel configtelemetry.Leve if cfgLevel <= srvLevel { return meter } - return noop.Meter{} + return noopmetric.Meter{} } diff --git a/processor/batchprocessor/internal/metadata/generated_telemetry.go b/processor/batchprocessor/internal/metadata/generated_telemetry.go index 01b879e5d47..77d69ddde62 100644 --- a/processor/batchprocessor/internal/metadata/generated_telemetry.go +++ b/processor/batchprocessor/internal/metadata/generated_telemetry.go @@ -7,7 +7,7 @@ import ( "errors" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" + noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/collector/component" @@ -105,5 +105,5 @@ func getLeveledMeter(meter metric.Meter, cfgLevel, srvLevel configtelemetry.Leve if cfgLevel <= srvLevel { return meter } - return noop.Meter{} + return noopmetric.Meter{} } diff --git a/processor/memorylimiterprocessor/internal/metadata/generated_telemetry.go b/processor/memorylimiterprocessor/internal/metadata/generated_telemetry.go index e4d64ec3cc9..619a63db9ed 100644 --- a/processor/memorylimiterprocessor/internal/metadata/generated_telemetry.go +++ b/processor/memorylimiterprocessor/internal/metadata/generated_telemetry.go @@ -6,7 +6,7 @@ import ( "errors" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" + noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/collector/component" @@ -96,5 +96,5 @@ func getLeveledMeter(meter metric.Meter, cfgLevel, srvLevel configtelemetry.Leve if cfgLevel <= srvLevel { return meter } - return noop.Meter{} + return noopmetric.Meter{} } diff --git a/processor/processorhelper/internal/metadata/generated_telemetry.go b/processor/processorhelper/internal/metadata/generated_telemetry.go index 0cc9d5c5245..06ad630679b 100644 --- a/processor/processorhelper/internal/metadata/generated_telemetry.go +++ b/processor/processorhelper/internal/metadata/generated_telemetry.go @@ -6,7 +6,7 @@ import ( "errors" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" + noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/collector/component" @@ -68,5 +68,5 @@ func getLeveledMeter(meter metric.Meter, cfgLevel, srvLevel configtelemetry.Leve if cfgLevel <= srvLevel { return meter } - return noop.Meter{} + return noopmetric.Meter{} } diff --git a/receiver/receiverhelper/internal/metadata/generated_telemetry.go b/receiver/receiverhelper/internal/metadata/generated_telemetry.go index 0600af1470a..17955ac81e6 100644 --- a/receiver/receiverhelper/internal/metadata/generated_telemetry.go +++ b/receiver/receiverhelper/internal/metadata/generated_telemetry.go @@ -6,7 +6,7 @@ import ( "errors" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" + noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/collector/component" @@ -96,5 +96,5 @@ func getLeveledMeter(meter metric.Meter, cfgLevel, srvLevel configtelemetry.Leve if cfgLevel <= srvLevel { return meter } - return noop.Meter{} + return noopmetric.Meter{} } diff --git a/receiver/scraperhelper/internal/metadata/generated_telemetry.go b/receiver/scraperhelper/internal/metadata/generated_telemetry.go index 8e01bc1d74b..c9f15214367 100644 --- a/receiver/scraperhelper/internal/metadata/generated_telemetry.go +++ b/receiver/scraperhelper/internal/metadata/generated_telemetry.go @@ -6,7 +6,7 @@ import ( "errors" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" + noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/collector/component" @@ -68,5 +68,5 @@ func getLeveledMeter(meter metric.Meter, cfgLevel, srvLevel configtelemetry.Leve if cfgLevel <= srvLevel { return meter } - return noop.Meter{} + return noopmetric.Meter{} } diff --git a/service/internal/metadata/generated_telemetry.go b/service/internal/metadata/generated_telemetry.go index e8d2360a85d..a180db3c3f0 100644 --- a/service/internal/metadata/generated_telemetry.go +++ b/service/internal/metadata/generated_telemetry.go @@ -7,7 +7,7 @@ import ( "errors" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" + noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/collector/component" @@ -175,5 +175,5 @@ func getLeveledMeter(meter metric.Meter, cfgLevel, srvLevel configtelemetry.Leve if cfgLevel <= srvLevel { return meter } - return noop.Meter{} + return noopmetric.Meter{} }