uptrace / opentelemetry-go-extra

OpenTelemetry instrumentations for Go
https://uptrace.dev/get/instrument/
BSD 2-Clause "Simplified" License
314 stars 72 forks source link

chore: bump otelsql to use opentelemetry-go v1.15.1/v0.38.1 #102

Closed reenjii closed 1 year ago

reenjii commented 1 year ago

Fix #101

The latest opentelemetry-go release v1.15.0/v0.38.0 introduces a breaking change that breaks otelsql. We need to use new metric.WithAttributes helper to build an ObserveOption list from a KeyValue list.

The measurement methods for all instruments in go.opentelemetry.io/otel/metric/instrument accept an option instead of the variadic "go.opentelemetry.io/otel/attribute".KeyValue

Latest opentelemetry-go release: https://github.com/open-telemetry/opentelemetry-go/pull/4035 Breaking change: https://github.com/open-telemetry/opentelemetry-go/pull/3971

batazor commented 1 year ago

@reenjii Hi! It looks like we need to update the dependencies

go: updates to go.mod needed; to update it:
go mod tidy
reenjii commented 1 year ago

Hello @batazor !

Thanks, indeed I run a go mod tidy in all packages but it seems not enough. I have trouble with the examples folders.

For example when running go mod tidy from uptrace/opentelemetry-go-extra/otelgorm/example

go: finding module for package go.opentelemetry.io/otel/metric/unit
github.com/uptrace/opentelemetry-go-extra/otelgorm/example imports
        github.com/uptrace/opentelemetry-go-extra/otelplay imports
        github.com/uptrace/uptrace-go/uptrace imports
        go.opentelemetry.io/contrib/instrumentation/runtime imports
        go.opentelemetry.io/otel/metric/unit: module go.opentelemetry.io/otel/metric@latest found (v0.38.0), but does not contain package go.opentelemetry.io/otel/metric/unit

I'll try to solve this when I have some time but if you have an idea let me know :)

reenjii commented 1 year ago

Hey @batazor !

I managed to update properly all modules and got it working.

But opentelemetry-go no longer supports go 1.18 (relies on 1.19 feature https://pkg.go.dev/sync/atomic#Pointer ) so I guess you should remove the 1.18.x build check :+1:

Let me know if this looks good to you!

batazor commented 1 year ago

@reenjii Thanks, this is the last library that is preventing me from completing the migration to the new version of the libraries, I hope this PR will be accepted soon

@vmihailenco Apparently, the minimum version of Go must be up.