cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is it feasible to configure Dynatrace for automatic detection of @Scheduled methods in a Java application?

sivakumarp
Visitor

Hello,

We have created custom services in Dynatrace to detect @Scheduled methods in our Java application. Given the significant number of @Scheduled methods in our application, is there a way to configure Dynatrace to auto-detect these methods using rules or other configurations?

Thanks in advance.

Regards,

Siva Kumar

7 REPLIES 7

Habiba_A
Frequent Guest

Hello @sivakumarp , 

Yes there's a way to auto-detect & monitor them. As far as I'm aware custom services can be used for this. And you'll define the technology as Java and fill out the rest as necessary. I believe this way it's a lot easier as well since it will all be done through the Dynatrace UI.

I have also attached an image as to where you can find custom services.

Habiba_A_0-1735812221796.png

That's what I would do personally, so I hope that helped!
-Habiba Abdelaziz


Hi Habiba_A,

Thanks for the response.

As I mentioned earlier, we have successfully created custom services for detecting @Scheduled methods, and they are available in Dynatrace. Given the substantial number of schedulers in our application, I'm now exploring options for auto-detecting these methods using rules or other configurations.

@sivakumarp,

In a recent case, I have done that configuration via API. That certainly helps when leading with large number of Custom Services.

The link is here. If you have doubts, use the same API to get an existing config, and then replicate it with this one...

Antonio Sousa

Yes, but typically you should instrument the particular abstract class being executed to automatically capture every task scheduled. I do it it for example with Quarz scheduler this way. You can also add request naming rules to better identify the executed task, if necessary.

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Hi @Julius_Loman,

Thanks for the information. Do you have any sample to refer ?

 

@sivakumarp For example, for the Quartz scheduler, instrument the org.quartz.Job interface and the execute method (create a custom service which bounds to this class and method execution). You may want to capture additional metadata using request attributes from the execution method's context argument.

This is just an example for Quartz, if your apps use different schedulers, I'd recommend following the same approach.

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

@Julius_Loman could you share how to instrument the execute method? I assume DynaTrace SDK  needs to be used for this. If you could share a link to documentation how to do this it would be great. Thank you!

Featured Posts