Package com.netflix.servo

Examples of com.netflix.servo.Metric


        Number num = asNumber(value);
        if (num != null) {
            TagList newTags = counters.matches(MonitorConfig.builder(name).withTags(tags).build())
                ? SortedTagList.builder().withTags(tags).withTag(DataSourceType.COUNTER).build()
                : SortedTagList.builder().withTags(tags).withTag(DataSourceType.GAUGE).build();
            Metric m = new Metric(name, newTags, now, num);
            metrics.add(m);
        }
    }
View Full Code Here


            cache.put(m.getConfig(), normalizedValue);
        }

        double value = normalizedValue.updateAndGet(m.getTimestamp(),
                m.getNumberValue().doubleValue());
        return new Metric(m.getConfig(), stepBoundary, value);
    }
View Full Code Here

        for (Metric m : metrics) {
            long offset = m.getTimestamp() % stepMillis;
            long stepBoundary = m.getTimestamp() - offset;
            String dsType = getDataSourceType(m);
            if (isGauge(dsType) || isNormalized(dsType)) {
                Metric atStepBoundary = new Metric(m.getConfig(), stepBoundary, m.getValue());
                newMetrics.add(atStepBoundary); // gauges are not normalized
            } else if (isRate(dsType)) {
                Metric normalized = normalize(m, stepBoundary);
                if (normalized != null) {
                    newMetrics.add(normalized);
                }
            } else if (!isInformational(dsType)) {
                LOGGER.warn("NormalizationTransform should get only GAUGE and RATE metrics. "
View Full Code Here

        List<Monitor<?>> monitors = cachedMonitors.get();
        List<Metric> metrics = Lists.newArrayListWithCapacity(monitors.size());
        for (Monitor<?> monitor : monitors) {
            Object v = getValue(monitor, reset);
            if (v != null) {
                metrics.add(new Metric(monitor.getConfig(), clock.now(), v));
            }
        }
        return metrics;
    }
View Full Code Here

            if (isCounter(m)) {
                final MonitorConfig rateConfig = toRateConfig(m.getConfig());
                final CounterValue prev = cache.get(rateConfig);
                if (prev != null) {
                    final double rate = prev.computeRate(m);
                    newMetrics.add(new Metric(rateConfig, m.getTimestamp(), rate));
                } else {
                    CounterValue current = new CounterValue(m);
                    cache.put(rateConfig, current);
                    if (intervalMillis > 0L) {
                        final double delta = m.getNumberValue().doubleValue();
                        final double rate = current.computeRate(intervalMillis, delta);
                        newMetrics.add(new Metric(rateConfig, m.getTimestamp(), rate));
                    }
                }
            } else {
                newMetrics.add(m);
            }
View Full Code Here

                    ? DataSourceType.COUNTER : DataSourceType.GAUGE;
            final MonitorConfig monitorConfig = MonitorConfig.builder(name)
                    .withTag(metricType)
                    .withTag(CLASS_TAG)
                    .build();
            Metric metric = new Metric(monitorConfig, timestamp, value);
            return ImmutableList.of(metric);
        }
View Full Code Here

                final MonitorConfig monitorConfig = MonitorConfig.builder(SCOREBOARD)
                        .withTag(DataSourceType.GAUGE)
                        .withTag(CLASS_TAG)
                        .withTag("state", state)
                        .build();
                final Metric metric = new Metric(monitorConfig, timestamp, value);
                builder.add(metric);
            }
            return builder.build();
        }
View Full Code Here

        return metrics.getList();
    }

    private void addClassLoadingMetrics(long timestamp, MetricList metrics) {
        ClassLoadingMXBean bean = ManagementFactory.getClassLoadingMXBean();
        metrics.add(new Metric(LOADED_CLASS_COUNT,
                timestamp, bean.getLoadedClassCount()));
        metrics.add(new Metric(TOTAL_LOADED_CLASS_COUNT,
                timestamp, bean.getTotalLoadedClassCount()));
        metrics.add(new Metric(UNLOADED_CLASS_COUNT,
                timestamp, bean.getUnloadedClassCount()));
    }
View Full Code Here

                timestamp, bean.getUnloadedClassCount()));
    }

    private void addCompilationMetrics(long timestamp, MetricList metrics) {
        CompilationMXBean bean = ManagementFactory.getCompilationMXBean();
        metrics.add(new Metric(TOTAL_COMPILATION_TIME, timestamp, bean.getTotalCompilationTime()));
    }
View Full Code Here

    private void addGarbageCollectorMetrics(long timestamp, MetricList metrics) {
        final List<GarbageCollectorMXBean> beans = ManagementFactory.getGarbageCollectorMXBeans();
        for (GarbageCollectorMXBean bean : beans) {
            final Tag id = new BasicTag("id", bean.getName());
            metrics.add(new Metric(COLLECTION_COUNT.withAdditionalTag(id),
                    timestamp, bean.getCollectionCount()));
            metrics.add(new Metric(COLLECTION_TIME.withAdditionalTag(id),
                    timestamp, bean.getCollectionTime()));
        }
    }
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.