Skip to content

Cannot capture spans when the method arguments include Kotlin value classes #13060

@sato9818

Description

@sato9818

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

@JvmInline
value class UserId(val id: Int)
package com.example.trace.grpc.usecase

import com.example.trace.grpc.domain.model.User
import com.example.trace.grpc.domain.model.UserId
import com.example.trace.grpc.repository.UserRepository
import org.springframework.stereotype.Component

@Component
class GetUserUseCase(
    private val userRepository: UserRepository
) {
    suspend fun getUser(userId: Int): User {
        return userRepository.getUser(userId)
    }

    suspend fun getUserWithValueClass(userId: UserId): User {
        return userRepository.getUser(userId.id)
    }
}
otel.instrumentation.methods.include=com.example.trace.grpc.usecase.GetUserUseCase[getUser,getUserWithValueClass]

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions