Package com.codahale.metrics

Examples of com.codahale.metrics.Timer.time()


        if (filterRegistry.size() == 0)
            throw new RuntimeException("Empty filter registry!");

        for (MessageFilter filter : filterRegistry) {
            Timer timer = metricRegistry.timer(name(filter.getClass(), "executionTime"));
            final Timer.Context timerContext = timer.time();

            try {
                LOG.debug("Applying filter [{}] on message <{}>.", filter.getName(), msg.getId());

                if (filter.filter(msg)) {
View Full Code Here


                    Map<StreamRule, Boolean> result = getRuleMatches(stream, msg);
                    return doesStreamMatch(result);
                }
            };

            try (final Timer.Context timerContext = timer.time()) {
                boolean matched = timeLimiter.callWithTimeout(task, timeout, TimeUnit.MILLISECONDS, true);
                if (matched) {
                    getIncomingMeter(stream.getId()).mark();
                    matches.add(stream);
                }
View Full Code Here

        public void onEvent(RequestEvent event) {
            if (event.getType() == RequestEvent.Type.RESOURCE_METHOD_START) {
                final Timer timer = this.timers.get(event.getUriInfo()
                        .getMatchedResourceMethod().getInvocable().getDefinitionMethod());
                if (timer != null) {
                    this.context = timer.time();
                }
            } else if (event.getType() == RequestEvent.Type.RESOURCE_METHOD_FINISHED) {
                if (this.context != null) {
                    this.context.close();
                }
View Full Code Here

    void handleStart(Exchange exchange, MetricRegistry registry, String metricsName) {
        String propertyName = getPropertyName(metricsName);
        Timer.Context context = getTimerContextFromExchange(exchange, propertyName);
        if (context == null) {
            Timer timer = registry.timer(metricsName);
            context = timer.time();
            exchange.setProperty(propertyName, context);
        } else {
            LOG.warn("Timer \"{}\" already running", metricsName);
        }
    }
View Full Code Here

  public void time(String jobName, String stepName, String kind) {
    String metricName = stepName == null ?
        name(group, jobName, kind, TIMED_KIND) :
        name(group, jobName, STEP_KIND, stepName, kind, TIMED_KIND);
    Timer timer = metricRegistry.timer(metricName);
    Timer.Context timerContext = timer.time();
    timerContexts.put(metricName, timerContext);
  }

  public void stop(String jobName, String stepName, String kind) {
    String metricName = stepName == null ?
View Full Code Here

  HttpResponse executeRequest(final ProxyRepository repository, final ResourceStoreRequest request,
                              final HttpUriRequest httpRequest, final String baseUrl, final boolean contentRequest)
      throws RemoteStorageException
  {
    final Timer timer = timer(repository, httpRequest, baseUrl);
    final Timer.Context timerContext = timer.time();
    Stopwatch stopwatch = null;
    if (outboundRequestLog.isDebugEnabled()) {
      stopwatch = new Stopwatch().start();
    }
    try {
View Full Code Here

      super.writeTo(o, type, genericType, annotations, mediaType, httpHeaders, os);
      return;
    }

    final Timer timer = getTimer();
    final Timer.Context context = timer.time();

    try {
      final JsonNode tree = objectMapper.valueToTree(o);
      propertyFilter.filter(tree);
      super.writeTo(tree, tree.getClass(), tree.getClass(), annotations, mediaType, httpHeaders, os);
View Full Code Here

            return ExtensionResponse.badRequest(
                    "no scripts provided",
                    generateErrorJson(extensionMethod.getExtensionApiAsJson()));
        }

        final Timer.Context context = scriptTimer.time();
        try {
            // result is either the ad-hoc script on the query string or the last "stored procedure"
            Object result = null;
            if (scriptsToRun != null) {
                while (scriptsToRun.hasNext()) {
View Full Code Here

    List<EvaluationResponse> responses = Lists.newArrayList();

    Timer timer = this.metricRegistry.timer(createName(id, method));

    Timer.Context context = timer.time();

    try {
      List<FieldName> groupFields = evaluator.getGroupFields();
      if(groupFields.size() == 1){
        FieldName groupField = groupFields.get(0);
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.