Examples of TimerContext


Examples of com.yammer.metrics.core.TimerContext

        ServiceHandle<S> handle = null;

        try {
            handle = _serviceCache.checkOut(endPoint);

            TimerContext timer = _callbackExecutionTime.time();
            try {
                return callback.call(handle.getService());
            } finally {
                timer.stop();
            }
        } catch (NoCachedInstancesAvailableException e) {
            LOG.debug("Service cache exhausted. End point ID: {}", endPoint.getId(), e);
            // Don't mark an end point as bad just because there are no cached end points for it.
            throw e;
View Full Code Here

Examples of com.yammer.metrics.core.TimerContext

        @Override
        public S makeObject(final ServiceEndPoint endPoint) throws Exception {
            _missCount.incrementAndGet();

            TimerContext timer = _loadTimer.time();
            try {
                S service = _serviceFactory.create(endPoint);
                _loadSuccessCount.incrementAndGet();
                return service;
            } catch (Exception e) {
                _loadFailureCount.incrementAndGet();
                throw e;
            } finally {
                timer.stop();
            }
        }
View Full Code Here

Examples of com.yammer.metrics.core.TimerContext

     *
     * @see StreamProcessor#process(Iterable, String)
     */
    public void process(final Iterable<T> stream, final String topic) {
        for (final T message : stream) {
            final TimerContext context = processed.time();
            process(message, topic);
            context.stop();
        }
    }
View Full Code Here

Examples of com.yammer.metrics.core.TimerContext

                            buffer.put(v, v);
                            v++;
                        }
                        mods -= c;
                    }
                    TimerContext ctxt;
                    ctxt = TREE_TIMER.time();
                    canon.putAll(buffer);
                    ctxt.stop();
                    ctxt = BTREE_TIMER.time();
                    btree = BTree.update(btree, ICMP, buffer.keySet(), true, null);
                    ctxt.stop();

                    if (quickEquality)
                        testEqual("", BTree.<Integer>slice(btree, true), canon.keySet().iterator());
                    else
                        r.addAll(testAllSlices("RND", btree, canon.navigableKeySet()));
View Full Code Here

Examples of com.yammer.metrics.core.TimerContext

        }
    }

    public void create(T... objects) {
        // must handle this manually since AOP pointcuts don't work with ellipses methods!
        TimerContext timer = createTimer.time();
        try {
            create(Arrays.asList(objects));
        } catch (Exception e) {
            createExceptionsMeter.mark();
            throw Throwables.propagate(e);
        } finally {
            timer.stop();
        }
    }
View Full Code Here

Examples of com.yammer.metrics.core.TimerContext

      final Logger log //
  ) {

    final String path = item.getPath();

    final TimerContext time = metricsPublishTransferTime.time();

    final boolean isSaved = amazonService.save(path, file);

    time.stop();

    if (isSaved) {

      metricsPublishFileCount.inc();
      metricsPublishFileSize.inc(file.length());
View Full Code Here

Examples of com.yammer.metrics.core.TimerContext

        S service = null;

        try {
            service = _serviceCache.checkOut(endPoint);

            TimerContext timer = _callbackExecutionTime.time();
            try {
                return callback.call(service);
            } finally {
                timer.stop();
            }
        } catch (NoCachedInstancesAvailableException e) {
            LOG.debug("Service cache exhausted. End point ID: " + endPoint.getId(), e);
            // Don't mark an end point as bad just because there are no cached end points for it.
            throw e;
View Full Code Here

Examples of com.yammer.metrics.core.TimerContext

            }

            Future<R> future = _executor.submit(new Callable<R>() {
                @Override
                public R call() throws Exception {
                    TimerContext timer = _executionTime.time();
                    Stopwatch sw = new Stopwatch(_ticker).start();
                    int numAttempts = 0;

                    try {
                        Exception lastException;

                        do {
                            try {
                                R result = _pool.executeOnEndPoint(endPoint, callback);
                                _numExecuteSuccesses.mark();
                                return result;
                            } catch (Exception e) {
                                _numExecuteFailures.mark();

                                // Don't retry if exception is too severe.
                                if (!_pool.isRetriableException(e)) {
                                    throw e;
                                }

                                lastException = e;
                                LOG.info("Retriable exception from end point id: " + endPoint.getId(), e);
                            }
                        } while (retry.allowRetry(++numAttempts, sw.elapsedMillis()));

                        throw new MaxRetriesException(lastException);
                    } finally {
                        timer.stop();
                    }
                }
            });

            futures.add(future);
View Full Code Here

Examples of com.yammer.metrics.core.TimerContext

                            buffer.put(v, v);
                            v++;
                        }
                        mods -= c;
                    }
                    TimerContext ctxt;
                    ctxt = TREE_TIMER.time();
                    canon.putAll(buffer);
                    ctxt.stop();
                    ctxt = BTREE_TIMER.time();
                    Object[] next = null;
                    while (next == null)
                        next = BTree.update(btree, ICMP, buffer.keySet(), true, SPORADIC_ABORT);
                    btree = next;
                    ctxt.stop();

                    if (!BTree.isWellFormed(btree, ICMP))
                    {
                        System.out.println("ERROR: Not well formed");
                        throw new AssertionError("Not well formed!");
View Full Code Here

Examples of com.yammer.metrics.core.TimerContext

  public void run(InputBenchmarkCmd args) throws Exception {
    HadoopNative.requireHadoopNative();

    Timer allTime = Metrics.newTimer(InputBenchmark.class, "all-time", MILLISECONDS, MILLISECONDS);
    TimerContext allTimerContext = allTime.time();

    HiveInputDescription input = new HiveInputDescription();
    input.setDbName(args.tableOpts.database);
    input.setTableName(args.tableOpts.table);
    input.setPartitionFilter(args.tableOpts.partitionFilter);
    input.getMetastoreDesc().setHost(args.metastoreOpts.host);
    input.getMetastoreDesc().setPort(args.metastoreOpts.port);

    HiveConf hiveConf = HiveUtils.newHiveConf(InputBenchmark.class);

    System.err.println("Initialize profile with input data");
    HiveApiInputFormat.setProfileInputDesc(hiveConf, input, DEFAULT_PROFILE_ID);

    HiveApiInputFormat defaultInputFormat = new HiveApiInputFormat();
    if (args.trackMetrics) {
      defaultInputFormat.setObserver(new MetricsObserver("default", args.recordPrintPeriod));
    }

    List<InputSplit> splits = defaultInputFormat.getSplits(new JobContext(hiveConf, new JobID()));
    System.err.println("getSplits returned " + splits.size() + " splits");

    long numRows = 0;
    for (int i = 0; i < splits.size(); ++i) {
      InputSplit split = splits.get(i);
      TaskAttemptID taskID = new TaskAttemptID();
      TaskAttemptContext taskContext = new TaskAttemptContext(hiveConf, taskID);
      if (i % args.splitPrintPeriod == 0) {
        System.err.println("Handling split " + i + " of " + splits.size());
      }
      RecordReader<WritableComparable, HiveReadableRecord> reader =
          defaultInputFormat.createRecordReader(split, taskContext);
      reader.initialize(split, taskContext);
      numRows += readFully(reader);
    }

    System.err.println("Parsed " + numRows + " rows");

    allTimerContext.stop();

    new ConsoleReporter(System.err).run();
  }
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.