Encode and then decode GET /metrics response to fix serialization issue with Vertx's JsonObject
This commit is contained in:
parent
529bf25daf
commit
45a706e0d7
@ -5,6 +5,7 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.ext.dropwizard.MetricsService;
|
||||
import io.vertx.ext.web.RoutingContext;
|
||||
import net.frozenorb.apiv3.APIv3;
|
||||
import org.bson.Document;
|
||||
|
||||
public final class GETMetrics implements Handler<RoutingContext> {
|
||||
|
||||
@ -12,7 +13,8 @@ public final class GETMetrics implements Handler<RoutingContext> {
|
||||
MetricsService metricsService = MetricsService.create(APIv3.getVertxInstance());
|
||||
JsonObject metrics = metricsService.getMetricsSnapshot(APIv3.getVertxInstance());
|
||||
|
||||
APIv3.respondJson(ctx, 200, metrics);
|
||||
// We encode and then parse because JsonObject and Gson don't play nicely with each other
|
||||
APIv3.respondJson(ctx, 200, Document.parse(metrics.encode()));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user