- add the dependency as done in this example at pom.xml:
<dependency>
<groupId>io.github.sercasti</groupId>
<artifactId>spring-httpserver-timings</artifactId>
<version>0.0.8</version>
</dependency>
- add these Beans to your spring config, as this example does at SpringServertimingsExampleApplication.java:
@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 as ExampleController.java does
- or autowire/inject the Tracing interface and use it on a specific block of code, as ExampleService.java does
- Start this project with "mvn spring-boot:run",
- open localhost:8080
- check your network console on chrome, find the localhost request, open it
- there's a "timing" tab