I have a sample application, it is a WebFlux SpringBoot application (SpringBoot version=2.5.3, WebFlux version=5.3.9) embedded an Elastic APM agent (version=1.28.0). Start the Spring WebFlux app:
mvn spring-boot:run -Dspring-boot.run.arguments=--server.port=8085
go to the docker folder: cd ../elastic-apm-java/docker
, run docker-compose up -d
to set up a dev APM server.
Do some controller accessing. then go the Kibana/APM portal.
I found that the Transaction or Span are not recored.
But, I tried another Spring MVC app: elastic-apm-java. After running the app, the go to the Kibana/APM portal, I can see the Transaction or Span are recored.
I am wondering where is the WebFlux APM wrong? Is the version of ES & Kibana not correct? Mismatched with APM agent?
My sample code is here.
Update-1: I have enable the experimental feature in my code.
file: elasticapm.properties under the resources folder, value is: enable_experimental_instrumentations=true
.
When the app start up, it prints log:
[Attach Listener] INFO co.elastic.apm.agent.configuration.StartupInfo - enable_experimental_instrumentations: 'true' (source: Attachment configuration)
So, I think the enable_experimental_instrumentations
is in effect.
Update 2:
I modify the docker-compose.yaml, now the user-microservice
and user-webfluxservice
can run in docker, just start the docker-compose file, then observe the APM dashboard.
It is slightly different, it can display the random
CaptureSpan, but the offset position is the same as the UserController#all, it's not correct.
the corresponding code is:
@CaptureSpan("random")
public int random(int min, int max) {
return new Random().nextInt(max - min) + min;
}