Skip to content

sercasti/spring-httpserver-timings-java17

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status License: MIT Maintenance

HTTP Server Timings library for Spring Boot 3 projects - Java 17 compatible

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.

Features

  • 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

Instructions

  • add the dependency from maven central:
        <dependency>
            <groupId>io.github.sercasti</groupId>
            <artifactId>spring-httpserver-timings-java17</artifactId>
            <version>0.0.1</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());
    }

Usage

  • 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

Example

License

MIT

Free Software, Hell Yeah!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages