Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom k6 doesn't compile due to opentelemetry module #21

Closed
agilob opened this issue Aug 13, 2024 · 4 comments
Closed

Custom k6 doesn't compile due to opentelemetry module #21

agilob opened this issue Aug 13, 2024 · 4 comments

Comments

@agilob
Copy link

agilob commented Aug 13, 2024

Hi all,

I wanted to use the new k6 but we have a few custom extensions that we need to build to run perf tests. I tried to bump dependencies of the extensions, but can't compile k6 due to:

2024/08/13 15:46:00 [INFO] exec (timeout=0s): /usr/bin/go build -o /home/agilob/Projects/k6-utils/k6 -ldflags=-w -s -trimpath
# go.opentelemetry.io/otel/sdk/metric
/home/agilob/go/pkg/mod/go.opentelemetry.io/otel/sdk/[email protected]/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)
/home/agilob/go/pkg/mod/go.opentelemetry.io/otel/sdk/[email protected]/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)
2024/08/13 15:46:00 [INFO] Cleaning up temporary folder: /tmp/buildenv_2024-08-13-1545.3210944102
2024/08/13 15:46:00 [FATAL] exit status 1

I'm trying to upgrade k6 in this repo https:/b4dc0d3rs/k6-utils and execute:

xk6 build v0.53.0 \
  --with github.com/b4dc0d3rs/k6-utils=.
@olegbespalov
Copy link
Collaborator

Hey @agilob !

Thanks for report!

I believe it happens because the b4dc0d3rs/k6-utils has opentelemetry library of a higher version than bumped in k6. In any case, we will update the k6's open telemetry soon, so I'll update you here once we merge the PR in k6.

@agilob
Copy link
Author

agilob commented Aug 19, 2024

This was automatically changed by go get -u && go mod tidy

@olegbespalov
Copy link
Collaborator

This was automatically changed by go get -u && go mod tidy

Well, unfortunately, automatic does not always work as we expect 😢

I've opened PR #22, it has not been reviewed and merged, and there may be a couple of things more we'll need to do in k6 itself, but here is a workaround on how to build a k6 --replace "github.com/grafana/xk6-output-opentelemetry=github.com/grafana/xk6-output-opentelemetry@62cb2dc39b1f7b5898fe17ee91adbed1244a113e"

Example:

 docker run --rm -it -v "${PWD}:/xk6" grafana/xk6 build v0.53.0 \
  --replace "github.com/grafana/xk6-output-opentelemetry=github.com/grafana/xk6-output-opentelemetry@62cb2dc39b1f7b5898fe17ee91adbed1244a113e" \
  --with github.com/b4dc0d3rs/k6-utils@main

@olegbespalov
Copy link
Collaborator

I am closing this as the actual k6 master branch now, including all the updates.

@olegbespalov olegbespalov removed their assignment Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants