use of io.helidon.metrics.MetricsSupport in project helidon by oracle.
the class Main method createRouting.
/**
* Creates new {@link Routing}.
*
* @return routing configured with JSON support, a health check, and a service
* @param config configuration of this server
*/
private static Routing createRouting(Config config) {
/*
* For purposes of illustration, the key performance indicator settings for the
* MetricsSupport instance are set up according to a system property so you can see,
* in one example, how to code each approach. Normally, you would choose one
* approach to use in an application.
*/
MetricsSupport metricsSupport = USE_CONFIG ? metricsSupportWithConfig(config.get("metrics")) : metricsSupportWithoutConfig();
GreetService greetService = new GreetService(config);
return Routing.builder().register(// Metrics at "/metrics"
metricsSupport).register("/greet", greetService).build();
}
use of io.helidon.metrics.MetricsSupport in project helidon by oracle.
the class Main method createRouting.
/**
* Creates new {@link io.helidon.webserver.Routing}.
*
* @return routing configured with JSON support, a health check, and a service
* @param config configuration of this server
*/
private static Routing createRouting(Config config, MetricsSettings.Builder metricsSettingsBuilder) {
MetricsSupport metricsSupport = MetricsSupport.builder().metricsSettings(metricsSettingsBuilder).build();
MetricRegistry appRegistry = RegistryFactory.getInstance(metricsSettingsBuilder.build()).getRegistry(MetricRegistry.Type.APPLICATION);
GreetService greetService = new GreetService(config, appRegistry);
return Routing.builder().register(// Metrics at "/metrics"
metricsSupport).register("/greet", greetService).build();
}
use of io.helidon.metrics.MetricsSupport in project helidon by oracle.
the class Main method createRouting.
/**
* Creates new {@link Routing}.
*
* @return routing configured with JSON support, a health check, and a service
* @param config configuration of this server
*/
private static Routing createRouting(Config config) {
MetricsSupport metrics = MetricsSupport.create();
GreetService greetService = new GreetService(config);
return Routing.builder().register(// Metrics at "/metrics"
metrics).register("/greet", greetService).build();
}
use of io.helidon.metrics.MetricsSupport in project helidon by oracle.
the class Main method createRouting.
/**
* Creates new Routing.
*
* @return routing configured with JSON support, a health check, and a service
* @param config configuration of this server
*/
private static Routing createRouting(Config config) {
MetricsSupport metrics = MetricsSupport.create();
Neo4j neo4j = Neo4j.create(config.get("neo4j"));
// registers all metrics
Neo4jMetricsSupport.builder().driver(neo4j.driver()).build().initialize();
Neo4jHealthCheck healthCheck = Neo4jHealthCheck.create(neo4j.driver());
Driver neo4jDriver = neo4j.driver();
MovieService movieService = new MovieService(new MovieRepository(neo4jDriver));
HealthSupport health = HealthSupport.builder().addLiveness(// Adds a convenient set of checks
HealthChecks.healthChecks()).addReadiness(healthCheck).build();
return Routing.builder().register(// Health at "/health"
health).register(// Metrics at "/metrics"
metrics).register(movieService).build();
}
use of io.helidon.metrics.MetricsSupport in project helidon by oracle.
the class Main method createRouting.
/**
* Creates new {@link Routing}.
*
* @return routing configured with JSON support, a health check, and a service
* @param config configuration of this server
*/
private static Routing createRouting(Config config) {
MetricsSupport metrics = MetricsSupport.create();
HealthSupport health = HealthSupport.builder().addLiveness(// Adds a convenient set of checks
HealthChecks.healthChecks()).build();
GreetingService greetService = new GreetingService(config);
return Routing.builder().register(// Health at "/health"
health).register(// Metrics at "/metrics"
metrics).register("/greet", greetService).build();
}
Aggregations