Search in sources :

Example 6 with HealthMeasureBuilder

use of io.vertigo.commons.analytics.health.HealthMeasureBuilder in project vertigo by KleeGroup.

the class CachePlugin method checkIo.

/**
 * @return HealthMeasure of this plugin
 */
@HealthChecked(name = "io", feature = "cache")
default HealthMeasure checkIo() {
    final HealthMeasureBuilder healthMeasureBuilder = HealthMeasure.builder();
    try {
        put("CACHE_HEALTH_VERTIGO", "healthcheckkey", "healthcheckvalue");
        get("CACHE_HEALTH_VERTIGO", "healthcheckkey");
        remove("CACHE_HEALTH_VERTIGO", "healthcheckkey");
        healthMeasureBuilder.withGreenStatus();
    } catch (final Exception e) {
        healthMeasureBuilder.withRedStatus(e.getMessage(), e);
    }
    return healthMeasureBuilder.build();
}
Also used : HealthMeasureBuilder(io.vertigo.commons.analytics.health.HealthMeasureBuilder) HealthChecked(io.vertigo.commons.analytics.health.HealthChecked)

Example 7 with HealthMeasureBuilder

use of io.vertigo.commons.analytics.health.HealthMeasureBuilder in project vertigo by KleeGroup.

the class RedisHealthChecker method checkRedisPing.

@HealthChecked(name = "ping", feature = "redisChecker")
public HealthMeasure checkRedisPing() {
    final HealthMeasureBuilder healthMeasureBuilder = HealthMeasure.builder();
    try (Jedis jedis = redisConnector.getResource()) {
        final String result = jedis.ping();
        healthMeasureBuilder.withGreenStatus(result);
    } catch (final Exception e) {
        healthMeasureBuilder.withRedStatus(e.getMessage(), e);
    }
    return healthMeasureBuilder.build();
}
Also used : HealthMeasureBuilder(io.vertigo.commons.analytics.health.HealthMeasureBuilder) Jedis(redis.clients.jedis.Jedis) HealthChecked(io.vertigo.commons.analytics.health.HealthChecked)

Aggregations

HealthChecked (io.vertigo.commons.analytics.health.HealthChecked)7 HealthMeasureBuilder (io.vertigo.commons.analytics.health.HealthMeasureBuilder)7 Jedis (redis.clients.jedis.Jedis)3 Home (io.vertigo.app.Home)1 AnalyticsManager (io.vertigo.commons.analytics.AnalyticsManager)1 HealthMeasure (io.vertigo.commons.analytics.health.HealthMeasure)1 Daemon (io.vertigo.commons.daemon.Daemon)1 DaemonDefinition (io.vertigo.commons.daemon.DaemonDefinition)1 DaemonManager (io.vertigo.commons.daemon.DaemonManager)1 DaemonScheduled (io.vertigo.commons.daemon.DaemonScheduled)1 DaemonStat (io.vertigo.commons.daemon.DaemonStat)1 VTransactionWritable (io.vertigo.commons.transaction.VTransactionWritable)1 Activeable (io.vertigo.core.component.Activeable)1 AopPlugin (io.vertigo.core.component.AopPlugin)1 Component (io.vertigo.core.component.Component)1 Definition (io.vertigo.core.definition.Definition)1 DefinitionSpace (io.vertigo.core.definition.DefinitionSpace)1 SimpleDefinitionProvider (io.vertigo.core.definition.SimpleDefinitionProvider)1 SqlDataBaseManager (io.vertigo.database.sql.SqlDataBaseManager)1 SqlConnection (io.vertigo.database.sql.connection.SqlConnection)1