question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for @Timed in any Spring-managed bean

See original GitHub issue

As of v1.0.0-rc.7 @Timed put on a method of an arbitrary Spring-managed bean is silently ignored. It would be useful to be able to generate metrics for any kind of beans (e.g. Services with non-RestTemplate remote system calls) without writing a custom AOP logic.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:13
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
jkschneidercommented, Feb 19, 2018

The TimedAspect aspect now exists in micrometer-core, but will not be autoconfigured in Spring Boot 2 or micrometer-spring-legacy. We can revisit application of @Timed via AOP or a BPP in Boot 2.1, depending on how the community reacts to the feature.

To configure manually:

@Configuration
@EnableAspectJAutoProxy
public class AutoTimingConfiguration {
   @Bean
   public TimedAspect timedAspect(MeterRegistry registry) {
      return new TimedAspect(registry);
   }
}
2reactions
ben-manescommented, Aug 28, 2018

Is there a reason why AspectJ was used instead of AOP Alliance? Both are supported by Spring, but only AOP Alliance is by Guice. Spring Transactions uses AOP Alliance (TransactionInterceptor), making it easy to leverage in Guice w/o Spring IoC.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to instantiate Spring managed beans at runtime?
here is the solution to create multiple prototype beans in one method, not pretty looking but should work, I autowired container in RuntimeBean...
Read more >
Super simple approach to accessing Spring beans from non ...
method which returns the Spring managed bean instance of a service class (in this case) that any POJO class can access. In the...
Read more >
33. Task Execution and Scheduling - Spring
The Spring Framework provides abstractions for asynchronous execution and scheduling of tasks with the TaskExecutor and TaskScheduler interfaces, ...
Read more >
Managed beans using @Component, @Repository, @Service
Learn managed beans or components in Spring using @Component, ... The @Component annotation declares any class as a managed spring bean.
Read more >
Using the Timer Service - The Java EE 6 Tutorial
An enterprise bean can have multiple automatic timeout methods, unlike a programmatic timer, which allows only one method annotated with the @Timeout annotation ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found