Search in sources :

Example 1 with DropwizardMetricsOptions

use of io.vertx.ext.dropwizard.DropwizardMetricsOptions in project prebid-server-java by prebid.

the class VertxConfiguration method vertx.

@Bean
Vertx vertx(@Value("${vertx.worker-pool-size}") int workerPoolSize, @Value("${vertx.enable-per-client-endpoint-metrics}") boolean enablePerClientEndpointMetrics) {
    final DropwizardMetricsOptions metricsOptions = new DropwizardMetricsOptions().setEnabled(true).setRegistryName(MetricsConfiguration.METRIC_REGISTRY_NAME);
    if (enablePerClientEndpointMetrics) {
        metricsOptions.addMonitoredHttpClientEndpoint(new Match().setValue(".*").setType(MatchType.REGEX));
    }
    final VertxOptions vertxOptions = new VertxOptions().setWorkerPoolSize(workerPoolSize).setMetricsOptions(metricsOptions);
    return Vertx.vertx(vertxOptions);
}
Also used : VertxOptions(io.vertx.core.VertxOptions) DropwizardMetricsOptions(io.vertx.ext.dropwizard.DropwizardMetricsOptions) Match(io.vertx.ext.dropwizard.Match) Bean(org.springframework.context.annotation.Bean)

Example 2 with DropwizardMetricsOptions

use of io.vertx.ext.dropwizard.DropwizardMetricsOptions in project okapi by folio-org.

the class MetricsTest method setUp.

@Before
public void setUp(TestContext context) {
    String graphiteHost = System.getProperty("graphiteHost");
    final String registryName = "okapi";
    MetricRegistry registry = SharedMetricRegistries.getOrCreate(registryName);
    // Note the setEnabled (true or false)
    DropwizardMetricsOptions metricsOpt = new DropwizardMetricsOptions().setEnabled(false).setRegistryName(registryName);
    vertx = Vertx.vertx(new VertxOptions().setMetricsOptions(metricsOpt));
    reporter1 = ConsoleReporter.forRegistry(registry).build();
    reporter1.start(1, TimeUnit.SECONDS);
    if (graphiteHost != null) {
        Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, 2003));
        reporter2 = GraphiteReporter.forRegistry(registry).prefixedWith("okapiserver").build(graphite);
        reporter2.start(1, TimeUnit.MILLISECONDS);
    }
    DeploymentOptions opt = new DeploymentOptions().setConfig(new JsonObject().put("port", Integer.toString(port)));
    vertx.deployVerticle(MainVerticle.class.getName(), opt, context.asyncAssertSuccess());
    httpClient = vertx.createHttpClient();
}
Also used : DeploymentOptions(io.vertx.core.DeploymentOptions) InetSocketAddress(java.net.InetSocketAddress) MetricRegistry(com.codahale.metrics.MetricRegistry) Graphite(com.codahale.metrics.graphite.Graphite) JsonObject(io.vertx.core.json.JsonObject) MainVerticle(org.folio.okapi.MainVerticle) VertxOptions(io.vertx.core.VertxOptions) DropwizardMetricsOptions(io.vertx.ext.dropwizard.DropwizardMetricsOptions) Before(org.junit.Before)

Example 3 with DropwizardMetricsOptions

use of io.vertx.ext.dropwizard.DropwizardMetricsOptions in project raml-module-builder by folio-org.

the class RestLauncher method beforeStartingVertx.

@Override
public void beforeStartingVertx(VertxOptions options) {
    // TODO Auto-generated method stub
    super.beforeStartingVertx(options);
    System.out.println("starting rest verticle service..........");
    options.setBlockedThreadCheckInterval(1500000);
    options.setWarningExceptionTime(1500000);
    options.setMetricsOptions(new DropwizardMetricsOptions().setEnabled(true).addMonitoredHttpServerUri(new Match().setValue("/.*").setType(MatchType.REGEX)));
}
Also used : DropwizardMetricsOptions(io.vertx.ext.dropwizard.DropwizardMetricsOptions) Match(io.vertx.ext.dropwizard.Match)

Example 4 with DropwizardMetricsOptions

use of io.vertx.ext.dropwizard.DropwizardMetricsOptions in project okapi by folio-org.

the class DropwizardHelper method config.

public static void config(String graphiteHost, int port, TimeUnit tu, int period, VertxOptions vopt, String hostName) {
    final String registryName = "okapi";
    MetricRegistry registry = SharedMetricRegistries.getOrCreate(registryName);
    DropwizardMetricsOptions metricsOpt = new DropwizardMetricsOptions();
    metricsOpt.setEnabled(true).setRegistryName(registryName);
    vopt.setMetricsOptions(metricsOpt);
    Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, port));
    final String prefix = "folio.okapi." + hostName;
    GraphiteReporter reporter = GraphiteReporter.forRegistry(registry).prefixedWith(prefix).build(graphite);
    reporter.start(period, tu);
    logger.info("Metrics remote:" + graphiteHost + ":" + port + " this:" + prefix);
}
Also used : InetSocketAddress(java.net.InetSocketAddress) GraphiteReporter(com.codahale.metrics.graphite.GraphiteReporter) MetricRegistry(com.codahale.metrics.MetricRegistry) Graphite(com.codahale.metrics.graphite.Graphite) DropwizardMetricsOptions(io.vertx.ext.dropwizard.DropwizardMetricsOptions)

Example 5 with DropwizardMetricsOptions

use of io.vertx.ext.dropwizard.DropwizardMetricsOptions in project ksql by confluentinc.

the class KsqlRestApplication method setUpHttpMetrics.

private static DropwizardMetricsOptions setUpHttpMetrics(final KsqlConfig ksqlConfig) {
    final String serviceId = ksqlConfig.getString(KsqlConfig.KSQL_SERVICE_ID_CONFIG);
    final DropwizardMetricsOptions metricsOptions = new DropwizardMetricsOptions().setJmxEnabled(true).setBaseName("_confluent-ksql-" + serviceId).setJmxDomain("io.confluent.ksql.metrics");
    final List<Match> matches = MonitoredEndpoints.getMonitoredEndpoints();
    for (Match match : matches) {
        metricsOptions.addMonitoredHttpServerUri(match);
    }
    return metricsOptions;
}
Also used : DropwizardMetricsOptions(io.vertx.ext.dropwizard.DropwizardMetricsOptions) Match(io.vertx.ext.dropwizard.Match)

Aggregations

DropwizardMetricsOptions (io.vertx.ext.dropwizard.DropwizardMetricsOptions)5 Match (io.vertx.ext.dropwizard.Match)3 MetricRegistry (com.codahale.metrics.MetricRegistry)2 Graphite (com.codahale.metrics.graphite.Graphite)2 VertxOptions (io.vertx.core.VertxOptions)2 InetSocketAddress (java.net.InetSocketAddress)2 GraphiteReporter (com.codahale.metrics.graphite.GraphiteReporter)1 DeploymentOptions (io.vertx.core.DeploymentOptions)1 JsonObject (io.vertx.core.json.JsonObject)1 MainVerticle (org.folio.okapi.MainVerticle)1 Before (org.junit.Before)1 Bean (org.springframework.context.annotation.Bean)1