-
Notifications
You must be signed in to change notification settings - Fork 885
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
Cannot capture spans when the method arguments include Kotlin value classes #13060
Comments
@sato9818 could you provide a minimal sample app that reproduces the issue |
Yeah this is lacking some details. "We can't capture spans" is too vague.
|
I was trying to capture spans using Here is the minimal sample app: https://github.com/sato9818/trace-example. ./gradlew app:grpc-spring-server:bootRun Then send a request with: grpcurl -d '{"user_id":"0101"}' -plaintext localhost:9090 com.example.trace.v1.UserService.GetUser The following logs are produced by the OpenTelemetry agent: [otel.javaagent 2025-01-20 09:33:27:264 +0900] [DefaultDispatcher-worker-1] INFO io.opentelemetry.exporter.logging.LoggingSpanExporter - 'UserRepository.getUser' : 4a55ce73c9779f7c11f5514e87185dbb f6e7924771d76b12 INTERNAL [tracer: io.opentelemetry.methods:2.11.0-alpha] AttributesMap{data={code.function=getUser, thread.id=54, code.namespace=com.example.trace.grpc.repository.UserRepository, thread.name=DefaultDispatcher-worker-1}, capacity=128, totalAddedValues=4}
[otel.javaagent 2025-01-20 09:33:27:265 +0900] [DefaultDispatcher-worker-1] INFO io.opentelemetry.exporter.logging.LoggingSpanExporter - 'GetUserUseCase.getUser' : 4a55ce73c9779f7c11f5514e87185dbb 5db0a4de95693d0a INTERNAL [tracer: io.opentelemetry.methods:2.11.0-alpha] AttributesMap{data={code.function=getUser, thread.id=54, code.namespace=com.example.trace.grpc.usecase.GetUserUseCase, thread.name=DefaultDispatcher-worker-1}, capacity=128, totalAddedValues=4}
[otel.javaagent 2025-01-20 09:33:27:267 +0900] [DefaultDispatcher-worker-1] INFO io.opentelemetry.exporter.logging.LoggingSpanExporter - 'UserRepository.getUser' : 4a55ce73c9779f7c11f5514e87185dbb 35c5b1b840876aee INTERNAL [tracer: io.opentelemetry.methods:2.11.0-alpha] AttributesMap{data={code.function=getUser, thread.id=54, code.namespace=com.example.trace.grpc.repository.UserRepository, thread.name=DefaultDispatcher-worker-1}, capacity=128, totalAddedValues=4}
[otel.javaagent 2025-01-20 09:33:27:267 +0900] [DefaultDispatcher-worker-1] INFO io.opentelemetry.exporter.logging.LoggingSpanExporter - 'UserService.getUser' : 4a55ce73c9779f7c11f5514e87185dbb 4c20b7b510853ff4 INTERNAL [tracer: io.opentelemetry.methods:2.11.0-alpha] AttributesMap{data={code.function=getUser, thread.id=54, code.namespace=com.example.trace.grpc.service.UserService, thread.name=DefaultDispatcher-worker-1}, capacity=128, totalAddedValues=4}
[otel.javaagent 2025-01-20 09:33:27:272 +0900] [grpc-default-executor-0] INFO io.opentelemetry.exporter.logging.LoggingSpanExporter - 'com.example.trace.v1.UserService/GetUser' : 4a55ce73c9779f7c11f5514e87185dbb 6526477107bab4c5 SERVER [tracer: io.opentelemetry.grpc-1.6:2.11.0-alpha] AttributesMap{data={rpc.service=com.example.trace.v1.UserService, thread.id=53, rpc.method=GetUser, server.address=localhost, server.port=9090, network.peer.port=54120, rpc.grpc.status_code=0, network.peer.address=127.0.0.1, rpc.system=grpc, thread.name=grpc-default-executor-0, network.type=ipv4}, capacity=128, totalAddedValues=11}
[otel.javaagent 2025-01-20 09:33:27:272 +0900] [grpc-default-executor-0] INFO io.opentelemetry.exporter.logging.LoggingSpanExporter - 'grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo' : 760b4c190df0175721a941ca6d5dfe51 95f73526942fd026 SERVER [tracer: io.opentelemetry.grpc-1.6:2.11.0-alpha] AttributesMap{data={rpc.service=grpc.reflection.v1alpha.ServerReflection, thread.id=53, rpc.method=ServerReflectionInfo, server.address=localhost, server.port=9090, network.peer.port=54120, rpc.grpc.status_code=0, network.peer.address=127.0.0.1, rpc.system=grpc, thread.name=grpc-default-executor-0, network.type=ipv4}, capacity=128, totalAddedValues=11} Despite calling |
With java the mapping from source to bytecode is usually straightforward, with other jvm languages there may be surprises. See https://kotlinlang.org/docs/inline-classes.html#mangling and https://kotlinlang.org/docs/inline-classes.html#calling-from-java-code |
Thank you very much for your detailed investigation! |
yes |
I'll keep track on the issue! |
Describe the bug
I am trying to capture spans for specific methods using the Java agent feature described here. However, I am encountering issues when the method arguments include Kotlin value classes, as the spans are not captured properly.
Steps to reproduce
We can capture a span for the getUser method but not for the getUserWithValueClass method.
Expected behavior
We expect to capture spans even when the method arguments include Kotlin value classes."
Actual behavior
We can't capture the spans when the method arguments include Kotlin value classes.
Javaagent or library instrumentation version
javaagent: v2.11.0
Environment
JDK: Temurin 21.0.5+11
Kotlin: 2.1.0
Additional context
No response
The text was updated successfully, but these errors were encountered: