Отсутствующие пакеты OpenTelemetry
В моем проекте Go появляется следующая ошибка. Я использую
go mod
для управления зависимостями. Похоже, последняя версия
opentelemetry
не содержит конкретных пакетов. Но как мне их исправить
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/otlp@v0.10.0/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/otlp@v0.10.0/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/otlp@v0.10.0/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/otlp@v0.10.0/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/otlp@v0.10.0/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/otlp@v0.10.0/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/otlp@v0.10.0/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 ответа
У меня тоже похожая ошибка.
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
в go.mod
мое решение
обновлениеgo.opentelemetry.io/contrib/instrumentation/net/http/otelhttp
go get go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@latest
задача решена.
Причина в том, что обновление версии дочерней зависимости требует обновления родительской зависимости.
Я столкнулся с подобной проблемой, и тщательная очистка кеша помогла. Опять же, я считаю, что это удаляет все пакеты из вашей системы, поэтому используйте с осторожностью:
go clean -cache -modcache -i -r