[Java] Using Spring Data Mongo Reactive Swallow the subsequent chain stack

I am using spring boot 2.0 and webflux.

It is know the current Java agent 6.0 doesn’t support Mongo db reactive driver yet.
However when you have a chain something like the following:

mongoReactiveRepo.save(someData).map(e -> doSomethingReturnMono.doEvent(someData))
            .flatMap(a -> something.doReturnMono())

In the transaction you will get something like this:

However, removing the repo (without the unsuported mongo reactive) you will get

As you can see you can see the stack number 1 and 4.

I expected if even you use the unsupported mongo reactive driver (in the mongoReactiveRepo) it shouldn’t swallow the subsequent operator chain stack metrics.

Please advice if this is a bug or some misconfiguration

Please provide information on your environment, and any further information you believe is relevant, such as the below:

  • APM Agent Language -> Java
  • APM Agent Version -> 6.0.0
  • Operating System -> Mac for now
  • Operating System Version: Mojave
  • Frameworks yoru app is using -> Spring Boot 2.0, Project Reactor, Webclient (reactive) Spring Data Mongo Reactive, mongo reactvie driver

I also tried to do custom instrumentation on the part and still it’s happening.


Tried more case.

Use a sync mongo driver and wrap it with webflux’s schedulers. Something like the following:

Mono.fromCallable(() -> testingRepo.findBySomething()).publishOn(Schedulers.boundedElastic())

Same case. Swallowed. However, removing the schedulers and call the repo directly works.
Other libraries like spring-kafka and reactive feign works

Hi there @khoa.tran -

As you mentioned, you are working within an unsupported area, so we can’t make any definitive statements here about how you can definitely make it work.

That said, one other option you have is our open source Java agent, which would really let you dig in to get exactly what you need:


Thanks. That’s a good option to explore.
I want to point out on something.

I thought in the latest version, webflux suppose to be supported.
One of the feature in webflux is schedulers (underneath it is basically project reactor) , https://projectreactor.io/docs/core/release/reference/#schedulers.

Even with this wrap around synchronous mongo driver, the stack is still being swallowed. Did I assume something that’s not?

Thanks in advance.

Hi there @khoa.tran -

You are correct - we do support webflux. I was referring to your use of the Mongo driver. That said, give us a bit to dig into this to see if this is something awry with the agent behavior.

Thanks @hross. Looking forward for updates and findings. Thanks

@hross, Just to help in the investigation the wrapping is something like this:

Mono.fromCallable(() -> testingRepo.findSomething()).publishOn(Schedulers.boundedElastic())

TestingRepo is using mongo sync driver.