本文整理汇总了Java中io.vertx.ext.dropwizard.DropwizardMetricsOptions类的典型用法代码示例。如果您正苦于以下问题:Java DropwizardMetricsOptions类的具体用法?Java DropwizardMetricsOptions怎么用?Java DropwizardMetricsOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DropwizardMetricsOptions类属于io.vertx.ext.dropwizard包,在下文中一共展示了DropwizardMetricsOptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: config
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
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);
}
开发者ID:folio-org,项目名称:okapi,代码行数:19,代码来源:DropwizardHelper.java
示例2: provideVertx
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
@Provides
@Singleton
public Vertx provideVertx(ApplicationConfiguration applicationConfiguration) {
VertxOptions vertxOptions =
new VertxOptions()
.setMaxEventLoopExecuteTime(applicationConfiguration.getMaxEventLoopExecutionTime())
.setWarningExceptionTime(20L * 1000 * 1000000)
.setMaxWorkerExecuteTime(applicationConfiguration.getMaxWorkerExecutionTime())
.setWorkerPoolSize(applicationConfiguration.getWorkerPoolSize());
// see
// https://github.com/vert-x3/vertx-dropwizard-metrics/blob/master/src/main/asciidoc/java/index.adoc#jmx
vertxOptions.setMetricsOptions(
new DropwizardMetricsOptions()
.setEnabled(applicationConfiguration.isMetricsEnabled())
.setJmxEnabled(applicationConfiguration.isJmxEnabled())
.setJmxDomain(applicationConfiguration.getJmxDomainName()));
return Vertx.vertx(vertxOptions);
}
开发者ID:glytching,项目名称:dragoman,代码行数:21,代码来源:DragomanModule.java
示例3: test_vertx_metrics_options
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
@Test
public void test_vertx_metrics_options() {
log.info("test_vertx_metrics_options");
service = new VertxServiceImpl(config.getConfig(ConfigUtils.configPath(CONFIG_NAMESPACE, "vertx-with-metrics")), deployments, appEventLogger);
ServiceUtils.start(service);
services.add(service);
final Vertx vertx = service.getVertx();
log.log(Level.INFO, "vertx.isClustered() = {0}", vertx.isClustered());
log.log(Level.INFO, "vertx.isMetricsEnabled() = {0}", vertx.isMetricsEnabled());
assertThat(vertx.isClustered(), is(false));
assertThat(vertx.isMetricsEnabled(), is(true));
final VertxOptions vertxOptions = service.getVertxOptions();
final MetricsOptions metricsOptions = vertxOptions.getMetricsOptions();
log.log(INFO, "metricsOptions class : {0}", metricsOptions.getClass().getName());
final DropwizardMetricsOptions dropwizardMetricsOptions = (DropwizardMetricsOptions) metricsOptions;
assertThat(dropwizardMetricsOptions.isJmxEnabled(), is(true));
assertThat(dropwizardMetricsOptions.getJmxDomain(), is("co.runrightfast.vertx.metrics"));
assertThat(dropwizardMetricsOptions.getRegistryName(), is(VERTX_METRIC_REGISTRY_NAME));
assertThat(dropwizardMetricsOptions.getMonitoredEventBusHandlers().size(), is(2));
assertThat(dropwizardMetricsOptions.getMonitoredHttpServerUris().size(), is(3));
assertThat(dropwizardMetricsOptions.getMonitoredHttpClientUris().size(), is(4));
}
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:25,代码来源:VertxServiceImplTest.java
示例4: EventBusMetricsImpl
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
EventBusMetricsImpl(AbstractMetrics metrics, String baseName, DropwizardMetricsOptions options) {
super(metrics.registry(), baseName);
handlerCount = counter("handlers");
pending = counter("messages", "pending");
pendingLocal = counter("messages", "pending-local");
pendingRemote = counter("messages", "pending-remote");
receivedMessages = throughputMeter("messages", "received");
receivedLocalMessages = throughputMeter("messages", "received-local");
receivedRemoteMessages = throughputMeter("messages", "received-remote");
deliveredMessages = throughputMeter("messages", "delivered");
deliveredLocalMessages = throughputMeter("messages", "delivered-local");
deliveredRemoteMessages = throughputMeter("messages", "delivered-remote");
sentMessages = throughputMeter("messages", "sent");
sentLocalMessages = throughputMeter("messages", "sent-local");
sentRemoteMessages = throughputMeter("messages", "sent-remote");
publishedMessages = throughputMeter("messages", "published");
publishedLocalMessages = throughputMeter("messages", "published-local");
publishedRemoteMessages = throughputMeter("messages", "published-remote");
replyFailures = meter("messages", "reply-failures");
bytesRead = meter("messages", "bytes-read");
bytesWritten = meter("messages", "bytes-written");
handlerMatcher = new Matcher(options.getMonitoredEventBusHandlers());
}
开发者ID:vert-x3,项目名称:vertx-dropwizard-metrics,代码行数:25,代码来源:EventBusMetricsImpl.java
示例5: testLoadingFromFile
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
@Test
public void testLoadingFromFile() throws Exception {
String filePath = ClassLoader.getSystemResource("test_metrics_config.json").getFile();
DropwizardMetricsOptions dmo = new DropwizardMetricsOptions().setConfigPath(filePath);
VertxOptions vertxOptions = new VertxOptions().setMetricsOptions(dmo);
// Verify our jmx domain isn't there already, just in case.
assertFalse(Arrays.asList(ManagementFactory.getPlatformMBeanServer().getDomains()).contains("test-jmx-domain"));
VertxMetricsFactoryImpl vmfi = new VertxMetricsFactoryImpl();
metrics = vmfi.metrics(vertx, vertxOptions);
List<String> jmxDomains = Arrays.asList(ManagementFactory.getPlatformMBeanServer().getDomains());
// If our file was loaded correctly, then our jmx domain will exist.
assertTrue(jmxDomains.contains("test-jmx-domain"));
}
开发者ID:vert-x3,项目名称:vertx-dropwizard-metrics,代码行数:18,代码来源:VertxMetricFactoryImplTest.java
示例6: testloadingFileFromClasspath
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
@Test
public void testloadingFileFromClasspath() throws Exception {
String path = "test_metrics_config.json";
DropwizardMetricsOptions dmo = new DropwizardMetricsOptions().setConfigPath(path);
VertxOptions vertxOptions = new VertxOptions().setMetricsOptions(dmo);
// Verify our jmx domain isn't there already, just in case.
assertFalse(Arrays.asList(ManagementFactory.getPlatformMBeanServer().getDomains()).contains("test-jmx-domain"));
VertxMetricsFactoryImpl vmfi = new VertxMetricsFactoryImpl();
metrics = vmfi.metrics(vertx, vertxOptions);
List<String> jmxDomains = Arrays.asList(ManagementFactory.getPlatformMBeanServer().getDomains());
// If our file was loaded correctly, then our jmx domain will exist.
assertTrue(jmxDomains.contains("test-jmx-domain"));
}
开发者ID:vert-x3,项目名称:vertx-dropwizard-metrics,代码行数:18,代码来源:VertxMetricFactoryImplTest.java
示例7: testLoadingWithMissingFile
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
@Test
public void testLoadingWithMissingFile() throws Exception {
String filePath = "/i/am/not/here/missingfile.json";
DropwizardMetricsOptions dmo = new DropwizardMetricsOptions()
.setJmxEnabled(true)
.setJmxDomain("non-file-jmx")
.setConfigPath(filePath);
VertxOptions vertxOptions = new VertxOptions().setMetricsOptions(dmo);
VertxMetricsFactoryImpl vmfi = new VertxMetricsFactoryImpl();
metrics = vmfi.metrics(vertx, vertxOptions);
List<String> jmxDomains = Arrays.asList(ManagementFactory.getPlatformMBeanServer().getDomains());
assertFalse(jmxDomains.contains("test-jmx-domain"));
assertTrue(jmxDomains.contains("non-file-jmx"));
}
开发者ID:vert-x3,项目名称:vertx-dropwizard-metrics,代码行数:19,代码来源:VertxMetricFactoryImplTest.java
示例8: setUp
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
@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();
}
开发者ID:folio-org,项目名称:okapi,代码行数:33,代码来源:MetricsTest.java
示例9: vertxMetricsOptions
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
@Bean
@ConditionalOnProperty(prefix = "hono.metric", name = "vertx", havingValue = "true")
public MetricsOptions vertxMetricsOptions() {
LOG.info("metrics - vertx activated");
SharedMetricRegistries.add(HONO, metricRegistry);
SharedMetricRegistries.setDefault(HONO, metricRegistry);
return new DropwizardMetricsOptions().setEnabled(true).setRegistryName(HONO)
.setBaseName(prefix + ".vertx").setJmxEnabled(true);
}
开发者ID:eclipse,项目名称:hono,代码行数:10,代码来源:MetricConfig.java
示例10: beforeStartingVertx
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
@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)));
}
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:12,代码来源:RestLauncher.java
示例11: getVertxOptions
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
/**
*
* @return a copy of the VertxOptions that was used to create the Vertx instance
*/
@Override
public VertxOptions getVertxOptions() {
final VertxOptions copy = new VertxOptions(vertxOptions);
final MetricsOptions metricsOptions = vertxOptions.getMetricsOptions();
if (metricsOptions != null) {
if (metricsOptions instanceof DropwizardMetricsOptions) {
copy.setMetricsOptions(new DropwizardMetricsOptions((DropwizardMetricsOptions) metricsOptions));
} else {
copy.setMetricsOptions(new DropwizardMetricsOptions(metricsOptions));
}
}
return copy;
}
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:18,代码来源:VertxServiceImpl.java
示例12: toJsonObject
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
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 {
return new JsonObject().put("enabled", metricsOptions.isEnabled());
}
}
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:16,代码来源:VertxServiceImpl.java
示例13: main
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
public static void main(String[] args) {
VertxOptions vOpts = new VertxOptions();
DeploymentOptions options = new DeploymentOptions().setInstances(4);
vOpts.setClustered(true);
vOpts.setMetricsOptions(new DropwizardMetricsOptions().setEnabled(true));
Vertx.clusteredVertx(vOpts, cluster-> {
if(cluster.succeeded()){
final Vertx result = cluster.result();
result.deployVerticle("org.jacpfx.vertx.entrypoint.ServiceEntryPoint",options, handle -> {
});
}
});
}
开发者ID:amoAHCP,项目名称:vert.x-microservice,代码行数:15,代码来源:ServiceEntryPoint.java
示例14: setupJMXWithDomain
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
public void setupJMXWithDomain() {
Vertx vertx = Vertx.vertx(new VertxOptions().setMetricsOptions(
new DropwizardMetricsOptions().
setJmxEnabled(true).
setJmxDomain("mydomain")
));
}
开发者ID:vert-x3,项目名称:vertx-dropwizard-metrics,代码行数:8,代码来源:MetricsExamples.java
示例15: setupMonitoredHandlers
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
public void setupMonitoredHandlers() {
Vertx vertx = Vertx.vertx(new VertxOptions().setMetricsOptions(
new DropwizardMetricsOptions().
setEnabled(true).
addMonitoredEventBusHandler(
new Match().setValue("some-address")).
addMonitoredEventBusHandler(
new Match().setValue("business-.*").setType(MatchType.REGEX))
));
}
开发者ID:vert-x3,项目名称:vertx-dropwizard-metrics,代码行数:11,代码来源:MetricsExamples.java
示例16: setupMonitoredUris
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
public void setupMonitoredUris() {
Vertx vertx = Vertx.vertx(new VertxOptions().setMetricsOptions(
new DropwizardMetricsOptions().
setEnabled(true).
addMonitoredHttpServerUri(
new Match().setValue("/")).
addMonitoredHttpServerUri(
new Match().setValue("/foo/.*").setType(MatchType.REGEX))
));
}
开发者ID:vert-x3,项目名称:vertx-dropwizard-metrics,代码行数:11,代码来源:MetricsExamples.java
示例17: setupMonitoredUrisWithAliases
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
public void setupMonitoredUrisWithAliases() {
Vertx vertx = Vertx.vertx(new VertxOptions().setMetricsOptions(
new DropwizardMetricsOptions().
setEnabled(true).
addMonitoredHttpServerUri(new Match().setValue("/users/.*").setAlias("users").setType(MatchType.REGEX))
));
}
开发者ID:vert-x3,项目名称:vertx-dropwizard-metrics,代码行数:8,代码来源:MetricsExamples.java
示例18: setupMonitoredEndpoints
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
public void setupMonitoredEndpoints() {
Vertx vertx = Vertx.vertx(new VertxOptions().setMetricsOptions(
new DropwizardMetricsOptions().
setEnabled(true).
addMonitoredHttpClientEndpoint(
new Match().setValue("some-host:80")).
addMonitoredHttpClientEndpoint(
new Match().setValue("another-host:.*").setType(MatchType.REGEX))
));
}
开发者ID:vert-x3,项目名称:vertx-dropwizard-metrics,代码行数:11,代码来源:MetricsExamples.java
示例19: getRegistry
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
public void getRegistry() {
VertxOptions options = new VertxOptions().setMetricsOptions(
new DropwizardMetricsOptions().setEnabled(true).setRegistryName("my-registry")
);
Vertx vertx = Vertx.vertx(options);
// Get the registry
MetricRegistry registry = SharedMetricRegistries.getOrCreate("my-registry");
// Do whatever you need with the registry
}
开发者ID:vert-x3,项目名称:vertx-dropwizard-metrics,代码行数:10,代码来源:MetricsExamples.java
示例20: example4
import io.vertx.ext.dropwizard.DropwizardMetricsOptions; //导入依赖的package包/类
public void example4() {
Vertx vertx = Vertx.vertx(new VertxOptions().setMetricsOptions(
new DropwizardMetricsOptions()
.setEnabled(true)
.setJmxEnabled(true)
.setJmxDomain("vertx-metrics")));
}
开发者ID:vert-x3,项目名称:vertx-dropwizard-metrics,代码行数:8,代码来源:MetricsExamples.java
注:本文中的io.vertx.ext.dropwizard.DropwizardMetricsOptions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论