-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
undefined: otel.Meter or cannot find package "go.opentelemetry.io/otel/api/trace" #1534
Comments
go get -u go.opentelemetry.io/otel/apils I got this error when initializing the module and downloading all dependencies: |
@vmihailenco you don't need to install go.opentelemetry.io/otel/apils. And you have typo in the name. |
Thanks for answering in such a short time... I appreciate that |
I don't understand what you are trying to do. To install go-redis you don't need opentelemetry: mkdir /tmp/redis-test
cd /tmp/redis-test
go mod init redis-test
go get github.com/go-redis/redis/v8 |
Sorry if ai'm not clear: |
Yes, I also get this error when installing packages. |
Actually,, your suggestion worked! if you need the fixed code while the fix gets implemented in the oficial repository, i can share it... |
I have same error:
Base image: |
Output:
|
Our GitHub actions also stopped working randomly because of this. Why is this issue closed? It's a problem even with the last version... |
@lululombard I run init module for current project
with
in main.go:
file go.mod automatically generated:
And I fix this problem for me. |
I have no idea how a golang project should be set up, but I have EDIT: I found some doc and set up my environment properly and now it works! |
I just want the old version back, I don't want to change anything I believe stuff should not break like this without releasing a v9 |
Hi Guys, In my docker-compose settings i had and t worked fine. Now it stopped to work. I tried to do `FROM centos:7 AS builder RUN yum install -y wget git && ENV PATH="/usr/local/go/bin:${PATH}" RUN mkdir /tmp/redis-test && It is executed fie but than my app compilation fails with the error
So, what else can i do? If that module is installed, where is it? do i need to change my code too? Do i need to have something like ?
this also doesn't work. |
@Gelembjuk Your envs are causing the issue. You can try this: copy the code of your app into the same place where the redis mod has been inited and run the compilation inside that folder, since you are using a builder image you are just interested in the output executable anyway (I assume). |
If you want to fix it to work in your PC, i'v posted the changes needed in the code to reflect the changes made in the package that's making the code crash. |
I'm still getting this error... I'm using "github.com/go-redis/redis/v8" and my go.mod has "github.com/go-redis/redis/v8 v8.3.3" Here is my docker log: Step 1/7 : FROM golang:1.15 | ---> 1b8b0ceece59 |
The issue is an old one and the project team has not fixed it yet, even though I have sent them the fix and explain the reasons for the error. This issue arises only on CLEAN development environments. This means on fresh installs or if you clean your existing development environment (I saw the error first on a clean linux install, and then when I cleaned my level environment in a separate machine). Fix:
I hope this helps |
Not fix but close? I run "go mod init ..." then run "go get github.com/go-redis/redis/v8", but it doesn't work. |
any fix for this yet ? UPDATE: my workaround was :
this will revert otel package before the breaking changes |
I fixed this by using @gonzalochief 's suggestion to use |
Current version of this library (
So until
|
Any upcoming due date to see this fixed ? :) |
Facing same issue when trying to update go-redis. |
There is a commit for the bug (1f32092) but there is no release. Force go get to get this commit: |
When I use the workaround solution with replace() dependencies in my go.mod, I encountered "opentelemetry.io/otel/api/trace" dependency error. The solution for that error is adding redis v8 dependency at require() in your go.mod by "go get github.com/go-redis/redis/v8". FYI #1534 |
Anyone else having this issue on version |
I think this issue occurs because they've released the version 1.0.0 rc1 of the otel modules. The quickfix for each individual project is to use The fix for go-redis is to upgrade to otel 1.0.0 RC1. Should we open a new issue or reopen this one ? |
It would help if someone can explain why the build is passing and go-redis is working fine in my (private) projects... I will update the OpenTelemetry version used in go-redis. May be even remove existing metrics - they don't look worth the trouble and we plan to replace them anyway with something more useful. |
@vmihailenco this error occurs when people attempts to update all dependencies (direct and transitive) to the latest version. |
FYI #1805 (comment) |
I only het the error either when I do a clean deploy (new redevelopment machine) or update dependencies. |
To fix
cannot find package "go.opentelemetry.io/otel/api/trace"
orundefined: otel.Meter
:Make sure to initialize a Go module:
go mod init github.com/my/repo
Make sure to use correct import path with v8 in the end:
go get github.com/go-redis/redis/v8
For example:
mkdir /tmp/redis-test cd /tmp/redis-test go mod init redis-test go get github.com/go-redis/redis/v8
The root cause
The error is not caused by OpenTelemetry. OpenTelemetry is just the first module Go tries to install. And the error will not go away until you start using Go modules properly.
The presence of $GOROOT or $GOPATH in error messages indicates that you are NOT using Go modules.
The text was updated successfully, but these errors were encountered: