Guest User

Untitled

a guest
Jan 20th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. @Configuration
  2. public class MetricsConfiguration {
  3.  
  4. /**
  5. * Register the metricsController.
  6. * @return Returns the ServletWrappingController for the Prometheus
  7. * MetricsServlet.
  8. */
  9. @Bean
  10. public ServletWrappingController metricsController() throws Exception {
  11. ServletWrappingController controller = new ServletWrappingController();
  12. controller.setServletClass(MetricsServlet.class);
  13. controller.setBeanName("metricsController");
  14. controller.afterPropertiesSet();
  15.  
  16. return controller;
  17. }
  18.  
  19. /**
  20. * Map /metrics to the metricsController.
  21. * @return Returns the SimpleUrlHandlerMapping.
  22. */
  23. @Bean
  24. public SimpleUrlHandlerMapping metricsControllerMapping() {
  25. SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
  26. Properties urlProperties = new Properties();
  27. urlProperties.put("/metrics", "metricsController");
  28. mapping.setMappings(urlProperties);
  29. mapping.setOrder(Integer.MAX_VALUE - 2);
  30.  
  31. return mapping;
  32. }
  33.  
  34. }
Add Comment
Please, Sign In to add comment