Skip to content

Library to generate a tracing header with timing metrics for backend components on Spring Boot following the HTTP Server Timings specification

License

Notifications You must be signed in to change notification settings

sercasti/spring-httpserver-timings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status License: MIT Maintenance

HTTP Server Timings library for Spring Boot projects

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

Java 17 / Spring 3 support:

Instructions

  • add the dependency from maven central:
        <dependency>
            <groupId>io.github.sercasti</groupId>
            <artifactId>spring-httpserver-timings</artifactId>
            <version>0.0.7</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

Library to generate a tracing header with timing metrics for backend components on Spring Boot following the HTTP Server Timings specification

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages