Package com.codahale.metrics.health

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


                .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

                .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

                .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

  @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

TOP

Related Classes of com.codahale.metrics.health.HealthCheckRegistry

Copyright © 2018 www.massapicom. 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.