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

Index out of bounds when using gRPC UnaryCallInterceptor #682

Closed
stefanprisca opened this issue Apr 30, 2020 · 3 comments · Fixed by #683
Closed

Index out of bounds when using gRPC UnaryCallInterceptor #682

stefanprisca opened this issue Apr 30, 2020 · 3 comments · Fixed by #683
Labels
bug Something isn't working

Comments

@stefanprisca
Copy link
Contributor

I tried out the new gRPC UnaryClientInterceptor, and got this error when making a call from the client:

panic: runtime error: index out of range [1] with length 0

goroutine 1 [running]:
go.opentelemetry.io/otel/plugin/grpctrace.serviceFromFullMethod(0x9b7ae8, 0x12, 0x2, 0xc0000ad260)
/home/stefan/go/pkg/mod/go.opentelemetry.io/otel@v0.4.3/plugin/grpctrace/interceptor.go:434 +0xc2
go.opentelemetry.io/otel/plugin/grpctrace.UnaryClientInterceptor.func1(0xa74aa0, 0xc0000a2000, 0x9b7ae8, 0x12, 0x974260, 0xc0000c6f40, 0x974360, 0xc000150f30, 0xc00019c380, 0x9d4c60, ...)
/home/stefan/go/pkg/mod/go.opentelemetry.io/otel@v0.4.3/plugin/grpctrace/interceptor.go:77 +0x1bc

I believe that the issue is with the regexp used to extract the service name from the full gRPC method name:
^/\S*\.(\S*)/\S*$ which seems to look for a fully qualified service name.
In my case, the full method name is simply /Lightpeer/Persist, so the regexp won't find anything.

I'm not sure if this is an issue on my side or not, but a possible fix can be to replace the regexp with ^/(?:\S*\.)?(\S*)/\S*$, making it optional to have a fully qualified service name. Specifically, see this commit.

@MrAlias MrAlias added the bug Something isn't working label Apr 30, 2020
@stefanprisca
Copy link
Contributor Author

I'm looking now at the specification and it says that

Span name MUST be full gRPC method name formatted as: $package.$service/$method

Is this some hard requirement? Because in this case there might be something wrong on my side (maybe when generating the grpc packages?)

@MrAlias
Copy link
Contributor

MrAlias commented Apr 30, 2020

I'm looking now at the specification and it says that

Span name MUST be full gRPC method name formatted as: $package.$service/$method

Is this some hard requirement? Because in this case there might be something wrong on my side (maybe when generating the grpc packages?)

It looks like the spec is incorrect in that normative assertion. The gRPC protocol does not define the service name in that fashion. It seems like an added restriction of the OpenTelemetry specification, and I don't think it is justified.

I'll open an Issue there.

@kevinjqiu
Copy link

kevinjqiu commented May 4, 2020

I'm hitting this issue as well. Is there a workaround in the meantime?

EDIT: I guess the workaround is to do what @stefanprisca did and use the replace directly in my go.mod file.

@MrAlias MrAlias linked a pull request May 4, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants