Execution order of @Timed and @Transactional #33595
Labels
in: data
Issues in data modules (jdbc, orm, oxm, tx)
status: waiting-for-triage
An issue we've not yet triaged or decided on
I use micrometer in a Spring Boot application to measure the execution time of a method.
Given the following (Kotlin) method:
I would expect that the
@Timed
annotation measures the total time that the method execution takes including the@Transactional
handling. I compared it to measuring the time outside, as in the following example:Since the time measuring is different I did some debugging and found out that the underlying
io.micrometer.core.aop.TimedAspect
runs after the@Transactional
processing, which means the order is as follows:What I would like to achieve is the following order:
I already opened an issue at micrometer: micrometer-metrics/micrometer#5235, but they pointed me to the spring-framework issue tracker.
I already tried to use
@DeclarePrecedence
like this +@EnableAspectJAutoProxy
on the@SpringBootApplication
class, but it had no effect.The text was updated successfully, but these errors were encountered: