grafana / k6

A modern load testing tool, using Go and JavaScript - https://k6.io
GNU Affero General Public License v3.0
25.15k stars 1.25k forks source link

OpenTelemetry error installing K6 v0.53.0 #3897

Open IDispose opened 1 month ago

IDispose commented 1 month ago

Brief summary

running go install go.k6.io/k6 spits out this error

# go.opentelemetry.io/otel/sdk/metric
/Users/me/go/pkg/mod/go.opentelemetry.io/otel/sdk/metric@v1.24.0/meter.go:76:22: cannot use (*meter)(nil) (value of type *meter) as "go.opentelemetry.io/otel/metric".Meter value in variable declaration: *meter does not implement "go.opentelemetry.io/otel/metric".Meter (missing method Float64Gauge)
/Users/me/go/pkg/mod/go.opentelemetry.io/otel/sdk/metric@v1.24.0/provider.go:101:9: cannot use mp.meters.Lookup(s, func() *meter {…}) (value of type *meter) as "go.opentelemetry.io/otel/metric".Meter value in return statement: *meter does not implement "go.opentelemetry.io/otel/metric".Meter (missing method Float64Gauge)

k6 version

v0.53.0

OS

macOS Sonoma 14.5

Docker version and image (if applicable)

No response

Steps to reproduce the problem

running go install go.k6.io/k6

Expected behaviour

K6 should be installed without errors

Actual behaviour

# go.opentelemetry.io/otel/sdk/metric
/Users/me/go/pkg/mod/go.opentelemetry.io/otel/sdk/metric@v1.24.0/meter.go:76:22: cannot use (*meter)(nil) (value of type *meter) as "go.opentelemetry.io/otel/metric".Meter value in variable declaration: *meter does not implement "go.opentelemetry.io/otel/metric".Meter (missing method Float64Gauge)
/Users/me/go/pkg/mod/go.opentelemetry.io/otel/sdk/metric@v1.24.0/provider.go:101:9: cannot use mp.meters.Lookup(s, func() *meter {…}) (value of type *meter) as "go.opentelemetry.io/otel/metric".Meter value in return statement: *meter does not implement "go.opentelemetry.io/otel/metric".Meter (missing method Float64Gauge)
olegbespalov commented 1 month ago

Hey @IDispose

Thanks for reporting this!

Unfortunately, I can't reproduce it on my (linux) side. If I run both go install -v go.k6.io/k6@v0.53.0 or go install -v go.k6.io/k6 it works as expected.

image

My colleague also double-checked that it works on Mac OS.

There is a similar report https://github.com/grafana/xk6-output-opentelemetry/issues/21, which was likely caused by a different version of the OTEL libraries pinned in the custom extension.

Could you please confirm that you're using trying to install a stock version of k6, not through the xk6.

Also, out of curiosity, how will result in the installation with the explicit versions, like: go install go.k6.io/k6@v0.53.0 or go install -v go.k6.io/k6@v0.52.0?

Thanks!

IDispose commented 1 month ago

@olegbespalov go install go.k6.io/k6@v0.53.0 works without any errors.

olegbespalov commented 1 month ago

Closing for now; if something else or more details will appear, let's re-open.

mostafa commented 2 weeks ago

When building xk6 modules like xk6-kafka with k6 v0.53.0, the go.opentelemetry.io/otel/sdk/metric@v1.24.0 appears out of the blue in the list of packages. I pinned the v1.28.0 for now, until this issue is resolved. Also, this is the output of go mod graph before pinning the package in this PR:

go.k6.io/k6@v0.53.0 go.opentelemetry.io/otel/sdk/metric@v1.24.0

BTW, this is resolved by pinning the package.

olegbespalov commented 2 weeks ago

hey @mostafa

I'm not quite sure if I got which issue you're referring to 🤷

That's correct that k6 v0.53 brings a few more opentelemetry libraries, and if extensions need an updated version of them that might not work. In the upcoming version of the k6 (the latest master branch), we also updated the libraries as part of https://github.com/grafana/xk6-output-opentelemetry/pull/22.

Could you please maybe provide the steps to reproduce the issue? Thanks!

mostafa commented 2 weeks ago

Hey @olegbespalov,

Here are the steps:

  1. Install the latest version of xk6.
  2. Clone xk6-kafka.
  3. Reset to an older commit (not updated to k6 v0.53.0).
  4. Get the latest k6.
  5. Try to build it.
    go install go.k6.io/xk6/cmd/xk6@latest
    git clone git@github.com:mostafa/xk6-kafka.git && cd xk6-kafka
    git reset --hard 9cbd5bd553d1a1e41064ccb0fc4daf0c0a626b88 # HEAD is now at 9cbd5bd Add FAQ No. 13
    go get go.k6.io/k6@v0.53.0
    go mod tidy
    go mod graph | grep go.opentelemetry.io/otel/sdk/metric # go.k6.io/k6@v0.53.0 go.opentelemetry.io/otel/sdk/metric@v1.24.0
    xk6 build --with github.com/mostafa/xk6-kafka@latest=. # sometimes it builds, sometimes it nags about go.opentelemetry.io/otel/sdk/metric@v1.24.0

I struggled with this yesterday, but it didn't happen today. 🤷 Maybe let's close this.