diff --git a/.golangci.yml b/.golangci.yml index 474a8891c9c..82da4bd5dd0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -78,6 +78,8 @@ linters-settings: no-sdk-instrumentation: files: - "**/*/{bridges,instrumentation}/**/*.go" + - "!**/*/bridges/prometheus/*.go" # prometheus bridge is meant to use the SDK + - "!**/*/instrumentation/runtime/*.go" # runtime instrumentation is meant to use the SDK - "!**/*test/*.go" - "!**/*test/**/*.go" - "!**/*example/*.go" diff --git a/bridges/prometheus/example_test.go b/bridges/prometheus/example_test.go index 92412c78d0b..2f8dd5b48b4 100644 --- a/bridges/prometheus/example_test.go +++ b/bridges/prometheus/example_test.go @@ -5,7 +5,7 @@ package prometheus_test import ( "go.opentelemetry.io/contrib/bridges/prometheus" - "go.opentelemetry.io/otel/sdk/metric" //nolint:depguard + "go.opentelemetry.io/otel/sdk/metric" ) func ExampleNewMetricProducer() { diff --git a/bridges/prometheus/producer.go b/bridges/prometheus/producer.go index 3e58a81889d..e94d07a6d46 100644 --- a/bridges/prometheus/producer.go +++ b/bridges/prometheus/producer.go @@ -16,9 +16,9 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/instrumentation" //nolint:depguard - "go.opentelemetry.io/otel/sdk/metric" //nolint:depguard - "go.opentelemetry.io/otel/sdk/metric/metricdata" //nolint:depguard + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" ) const ( diff --git a/bridges/prometheus/producer_test.go b/bridges/prometheus/producer_test.go index 664bf95e1a2..801fe27dd23 100644 --- a/bridges/prometheus/producer_test.go +++ b/bridges/prometheus/producer_test.go @@ -13,9 +13,9 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/instrumentation" //nolint:depguard - "go.opentelemetry.io/otel/sdk/metric/metricdata" //nolint:depguard - "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" //nolint:depguard + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) const ( diff --git a/instrumentation/runtime/example_test.go b/instrumentation/runtime/example_test.go index a20947ded4b..08a438bcf6a 100644 --- a/instrumentation/runtime/example_test.go +++ b/instrumentation/runtime/example_test.go @@ -10,7 +10,7 @@ import ( "go.opentelemetry.io/contrib/instrumentation/runtime" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/sdk/metric" //nolint:depguard + "go.opentelemetry.io/otel/sdk/metric" ) func Example() { diff --git a/instrumentation/runtime/producer.go b/instrumentation/runtime/producer.go index 56250937114..0697208db98 100644 --- a/instrumentation/runtime/producer.go +++ b/instrumentation/runtime/producer.go @@ -12,9 +12,9 @@ import ( "time" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/instrumentation" //nolint:depguard // We rely on instrumentation.Scope. - "go.opentelemetry.io/otel/sdk/metric" //nolint:depguard // We rely on metric.Producer. - "go.opentelemetry.io/otel/sdk/metric/metricdata" // nolint:depguard // We rely on metricdata. + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" ) var startTime time.Time diff --git a/instrumentation/runtime/test/producer_test.go b/instrumentation/runtime/producer_test.go similarity index 88% rename from instrumentation/runtime/test/producer_test.go rename to instrumentation/runtime/producer_test.go index f885300409e..1e467928c5e 100644 --- a/instrumentation/runtime/test/producer_test.go +++ b/instrumentation/runtime/producer_test.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package test +package runtime // import "go.opentelemetry.io/contrib/instrumentation/runtime" import ( "context" @@ -10,7 +10,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/contrib/instrumentation/runtime" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -18,7 +17,7 @@ import ( ) func TestNewProducer(t *testing.T) { - reader := metric.NewManualReader(metric.WithProducer(runtime.NewProducer())) + reader := metric.NewManualReader(metric.WithProducer(NewProducer())) _ = metric.NewMeterProvider(metric.WithReader(reader)) rm := metricdata.ResourceMetrics{} err := reader.Collect(context.Background(), &rm) @@ -29,7 +28,7 @@ func TestNewProducer(t *testing.T) { expectedScopeMetric := metricdata.ScopeMetrics{ Scope: instrumentation.Scope{ Name: "go.opentelemetry.io/contrib/instrumentation/runtime", - Version: runtime.Version(), + Version: Version(), }, Metrics: []metricdata.Metrics{ { diff --git a/instrumentation/runtime/runtime_test.go b/instrumentation/runtime/runtime_test.go index 3726c9586df..78b3b52b784 100644 --- a/instrumentation/runtime/runtime_test.go +++ b/instrumentation/runtime/runtime_test.go @@ -15,10 +15,10 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/instrumentation" //nolint:depguard - "go.opentelemetry.io/otel/sdk/metric" //nolint:depguard - "go.opentelemetry.io/otel/sdk/metric/metricdata" //nolint:depguard - "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" //nolint:depguard + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) func TestRefreshGoCollector(t *testing.T) { diff --git a/instrumentation/runtime/test/go.mod b/instrumentation/runtime/test/go.mod deleted file mode 100644 index 5f673337aea..00000000000 --- a/instrumentation/runtime/test/go.mod +++ /dev/null @@ -1,23 +0,0 @@ -module go.opentelemetry.io/contrib/instrumentation/runtime/test - -go 1.22 - -require ( - github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/contrib/instrumentation/runtime v0.55.0 - go.opentelemetry.io/otel/sdk v1.30.0 - go.opentelemetry.io/otel/sdk/metric v1.30.0 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.4.2 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel v1.30.0 // indirect - go.opentelemetry.io/otel/metric v1.30.0 // indirect - go.opentelemetry.io/otel/trace v1.30.0 // indirect - golang.org/x/sys v0.25.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) diff --git a/instrumentation/runtime/test/go.sum b/instrumentation/runtime/test/go.sum deleted file mode 100644 index 11bd11657d4..00000000000 --- a/instrumentation/runtime/test/go.sum +++ /dev/null @@ -1,33 +0,0 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= -github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -go.opentelemetry.io/contrib/instrumentation/runtime v0.55.0 h1:GotCpbh7YkCHdFs+hYMdvAEyGsBZifFognqrOnBwyJM= -go.opentelemetry.io/contrib/instrumentation/runtime v0.55.0/go.mod h1:6b0AS55EEPj7qP44khqF5dqTUq+RkakDMShFaW1EcA4= -go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= -go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= -go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= -go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= -go.opentelemetry.io/otel/sdk v1.30.0 h1:cHdik6irO49R5IysVhdn8oaiR9m8XluDaJAs4DfOrYE= -go.opentelemetry.io/otel/sdk v1.30.0/go.mod h1:p14X4Ok8S+sygzblytT1nqG98QG2KYKv++HE0LY/mhg= -go.opentelemetry.io/otel/sdk/metric v1.30.0 h1:QJLT8Pe11jyHBHfSAgYH7kEmT24eX792jZO1bo4BXkM= -go.opentelemetry.io/otel/sdk/metric v1.30.0/go.mod h1:waS6P3YqFNzeP01kuo/MBBYqaoBJl7efRQHOaydhy1Y= -go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= -go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=