I want to aggregate some metrics. In my monitoring application, i send requests on all microservices with HTTP request. The microservices(in other JVM) report metrics, with dropwizard and actuator, it's work well,
in a for loop, i make calls like that :
String metricsQuery = queryHTTPMetrics(application);//String in json format, from dropwizard
JsonNode node = mapper.readTree(metricsQuery);
save(application, node);
Then the frontend use the JsonNode, but now i want to reuse the save JsonNode to send them in logstash and avoid to request a new time all microservices.
I can make a Slf4jReporter wich work for the current metricRegistry in the current JVM, but how to make the same with distant JVM I adress in HTTP request ? I want to inject all JsonNode I have saved :-/
final Slf4jReporter reporter = Slf4jReporter.forRegistry(metricRegistry)
.outputTo(LoggerFactory.getLogger("metrics"))
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.prefixedWith("monitoringApp")
.build();
reporter.start(monitoringProperties.getMetrics().getLogs().getReportFrequency(), TimeUnit.SECONDS);
My logger "metrics" is connected to a logstash appender and works.