OpenTelemetry missing packages

10.9k views Asked by At

I am getting following error in my Go project. I am using go mod to manage dependencies. It looks like the latest version of opentelemetry doesn't specific packages. But how should I fix them

go get ./...                           
go: finding module for package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/collector/trace/v1
go: finding module for package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/collector/metrics/v1
go: finding module for package go.opentelemetry.io/otel/api/label
go: finding module for package go.opentelemetry.io/otel/api/standard
go: finding module for package go.opentelemetry.io/otel/instrumentation/othttp
go: finding module for package go.opentelemetry.io/otel/api/kv
go: finding module for package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/trace/v1
go: finding module for package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/common/v1
go: finding module for package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/resource/v1
go: finding module for package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/metrics/v1
go: finding module for package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/collector/trace/v1
go: finding module for package go.opentelemetry.io/otel/api/kv
go: finding module for package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/collector/metrics/v1
go: finding module for package go.opentelemetry.io/otel/api/standard
go: finding module for package go.opentelemetry.io/otel/instrumentation/othttp
go: finding module for package go.opentelemetry.io/otel/api/label
go: finding module for package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/metrics/v1
go: finding module for package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/resource/v1
go: finding module for package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/common/v1
go: finding module for package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/trace/v1
pkg/tracing/opentelemetry.go:10:2: module go.opentelemetry.io/otel@latest found (v0.13.0), but does not contain package go.opentelemetry.io/otel/api/kv
../go/pkg/mod/go.opentelemetry.io/otel/exporters/[email protected]/internal/transform/metric.go:30:2: module go.opentelemetry.io/otel@latest found (v0.13.0), but does not contain package go.opentelemetry.io/otel/api/label
pkg/tracing/opentelemetry.go:12:2: module go.opentelemetry.io/otel@latest found (v0.13.0), but does not contain package go.opentelemetry.io/otel/api/standard
../go/pkg/mod/go.opentelemetry.io/otel/exporters/[email protected]/otlp.go:28:2: module go.opentelemetry.io/otel@latest found (v0.13.0), but does not contain package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/collector/metrics/v1
../go/pkg/mod/go.opentelemetry.io/otel/exporters/[email protected]/otlp.go:29:2: module go.opentelemetry.io/otel@latest found (v0.13.0), but does not contain package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/collector/trace/v1
../go/pkg/mod/go.opentelemetry.io/otel/exporters/[email protected]/internal/transform/attribute.go:18:2: module go.opentelemetry.io/otel@latest found (v0.13.0), but does not contain package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/common/v1
../go/pkg/mod/go.opentelemetry.io/otel/exporters/[email protected]/internal/transform/metric.go:27:2: module go.opentelemetry.io/otel@latest found (v0.13.0), but does not contain package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/metrics/v1
../go/pkg/mod/go.opentelemetry.io/otel/exporters/[email protected]/internal/transform/metric.go:28:2: module go.opentelemetry.io/otel@latest found (v0.13.0), but does not contain package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/resource/v1
../go/pkg/mod/go.opentelemetry.io/otel/exporters/[email protected]/internal/transform/span.go:20:2: module go.opentelemetry.io/otel@latest found (v0.13.0), but does not contain package go.opentelemetry.io/otel/internal/opentelemetry-proto-gen/trace/v1
pkg/home/net/http/fw_handlers.go:11:2: module go.opentelemetry.io/otel@latest found (v0.13.0), but does not contain package go.opentelemetry.io/otel/instrumentation/othttp
2

There are 2 answers

0
garvan On

I was running into a similar issue and thoroughly cleaning the cache did the trick. Again, I believe this removes all the packages from your system so use with caution:

go clean -cache -modcache -i -r
0
风吹过的烟花 On

I also have similar error.

go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp imports
go.opentelemetry.io/otel/metric/global: module go.opentelemetry.io/otel/metric@latest found (v1.16.0), but does not contain package go.opentelemetry.io/otel/metric/global

go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp imports
go.opentelemetry.io/otel/metric/instrument: module go.opentelemetry.io/otel/metric@latest found (v1.16.0), but does not contain package go.opentelemetry.io/otel/metric/instrument

go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0 in go.mod

my solution

upgrade go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp

go get go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@latest

problem solved.

The reason is that the child dependency version upgrade needs to upgrade the parent dependency.