GoogleCloudPlatform / opentelemetry-operations-go

Apache License 2.0
130 stars 100 forks source link

Align with new Otel metrics release #629

Closed marcusthelin closed 1 year ago

marcusthelin commented 1 year ago

The v0.38.0 release of metrics has made some changes. I get the below error.

could not import github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric (-: # github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric
../../../../../../go/pkg/mod/github.com/!google!cloud!platform/opentelemetry-operations-go/exporter/metric@v0.37.1/metric.go:338:7: cannot use generic type "go.opentelemetry.io/otel/sdk/metric/metricdata".Histogram[N int64 | float64] without instantiation
../../../../../../go/pkg/mod/github.com/!google!cloud!platform/opentelemetry-operations-go/exporter/metric@v0.37.1/metric.go:392:7: cannot use generic type "go.opentelemetry.io/otel/sdk/metric/metricdata".Histogram[N int64 | float64] without instantiation
../../../../../../go/pkg/mod/github.com/!google!cloud!platform/opentelemetry-operations-go/exporter/metric@v0.37.1/metric.go:489:7: cannot use generic type "go.opentelemetry.io/otel/sdk/metric/metricdata".Histogram[N int64 | float64] without instantiation
../../../../../../go/pkg/mod/github.com/!google!cloud!platform/opentelemetry-operations-go/exporter/metric@v0.37.1/metric.go:569:34: cannot use generic type "go.opentelemetry.io/otel/sdk/metric/metricdata".HistogramDataPoint[N int64 | float64] without instantiation
../../../../../../go/pkg/mod/github.com/!google!cloud!platform/opentelemetry-operations-go/exporter/metric@v0.37.1/metric.go:609:28: cannot use generic type "go.opentelemetry.io/otel/sdk/metric/metricdata".HistogramDataPoint[N int64 | float64] without instantiation
../../../../../../go/pkg/mod/github.com/!google!cloud!platform/opentelemetry-operations-go/exporter/metric@v0.37.1/cloudmonitoring.go:48:9: cannot use newMetricExporter(&o) (value of type *metricExporter) as "go.opentelemetry.io/otel/sdk/metric".Exporter value in return statement: *metricExporter does not implement "go.opentelemetry.io/otel/sdk/metric".Exporter (wrong type for method Export)
damemi commented 1 year ago

This looks like it's still depending on v0.37.1 somewhere, maybe that is causing the conflict: opentelemetry-operations-go/exporter/metric@v0.37.1

Could you share your go.mod file?

marcusthelin commented 1 year ago

This looks like it's still depending on v0.37.1 somewhere, maybe that is causing the conflict: opentelemetry-operations-go/exporter/metric@v0.37.1

Could you share your go.mod file?

I tried updating Opentelemetry, which caused this error. All opentelemetry related dependencies in our go.mod file is up-to-date but the exporter is not updated which is causing this error.

module xxxxxxx

go 1.20

require (
    cloud.google.com/go/profiler v0.3.1
    cloud.google.com/go/pubsub v1.28.0
    cloud.google.com/go/spanner v1.45.1
    github.com/99designs/gqlgen v0.17.20
    github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.37.1
    github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.13.1
    github.com/go-chi/chi/v5 v5.0.8
    github.com/go-chi/cors v1.2.1
    github.com/go-playground/validator/v10 v10.13.0
    github.com/google/uuid v1.3.0
    github.com/klauspost/compress v1.16.5
    github.com/lmittmann/tint v0.3.2
    github.com/marcw/cachecontrol v0.0.0-20140722115028-30341fe9a7d5
    github.com/ory/dockertest/v3 v3.10.0
    github.com/redis/go-redis/extra/redisotel/v9 v9.0.2
    github.com/redis/go-redis/v9 v9.0.4
    github.com/riandyrn/otelchi v0.5.1
    github.com/spider-pigs/envlookup v1.3.0
    github.com/stretchr/testify v1.8.2
    github.com/unrolled/secure v1.13.0
    github.com/vektah/gqlparser/v2 v2.5.1
    go.opentelemetry.io/otel v1.15.1
    go.opentelemetry.io/otel/metric v0.38.1
    go.opentelemetry.io/otel/sdk v1.15.1
    go.opentelemetry.io/otel/sdk/metric v0.38.1
    go.opentelemetry.io/otel/trace v1.15.1
    golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53
    google.golang.org/api v0.114.0
)

require (
    cloud.google.com/go v0.110.0 // indirect
    cloud.google.com/go/compute v1.18.0 // indirect
    cloud.google.com/go/compute/metadata v0.2.3 // indirect
    cloud.google.com/go/iam v0.12.0 // indirect
    cloud.google.com/go/logging v1.7.0 // indirect
    cloud.google.com/go/longrunning v0.4.1 // indirect
    cloud.google.com/go/monitoring v1.12.0 // indirect
    cloud.google.com/go/secretmanager v1.10.0 // indirect
    cloud.google.com/go/trace v1.8.0 // indirect
    github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
    github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.37.1 // indirect
    github.com/Microsoft/go-winio v0.6.1 // indirect
    github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
    github.com/agnivade/levenshtein v1.1.1 // indirect
    github.com/alecthomas/kong v0.7.1 // indirect
    github.com/cenkalti/backoff/v4 v4.2.1 // indirect
    github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect
    github.com/cespare/xxhash/v2 v2.2.0 // indirect
    github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe // indirect
    github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195 // indirect
    github.com/containerd/continuity v0.3.0 // indirect
    github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
    github.com/davecgh/go-spew v1.1.1 // indirect
    github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
    github.com/docker/cli v23.0.5+incompatible // indirect
    github.com/docker/docker v23.0.5+incompatible // indirect
    github.com/docker/go-connections v0.4.0 // indirect
    github.com/docker/go-units v0.5.0 // indirect
    github.com/envoyproxy/go-control-plane v0.11.0 // indirect
    github.com/envoyproxy/protoc-gen-validate v0.10.0 // indirect
    github.com/felixge/httpsnoop v1.0.2 // indirect
    github.com/go-jose/go-jose/v3 v3.0.0 // indirect
    github.com/go-logr/logr v1.2.4 // indirect
    github.com/go-logr/stdr v1.2.2 // indirect
    github.com/go-playground/locales v0.14.1 // indirect
    github.com/go-playground/universal-translator v0.18.1 // indirect
    github.com/gogo/protobuf v1.3.2 // indirect
    github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
    github.com/golang/protobuf v1.5.3 // indirect
    github.com/google/go-cmp v0.5.9 // indirect
    github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 // indirect
    github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
    github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
    github.com/googleapis/gax-go/v2 v2.7.1 // indirect
    github.com/gorilla/websocket v1.5.0 // indirect
    github.com/hashicorp/golang-lru v0.5.4 // indirect
    github.com/imdario/mergo v0.3.15 // indirect
    github.com/joho/godotenv v1.5.1 // indirect
    github.com/leodido/go-urn v1.2.3 // indirect
    github.com/lib/pq v1.10.7 // indirect
    github.com/mitchellh/mapstructure v1.5.0 // indirect
    github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
    github.com/opencontainers/go-digest v1.0.0 // indirect
    github.com/opencontainers/image-spec v1.0.2 // indirect
    github.com/opencontainers/runc v1.1.7 // indirect
    github.com/pkg/errors v0.9.1 // indirect
    github.com/pmezard/go-difflib v1.0.0 // indirect
    github.com/redis/go-redis/extra/rediscmd/v9 v9.0.2 // indirect
    github.com/russross/blackfriday/v2 v2.1.0 // indirect
    github.com/sirupsen/logrus v1.9.0 // indirect
    github.com/urfave/cli/v2 v2.8.1 // indirect
    github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
    github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
    github.com/xeipuuv/gojsonschema v1.2.0 // indirect
    github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
    go.opencensus.io v0.24.0 // indirect
    go.opentelemetry.io/contrib v1.0.0 // indirect
    go.uber.org/atomic v1.10.0 // indirect
    go.uber.org/multierr v1.8.0 // indirect
    golang.org/x/crypto v0.7.0 // indirect
    golang.org/x/mod v0.10.0 // indirect
    golang.org/x/net v0.9.0 // indirect
    golang.org/x/oauth2 v0.6.0 // indirect
    golang.org/x/sync v0.1.0 // indirect
    golang.org/x/sys v0.7.0 // indirect
    golang.org/x/text v0.9.0 // indirect
    golang.org/x/tools v0.8.0 // indirect
    golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
    google.golang.org/appengine v1.6.7 // indirect
    google.golang.org/genproto v0.0.0-20230320184635-7606e756e683 // indirect
    google.golang.org/grpc v1.55.0 // indirect
    google.golang.org/protobuf v1.30.0 // indirect
    gopkg.in/yaml.v2 v2.4.0 // indirect
    gopkg.in/yaml.v3 v3.0.1 // indirect
)
damemi commented 1 year ago

@marcusthelin ah sorry, I misunderstood the issue. We have a PR in progress to update to the latest otel libraries, and we'll publish a new release once that merges https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/620

marcusthelin commented 1 year ago

No worries @damemi! Thanks for the info!

damemi commented 1 year ago

No problem, I'm going to keep this issue open to track the bump

damemi commented 1 year ago

New release is now available (v0.38.0/v1.14.0) which should work with the OTel tags here (0.38.1/1.15.1). Closing this.

We'll follow up with another release to catch up fully to otel as suggested in https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/620#issuecomment-1558359453