Metlo for Spring/Boot provides a lightweight filter for spring based
applications and can be included as any other filter would. The filter needs to
be provided with the METLO collector url, and the METLO API Key as parameters.
package com.example.demo;import org.springframework.boot.web.servlet.FilterRegistrationBean;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;// Metlo imported here import com.metlo.spring.Metlo;@Configuration public class FilterConfig { @Bean public FilterRegistrationBean<Metlo> loggingFilter() { FilterRegistrationBean<Metlo> registrationBean = new FilterRegistrationBean<>(); // Metlo registered as a filter here registrationBean.setFilter(new Metlo("http://<YOUR_METLO_HOST>:8081", "<YOUR_METLO_API_KEY>")); registrationBean.setOrder(2); return registrationBean; }}
Metlo rate limits itself to 10 requests/s by default. In case the system has the
capacity to handle more and/or a larger number of traces needs to be reported
for some reason, that can be customised in the constructor with the signature:
Java
Copy
public Metlo(String host, String api_key, Integer rps)