@ConditionalOnMissingBean(MetricsOptions.class) @Bean public MetricsOptions metricsOptions(VertxMetricsFactory vertxMetricsFactory) { return new DropwizardMetricsOptions() .setFactory(vertxMetricsFactory) .setEnabled(false); } }
/** * Set whether JMX will be enabled on the Vert.x instance. * * @param jmxEnabled true if JMX enabled, or false if not. * @return a reference to this, so the API can be used fluently */ public DropwizardMetricsOptions setJmxEnabled(boolean jmxEnabled) { this.jmxEnabled = jmxEnabled; if (jmxEnabled) { setEnabled(true); } return this; }
case "baseName": if (member.getValue() instanceof String) { obj.setBaseName((String)member.getValue()); obj.setConfigPath((String)member.getValue()); obj.setEnabled((Boolean)member.getValue()); obj.setJmxDomain((String)member.getValue()); obj.setJmxEnabled((Boolean)member.getValue()); ((Iterable<Object>)member.getValue()).forEach( item -> { if (item instanceof JsonObject) obj.addMonitoredEventBusHandler(new io.vertx.ext.dropwizard.Match((JsonObject)item)); }); ((Iterable<Object>)member.getValue()).forEach( item -> { if (item instanceof JsonObject) obj.addMonitoredHttpClientEndpoint(new io.vertx.ext.dropwizard.Match((JsonObject)item)); }); ((Iterable<Object>)member.getValue()).forEach( item -> { if (item instanceof JsonObject) obj.addMonitoredHttpClientUri(new io.vertx.ext.dropwizard.Match((JsonObject)item)); }); ((Iterable<Object>)member.getValue()).forEach( item -> { if (item instanceof JsonObject)
metricsOptions = (DropwizardMetricsOptions) baseOptions; } else { metricsOptions = new DropwizardMetricsOptions(baseOptions.toJson()); MetricRegistry registry = metricsOptions.getMetricRegistry() != null ? metricsOptions.getMetricRegistry() : new MetricRegistry(); boolean shutdown = true; if (metricsOptions.getRegistryName() != null) { MetricRegistry other = SharedMetricRegistries.add(metricsOptions.getRegistryName(), registry); if (other != null) { registry = other; if (metricsOptions.getConfigPath() != null && !metricsOptions.getConfigPath().isEmpty()) { FileResolver resolver = new FileResolver(); JsonObject loadedFromFile; try { loadedFromFile = loadOptionsFile(metricsOptions.getConfigPath(), resolver); } finally { try { metricsOptions = new DropwizardMetricsOptions(loadedFromFile); String baseName = metricsOptions.getBaseName() == null ? BASE_NAME : metricsOptions.getBaseName(); VertxMetricsImpl metrics = new VertxMetricsImpl(registry, shutdown, options, metricsOptions, baseName); if (metricsOptions.isJmxEnabled()) { String jmxDomain = metricsOptions.getJmxDomain(); if (jmxDomain == null) { jmxDomain = "vertx" + "@" + Integer.toHexString(options.hashCode());
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); }
hazelcastConfig.getNetworkConfig().toString()); options.setMetricsOptions(new DropwizardMetricsOptions() .setEnabled(true) .setJmxEnabled(true) ); Vertx.clusteredVertx(options, res -> { options.setMetricsOptions(new DropwizardMetricsOptions() .setEnabled(true) .setJmxEnabled(true) );
vertxOptions.setPreferNativeTransport(true); vertxOptions.setMetricsOptions( new DropwizardMetricsOptions().setEnabled(true) );
@Override public MetricsOptions newOptions(JsonObject jsonObject) { return jsonObject == null ? new DropwizardMetricsOptions() : new DropwizardMetricsOptions(jsonObject); } }