Example usage for io.vertx.core.metrics MetricsOptions isEnabled

List of usage examples for io.vertx.core.metrics MetricsOptions isEnabled

Introduction

In this page you can find the example usage for io.vertx.core.metrics MetricsOptions isEnabled.

Prototype

public boolean isEnabled() 

Source Link

Document

Will metrics be enabled on the Vert.x instance?

Usage

From source file:co.runrightfast.vertx.core.impl.VertxServiceImpl.java

License:Apache License

private JsonObject toJsonObject(final MetricsOptions metricsOptions) {
    if (metricsOptions instanceof DropwizardMetricsOptions) {
        final DropwizardMetricsOptions dropwizardMetricsOptions = (DropwizardMetricsOptions) metricsOptions;
        final JsonObject json = new JsonObject().put("enabled", metricsOptions.isEnabled()).put("jmxEnabled",
                dropwizardMetricsOptions.isJmxEnabled());

        toJsonObject(dropwizardMetricsOptions.getMonitoredEventBusHandlers())
                .ifPresent(jsonArray -> json.put("MonitoredEventBusHandlers", jsonArray));
        toJsonObject(dropwizardMetricsOptions.getMonitoredHttpClientUris())
                .ifPresent(jsonArray -> json.put("MonitoredHttpClientUris", jsonArray));
        toJsonObject(dropwizardMetricsOptions.getMonitoredHttpServerUris())
                .ifPresent(jsonArray -> json.put("MonitoredHttpServerUris", jsonArray));

        return json;
    } else {//from  w w  w  .  ja  va 2s  .  c  o  m
        return new JsonObject().put("enabled", metricsOptions.isEnabled());
    }
}