This library is based on the HTTP Server Timings spec, which you can find here: https://www.w3.org/TR/server-timing/. The main idea is to be able to determine if any slow downs, bottlenecks or unexpected application issues happened for a request just by looking at the Network Tab on the browser, without the need to look at console logs or installing any tools.
- Generate response header with traces that will be rendered by the client browser to analyze response times
- Use as annotation to trace a method, or inject the Tracing interface to trace a block of code
- add the dependency from maven central:
<dependency>
<groupId>io.github.sercasti</groupId>
<artifactId>spring-httpserver-timings</artifactId>
<version>0.0.4</version>
</dependency>
- add these Beans to your spring config:
@Bean
protected Tracing tracing() {
return TracingConfig.createTracing();
}
@Bean
protected TracingFilter tracingFilter() {
return new TracingFilter();
}
@Bean
protected TracingInterceptor tracingInterceptor() {
return new TracingInterceptor(tracing());
}
- Use the @Traceable annotation around a method to generate a metric with the name of the method.
- or autowire/inject the Tracing interface and use it on a specific block of code
- You can find a sample app using this library here: https://github.com/sercasti/spring-servertimings-example
MIT
Free Software, Hell Yeah!