Skip to content

This repository is a prometheus's spring boot library for easily collecting the duration metrics of all methods in all RestController or Controller classes.

Notifications You must be signed in to change notification settings

aha-oretama/prometheus_auto_timing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

prometheus_auto_timing

Prometheus is nice open-source monitoring tools which covers applications and infrastructures. Prometheus has many client libraries that matches the language in which your application is written.(See here).

Prometheus client libraries include Java client library which supports spring framework, spring boot. The instrument by Spring AOP is nice solution, however, it is a lot of cost to implement for collecing duration metrics of all methods in all RestController or Controller classes.

This repository is a spring boot library for this solution to make it easy and simple. You only add dependency and one annotation, then, you can collect the duration metrics of all methods in all RestController or Controller classes.

How to use

Now, this library is not uploaded in maven repository.(You make issue if you want. I'll upload soon.)

As a temporary measure, you must install library as follows.

$ git clone https://github.com/aha-oretama/prometheus_auto_timing.git
$ cd prometheus_auto_timing.git
$ mvn install

You only add dependency.

		<dependency>
			<groupId>jp.aha-oretama</groupId>
			<artifactId>prometheus_auto_timing</artifactId>
			<version>0.1.0-RELEASE</version>
		</dependency>

And you only add one annotaion @EnablePrometheusAutoTiming.

@SpringBootApplication
@EnablePrometheusEndpoint
@EnableSpringBootMetricsCollector
@EnablePrometheusAutoTiming
public class Application {

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}
}

Notification: You do not need to implement for collecting duration metrics of all methods in all RestController or Controller classes, but you need to implement for exposing prometheus API by spring boot. It is realised by simpleclient_spring_boot.

About

This repository is a prometheus's spring boot library for easily collecting the duration metrics of all methods in all RestController or Controller classes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages