Describe the bug
According to the documentation @CaptureSpan will automatically set the name of the span to Classname#methodname. When using Scala 2, this works fine for classes but not for objects. For objects, only the #methodname is inferred but the Classname is just missing.
Steps to reproduce
- Use Scala 2.12.18 and
co.elastic.apm:apm-agent-api:1.50.0.
- Create a Scala class and object:
import co.elastic.apm.api.{CaptureSpan, ElasticApm, Transaction}
class Example {
@CaptureSpan
def myClassMethod() = println("Example#myClassMethod")
}
object Example {
@CaptureSpan
def myObjectMethod() = println("Example#myObjectMethod")
}
ElasticApm.startTransaction()
(new Example).myClassMethod()
Example.myObjectMethod()
ElasticApm.stopTransaction()
- Run the code.
- Check your Elastic APM instance for the captured spans.
Expected behavior
Two spans are captured with the names:
Example#myClassMethod
Example#myObjectMethod
Debug logs
n/a
Describe the bug
According to the documentation
@CaptureSpanwill automatically set the name of the span toClassname#methodname. When using Scala 2, this works fine for classes but not for objects. For objects, only the#methodnameis inferred but theClassnameis just missing.Steps to reproduce
co.elastic.apm:apm-agent-api:1.50.0.Expected behavior
Two spans are captured with the names:
Example#myClassMethodExample#myObjectMethodDebug logs
n/a