open-telemetry / opentelemetry-go-contrib

Collection of extensions for OpenTelemetry-Go.
https://opentelemetry.io/
Apache License 2.0
1.23k stars 570 forks source link

go get is failing for instrumentation/net/http #785

Closed ahmetb closed 3 years ago

ahmetb commented 3 years ago
$ go get go.opentelemetry.io/contrib/instrumentation/net/http
go.opentelemetry.io/contrib/instrumentation/net/http imports
    go.opentelemetry.io/otel/api/global: cannot find module providing package go.opentelemetry.io/otel/api/global
go.opentelemetry.io/contrib/instrumentation/net/http imports
    go.opentelemetry.io/otel/api/metric: cannot find module providing package go.opentelemetry.io/otel/api/metric
go.opentelemetry.io/contrib/instrumentation/net/http imports
    go.opentelemetry.io/otel/api/propagation: cannot find module providing package go.opentelemetry.io/otel/api/propagation
go.opentelemetry.io/contrib/instrumentation/net/http imports
    go.opentelemetry.io/otel/api/trace: cannot find module providing package go.opentelemetry.io/otel/api/trace
go.opentelemetry.io/contrib/instrumentation/net/http imports
    go.opentelemetry.io/otel/label: cannot find module providing package go.opentelemetry.io/otel/label

go.mod:

module foo

go 1.16

require (
    cloud.google.com/go/firestore v1.5.0
    github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v0.20.0
    github.com/go-redis/redis/v8 v8.8.2
    github.com/go-redis/redismock/v8 v8.0.6
    github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
    github.com/google/go-cmp v0.5.5
    github.com/gorilla/websocket v1.4.2
    github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
    github.com/preichenberger/go-coinbasepro/v2 v2.0.5
    github.com/shopspring/decimal v1.2.0
    github.com/soheilhy/cmux v0.1.5
    github.com/tommy351/zap-stackdriver v0.1.4
    go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0
    go.opentelemetry.io/otel v0.20.0
    go.opentelemetry.io/otel/sdk v0.20.0
    go.opentelemetry.io/otel/trace v0.20.0
    go.uber.org/multierr v1.7.0 // indirect
    go.uber.org/zap v1.16.0
    golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
    golang.org/x/net v0.0.0-20210510120150-4163338589ed // indirect
    golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c // indirect
    golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect
    golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
    golang.org/x/tools v0.1.1 // indirect
    google.golang.org/api v0.46.0
    google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384 // indirect
    google.golang.org/grpc v1.37.1
    google.golang.org/protobuf v1.26.0
    gopkg.in/yaml.v2 v2.4.0 // indirect
)

go version go1.16.3 darwin/amd64

MrAlias commented 3 years ago

Related to the go get command, the instrumentation package is named otelhttp. I'm guessing you are pulling an old package that existed prior to the rename. Can you verify this works?

$ go get go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.20.0

I don't see the go.opentelemetry.io/contrib/instrumentation/net/http listed in the go.mod file you provided. Are you getting an error using that mod file?

ahmetb commented 3 years ago

Ah interesting, I saw the faulty import path at a 3rd party doc https://docs.honeycomb.io/getting-data-in/go/opentelemetry-tutorial/#if-you-dont-use-a-request-router and it was a valid go package. Thanks for answering.