Search in sources :

Example 16 with HealthSupport

use of io.helidon.health.HealthSupport 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);
    HealthSupport health = HealthSupport.builder().addLiveness(// Adds a convenient set of checks
    HealthChecks.healthChecks()).build();
    // Note: Add the CORS routing *before* registering the GreetService routing.
    return Routing.builder().register(// Health at "/health"
    health).register(// Metrics at "/metrics"
    metrics).register("/greet", corsSupportForGreeting(config), greetService).build();
}
Also used : HealthSupport(io.helidon.health.HealthSupport) MetricsSupport(io.helidon.metrics.MetricsSupport)

Example 17 with HealthSupport

use of io.helidon.health.HealthSupport in project helidon by oracle.

the class Main method createRouting.

/**
 * Creates new {@link Routing}.
 *
 * @param config configuration of this server
 * @return routing configured with a health check, and a service
 */
private static Routing createRouting(Config config) {
    MetricsSupport metrics = MetricsSupport.create();
    EmployeeService employeeService = new EmployeeService(config);
    HealthSupport health = HealthSupport.builder().addLiveness(HealthChecks.healthChecks()).build();
    return Routing.builder().register("/public", StaticContentSupport.builder("public").welcomeFileName("index.html")).register(// Health at "/health"
    health).register(// Metrics at "/metrics"
    metrics).register("/employees", employeeService).build();
}
Also used : HealthSupport(io.helidon.health.HealthSupport) MetricsSupport(io.helidon.metrics.MetricsSupport)

Example 18 with HealthSupport

use of io.helidon.health.HealthSupport in project helidon by oracle.

the class JdbcExampleMain method createRouting.

/**
 * Creates new {@link io.helidon.webserver.Routing}.
 *
 * @param config configuration of this server
 * @return routing configured with JSON support, a health check, and a service
 */
private static Routing createRouting(Config config) {
    Config dbConfig = config.get("db");
    // Client services are added through a service loader - see mongoDB example for explicit services
    DbClient dbClient = DbClient.builder(dbConfig).build();
    // Some relational databases do not support DML statement as ping so using query which works for all of them
    HealthSupport health = HealthSupport.builder().addLiveness(DbClientHealthCheck.create(dbClient, dbConfig.get("health-check"))).build();
    return Routing.builder().register(// Health at "/health"
    health).register(// Metrics at "/metrics"
    MetricsSupport.create()).register("/db", new PokemonService(dbClient)).build();
}
Also used : DbClient(io.helidon.dbclient.DbClient) Config(io.helidon.config.Config) LogConfig(io.helidon.common.LogConfig) HealthSupport(io.helidon.health.HealthSupport)

Example 19 with HealthSupport

use of io.helidon.health.HealthSupport in project helidon by oracle.

the class MongoDbExampleMain method createRouting.

/**
 * Creates new {@link io.helidon.webserver.Routing}.
 *
 * @param config configuration of this server
 * @return routing configured with JSON support, a health check, and a service
 */
private static Routing createRouting(Config config) {
    Config dbConfig = config.get("db");
    DbClient dbClient = DbClient.builder(dbConfig).addService(DbClientMetrics.counter().statementNames("select-all", "select-one")).addService(DbClientMetrics.timer().statementTypes(DbStatementType.DELETE, DbStatementType.UPDATE, DbStatementType.INSERT)).addService(DbClientTracing.create()).build();
    HealthSupport health = HealthSupport.builder().addLiveness(DbClientHealthCheck.create(dbClient, dbConfig.get("health-check"))).build();
    return Routing.builder().register(// Health at "/health"
    health).register(// Metrics at "/metrics"
    MetricsSupport.create()).register("/db", new PokemonService(dbClient)).build();
}
Also used : DbClient(io.helidon.dbclient.DbClient) Config(io.helidon.config.Config) LogConfig(io.helidon.common.LogConfig) HealthSupport(io.helidon.health.HealthSupport)

Example 20 with HealthSupport

use of io.helidon.health.HealthSupport in project helidon by oracle.

the class Main method createRouting.

private static Routing createRouting(Config config, CoordinatorService coordinatorService) {
    MetricsSupport metrics = MetricsSupport.create();
    HealthSupport health = HealthSupport.builder().addLiveness(HealthChecks.healthChecks()).build();
    return Routing.builder().register(metrics).register(health).register(config.get("mp.lra.coordinator.context.path").asString().orElse("/lra-coordinator"), coordinatorService).build();
}
Also used : HealthSupport(io.helidon.health.HealthSupport) MetricsSupport(io.helidon.metrics.MetricsSupport)

Aggregations

HealthSupport (io.helidon.health.HealthSupport)20 MetricsSupport (io.helidon.metrics.MetricsSupport)10 LogConfig (io.helidon.common.LogConfig)7 Config (io.helidon.config.Config)7 DbClient (io.helidon.dbclient.DbClient)4 WebServer (io.helidon.webserver.WebServer)4 Routing (io.helidon.webserver.Routing)3 HealthChecks (io.helidon.health.checks.HealthChecks)2 DbClientService (io.helidon.dbclient.DbClientService)1 DbClientHealthCheck (io.helidon.dbclient.health.DbClientHealthCheck)1 MovieRepository (io.helidon.examples.integrations.neo4j.se.domain.MovieRepository)1 GreetService (io.helidon.grpc.examples.common.GreetService)1 GreetServiceJava (io.helidon.grpc.examples.common.GreetServiceJava)1 StringService (io.helidon.grpc.examples.common.StringService)1 GrpcRouting (io.helidon.grpc.server.GrpcRouting)1 GrpcServer (io.helidon.grpc.server.GrpcServer)1 GrpcServerConfiguration (io.helidon.grpc.server.GrpcServerConfiguration)1 Neo4j (io.helidon.integrations.neo4j.Neo4j)1 Neo4jHealthCheck (io.helidon.integrations.neo4j.health.Neo4jHealthCheck)1 Neo4jMetricsSupport (io.helidon.integrations.neo4j.metrics.Neo4jMetricsSupport)1