Package com.netflix.servo

Examples of com.netflix.servo.Metric


        }
    }

    private void addMemoryUsageMetrics(
            TagList tags, long timestamp, MemoryUsage usage, MetricList metrics) {
        metrics.add(new Metric(COMMITTED_USAGE.withAdditionalTags(tags),
                timestamp, usage.getCommitted()));
        metrics.add(new Metric(INIT_USAGE.withAdditionalTags(tags), timestamp, usage.getInit()));
        metrics.add(new Metric(ACTUAL_USAGE.withAdditionalTags(tags), timestamp, usage.getUsed()));
        metrics.add(new Metric(MAX_USAGE.withAdditionalTags(tags), timestamp, usage.getMax()));
    }
View Full Code Here


        metrics.add(new Metric(MAX_USAGE.withAdditionalTags(tags), timestamp, usage.getMax()));
    }

    private void addOperatingSystemMetrics(long timestamp, MetricList metrics) {
        OperatingSystemMXBean bean = ManagementFactory.getOperatingSystemMXBean();
        metrics.add(new Metric(AVAILABLE_PROCESSORS, timestamp, bean.getAvailableProcessors()));
        metrics.add(new Metric(LOAD_AVERAGE, timestamp, bean.getSystemLoadAverage()));
        addOptionalMetric(MAX_FILE_DESCRIPTOR_COUNT,
                timestamp, bean, "getMaxFileDescriptorCount", metrics);
        addOptionalMetric(OPEN_FILE_DESCRIPTOR_COUNT,
                timestamp, bean, "getOpenFileDescriptorCount", metrics);
        addOptionalMetric(COMMITTED_VIRTUAL_MEMORY_SIZE,
View Full Code Here

                timestamp, bean, "getSystemCpuLoad", metrics);
    }

    private void addThreadMetrics(long timestamp, MetricList metrics) {
        ThreadMXBean bean = ManagementFactory.getThreadMXBean();
        metrics.add(new Metric(DAEMON_THREAD_COUNT, timestamp, bean.getDaemonThreadCount()));
        metrics.add(new Metric(TOTAL_STARTED_THREAD_COUNT,
                timestamp, bean.getTotalStartedThreadCount()));
        addDetailedThreadMetrics(timestamp, metrics);
    }
View Full Code Here

            blockedCount += threadInfo[i].getBlockedCount();
            blockedTime += threadInfo[i].getBlockedTime();
            waitedCount += threadInfo[i].getWaitedCount();
            waitedTime += threadInfo[i].getWaitedTime();
        }
        metrics.add(new Metric(THREAD_BLOCKED_COUNT,
                timestamp, blockedCount + BASE_THREAD_COUNTS[IDX_BLOCKED_COUNT]));
        metrics.add(new Metric(THREAD_BLOCKED_TIME,
                timestamp, (blockedTime + BASE_THREAD_COUNTS[IDX_BLOCKED_TIME]) / 1000));
        metrics.add(new Metric(THREAD_WAITED_COUNT,
                timestamp, waitedCount + BASE_THREAD_COUNTS[IDX_WAITED_COUNT]));
        metrics.add(new Metric(THREAD_WAITED_TIME,
                timestamp, (waitedTime + BASE_THREAD_COUNTS[IDX_WAITED_TIME]) / 1000));
        for (int i = 0; i < stateCounts.length; i++) {
            metrics.add(new Metric(THREAD_COUNTS[i], timestamp, stateCounts[i]));
        }
        lastThreadInfos = threadInfo;
    }
View Full Code Here

            MetricList metrics) {
        try {
            Method method = obj.getClass().getMethod(methodName);
            method.setAccessible(true);
            Number value = (Number) method.invoke(obj);
            metrics.add(new Metric(config, timestamp, value));
        } catch (Exception e) {
            final String msg = String.format("failed to get value for %s.%s",
                    obj.getClass().getName(), methodName);
            LOGGER.debug(msg, e);
        }
View Full Code Here

        List<Metric> batch = new ArrayList<Metric>(batchSize);
        int batchCount = 1;

        while (metrics.size() > 0) {
            Metric m = metrics.remove(0);
            if (m.hasNumberValue()) {
                batch.add(m);

                if (batchCount++ % batchSize == 0) {
                    putMetricData(batch);
                    batch.clear();
View Full Code Here

    }

    private static Metric metric(String name, double value, Tag metricType) {
        MonitorConfig config = MonitorConfig.builder(name).withTag(metricType)
                .withTag("class", "ApacheStatusPoller").build();
        return new Metric(config, TIMESTAMP, value);
    }
View Full Code Here

    private static Metric scoreboard(String state, double value) {
        MonitorConfig config = MonitorConfig.builder("Scoreboard")
                .withTag(DataSourceType.GAUGE)
                .withTag("state", state)
                .withTag("class", "ApacheStatusPoller").build();
        return new Metric(config, TIMESTAMP, value);
    }
View Full Code Here

        ApacheStatusPoller poller = new ApacheStatusPoller(fetcher);

        List<Metric> metrics = poller.pollImpl(false, TIMESTAMP);

        Metric accesses = counter("Total_Accesses", TOTAL_ACCESSES);
        Metric kBytes = counter("Total_kBytes", KBYTES);
        Metric uptime = counter("Uptime", UPTIME);

        List<Metric> counters = ImmutableList.of(accesses, kBytes, uptime);
        Metric rps = gauge("ReqPerSec", RPS);
        Metric bps = gauge("BytesPerSec", BPS);
        Metric bpr = gauge("BytesPerReq", BPR);
        Metric busyWorkers = gauge("BusyWorkers", BUSY_WORKERS);
        Metric idleWorkers = gauge("IdleWorkers", IDLE_WORKERS);
        List<Metric> gauges = ImmutableList.of(rps, bps, bpr, busyWorkers, idleWorkers);

        Metric waitingForConnection = scoreboard("WaitingForConnection", 45.0);
        Metric startingUp = scoreboard("StartingUp", 0.0);
        Metric readingRequest = scoreboard("ReadingRequest", 0.0);
        Metric sendingReply = scoreboard("SendingReply", 1.0);
        Metric keepalive = scoreboard("Keepalive", 4.0);
        Metric dnsLookup = scoreboard("DnsLookup", 0.0);
        Metric closingConnection = scoreboard("ClosingConnection", 0.0);
        Metric logging = scoreboard("Logging", 0.0);
        Metric gracefullyFinishing = scoreboard("GracefullyFinishing", 0.0);
        Metric idleCleanupOfWorker = scoreboard("IdleCleanupOfWorker", 0.0);
        Metric unknownState = scoreboard("UnknownState", 0.0);
        List<Metric> scoreboard = ImmutableList.of(waitingForConnection,
                startingUp, readingRequest, sendingReply, keepalive, dnsLookup, closingConnection,
                logging, gracefullyFinishing, idleCleanupOfWorker, unknownState);

        List<Metric> expected = new ImmutableList.Builder<Metric>()
View Full Code Here

     */
    @Test
    public void testUpdate() throws Exception {
        List<Metric> metrics = new ArrayList<Metric>(NUM_METRICS);
        for (int i = 0; i < NUM_METRICS; i++) {
            metrics.add(new Metric("test", BasicTagList.EMPTY, System.currentTimeMillis(), VALUE));
        }

        try {
            observer.update(metrics);
        } catch (AmazonClientException e) {
View Full Code Here

TOP

Related Classes of com.netflix.servo.Metric

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.