Examples of IMetricsScope


Examples of com.amazonaws.services.kinesis.metrics.interfaces.IMetricsScope

     *
     * @throws InvalidStateException
     * @throws DependencyException
     */
    protected void runTaker() throws DependencyException, InvalidStateException {
        IMetricsScope scope = MetricsHelper.startScope(metricsFactory, "TakeLeases");
        long startTime = System.currentTimeMillis();
        boolean success = false;

        try {
            Map<String, T> takenLeases = leaseTaker.takeLeases();

            leaseRenewer.addLeasesToRenew(takenLeases.values());
            success = true;
        } finally {
            scope.addDimension(WORKER_IDENTIFIER_METRIC, getWorkerIdentifier());
            MetricsHelper.addSuccessAndLatency(startTime, success);
            MetricsHelper.endScope();
        }
    }
View Full Code Here

Examples of com.amazonaws.services.kinesis.metrics.interfaces.IMetricsScope

     *
     * @throws InvalidStateException
     * @throws DependencyException
     */
    protected void runRenewer() throws DependencyException, InvalidStateException {
        IMetricsScope scope = MetricsHelper.startScope(metricsFactory, "RenewAllLeases");
        long startTime = System.currentTimeMillis();
        boolean success = false;

        try {
            leaseRenewer.renewLeases();
            success = true;
        } finally {
            scope.addDimension(WORKER_IDENTIFIER_METRIC, getWorkerIdentifier());
            MetricsHelper.addSuccessAndLatency(startTime, success);
            MetricsHelper.endScope();
        }
    }
View Full Code Here

Examples of com.amazonaws.services.kinesis.metrics.interfaces.IMetricsScope

        this.other = other;
    }

    @Override
    public IMetricsScope createMetrics() {
        IMetricsScope otherScope = other.createMetrics();
        interceptCreateMetrics(otherScope);
        return new InterceptingMetricsScope(otherScope);
    }
View Full Code Here

Examples of com.amazonaws.services.kinesis.metrics.interfaces.IMetricsScope

    public static IMetricsScope startScope(IMetricsFactory factory) {
        return startScope(factory, null);
    }

    public static IMetricsScope startScope(IMetricsFactory factory, String operation) {
        IMetricsScope result = currentScope.get();
        if (result == null) {
            result = factory.createMetrics();
            if (operation != null) {
                result.addDimension(OPERATION_DIMENSION_NAME, operation);
            }
            currentScope.set(result);
            referenceCount.set(1);
        } else {
            referenceCount.set(referenceCount.get() + 1);
View Full Code Here

Examples of com.amazonaws.services.kinesis.metrics.interfaces.IMetricsScope

        return result;
    }

    public static IMetricsScope getMetricsScope() {
        IMetricsScope result = currentScope.get();
        if (result == null) {
            LOG.warn(String.format("No metrics scope set in thread %s, getMetricsScope returning NullMetricsScope.",
                    Thread.currentThread().getName()));

            return NULL_METRICS_SCOPE;
View Full Code Here

Examples of com.amazonaws.services.kinesis.metrics.interfaces.IMetricsScope

    public static void addSuccessAndLatencyPerShard (
            String shardId,
            String prefix,
            long startTimeMillis,
            boolean success) {
        IMetricsScope scope = getMetricsScope();

        String realPrefix = prefix == null ? "" : prefix + SEP;
       
        if (shardId != null) {
            scope.addDimension("ShardId", shardId);
        }

        scope.addData(realPrefix + MetricsHelper.SUCCESS, success ? 1 : 0, StandardUnit.Count);
        scope.addData(realPrefix + MetricsHelper.TIME,
                System.currentTimeMillis() - startTimeMillis,
                StandardUnit.Milliseconds);
    }
View Full Code Here

Examples of com.amazonaws.services.kinesis.metrics.interfaces.IMetricsScope

                System.currentTimeMillis() - startTimeMillis,
                StandardUnit.Milliseconds);
    }

    public static void endScope() {
        IMetricsScope scope = getMetricsScope();
        if (scope != null) {
            Integer refCount = referenceCount.get();
            refCount--;

            if (refCount == 0) {
                scope.end();
                currentScope.remove();
            }
        }
    }
View Full Code Here

Examples of com.amazonaws.services.kinesis.metrics.interfaces.IMetricsScope

     */
    // CHECKSTYLE:OFF CyclomaticComplexity
    @Override
    public TaskResult call() {
        long startTimeMillis = System.currentTimeMillis();
        IMetricsScope scope = MetricsHelper.getMetricsScope();
        scope.addDimension("ShardId", shardInfo.getShardId());
        scope.addData(RECORDS_PROCESSED_METRIC, 0, StandardUnit.Count);
        scope.addData(DATA_BYTES_PROCESSED_METRIC, 0, StandardUnit.Bytes);

        Exception exception = null;

        try {
            if (dataFetcher.isShardEndReached()) {
View Full Code Here

Examples of com.amazonaws.services.kinesis.metrics.interfaces.IMetricsScope

                    target,
                    myCount,
                    leasesToTake.size()));
        }
       
        IMetricsScope metrics = MetricsHelper.getMetricsScope();
        metrics.addData("TotalLeases", numLeases, StandardUnit.Count);
        metrics.addData("ExpiredLeases", originalExpiredLeasesSize, StandardUnit.Count);
        metrics.addData("NumWorkers", numWorkers, StandardUnit.Count);
        metrics.addData("NeededLeases", numLeasesToReachTarget, StandardUnit.Count);
        metrics.addData("LeasesToTake", leasesToTake.size(), StandardUnit.Count);

        return leasesToTake;
    }
View Full Code Here

Examples of com.amazonaws.services.kinesis.metrics.interfaces.IMetricsScope

     */
    // CHECKSTYLE:OFF CyclomaticComplexity
    @Override
    public TaskResult call() {
        long startTimeMillis = System.currentTimeMillis();
        IMetricsScope scope = MetricsHelper.getMetricsScope();
        scope.addDimension("ShardId", shardInfo.getShardId());
        scope.addData(RECORDS_PROCESSED_METRIC, 0, StandardUnit.Count);
        scope.addData(DATA_BYTES_PROCESSED_METRIC, 0, StandardUnit.Bytes);

        Exception exception = null;

        try {
            if (dataFetcher.isShardEndReached()) {
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.