Examples of HealthCheckRegistry


Examples of com.codahale.metrics.health.HealthCheckRegistry

  }

  @Override
  public Handler decorate(Injector injector, Handler handler) {
    if (healthChecksEnabled) {
      final HealthCheckRegistry registry = injector.getInstance(HealthCheckRegistry.class);
      GuiceUtil.eachOfType(injector, TypeToken.of(NamedHealthCheck.class), new Action<NamedHealthCheck>() {
        public void execute(NamedHealthCheck healthCheck) throws Exception {
          registry.register(healthCheck.getName(), healthCheck);
        }
      });
    }

    if (jvmMetricsEnabled) {
View Full Code Here

Examples of com.codahale.metrics.health.HealthCheckRegistry

                .buildProxy(new ExponentialBackoffRetry(5, 50, 1000, TimeUnit.MILLISECONDS));

        // If using Yammer Metrics or running in Dropwizard (which includes Yammer Metrics), you may want a health
        // check that pings a service you depend on. This will register a simple check that will confirm the service
        // pool contains at least one healthy end point.
        HealthCheckRegistry healthChecks = new HealthCheckRegistry();
        healthChecks.register("calculator-user", ContainsHealthyEndPointCheck.forProxy(service));

        CalculatorProxyUser user = new CalculatorProxyUser(service);
        user.use();

        ServicePoolProxies.close(service);
View Full Code Here

Examples of com.codahale.metrics.health.HealthCheckRegistry

                .build();

        // If using Yammer Metrics or running in Dropwizard (which includes Yammer Metrics), you may want a health
        // check that pings a service you depend on. This will register a simple check that will confirm the service
        // pool contains at least one healthy end point.
        HealthCheckRegistry healthChecks = new HealthCheckRegistry();
        healthChecks.register("calculator-user", ContainsHealthyEndPointCheck.forPool(pool));

        CalculatorUser user = new CalculatorUser(pool);
        user.use();

        Closeables.close(pool, true);
View Full Code Here

Examples of com.codahale.metrics.health.HealthCheckRegistry

                .buildProxy(new ExponentialBackoffRetry(5, 50, 1000, TimeUnit.MILLISECONDS));

        // If using Yammer Metrics or running in Dropwizard (which includes Yammer Metrics), you may want a health
        // check that pings a service you depend on. This will register a simple check that will confirm the service
        // pool contains at least one healthy end point.
        HealthCheckRegistry healthChecks = new HealthCheckRegistry();
        healthChecks.register("dictionary-user", ContainsHealthyEndPointCheck.forProxy(service));

        DictionaryUser user = new DictionaryUser(service);
        for (String wordFile : parsedArgs.<String>getList("word-file")) {
            user.spellCheck(new File(wordFile));
        }
View Full Code Here

Examples of com.codahale.metrics.health.HealthCheckRegistry

  @Override
  public void handle(Context context) throws Exception {

    // TODO: We should consider running health checks on a non request thread, which would allow them to block.

    HealthCheckRegistry registry = context.get(HealthCheckRegistry.class);
    String healthCheckName = context.getPathTokens().get(healthCheckNameToken);

    if (healthCheckName != null) {
      HealthCheck.Result result;
      try {
        result = registry.runHealthCheck(healthCheckName);
      } catch (NoSuchElementException e) {
        result = null;
      }

      if (result == null) {
        context.clientError(404);
      } else {
        context.render(result);
      }
    } else {
      SortedMap<String, HealthCheck.Result> healthCheckResults = registry.runHealthChecks();
      HealthCheckResults wrappedHealthCheckResults = new DefaultHealthCheckResults(healthCheckResults);
      context.render(wrappedHealthCheckResults);
    }
  }
View Full Code Here

Examples of com.yammer.metrics.core.HealthCheckRegistry

* Time: 5:32 PM
*/
public class MetricsRegistryInitializerFilter implements Filter {
    public void init(FilterConfig filterConfig) throws ServletException {
        ServletContext context = filterConfig.getServletContext();
        context.setAttribute(MonitorManager.HEALTH_CHECK_REGISTRY, new HealthCheckRegistry());
        context.setAttribute(MonitorManager.CRITICAL_HEALTH_CHECK_REGISTRY, new HealthCheckRegistry());
        context.setAttribute(MonitorManager.WARNING_HEALTH_CHECK_REGISTRY, new HealthCheckRegistry());
        context.setAttribute(MonitorManager.EXPENSIVE_HEALTH_CHECK_REGISTRY, new HealthCheckRegistry());

        MetricsRegistry metricsRegistry = new MetricsRegistry();
        context.setAttribute(MonitorManager.METRICS_REGISTRY, metricsRegistry);
        context.setAttribute(DefaultWebappMetricsFilter.REGISTRY_ATTRIBUTE, metricsRegistry);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.