Package com.netflix.servo.tag

Examples of com.netflix.servo.tag.TagList


            TagList tags,
            Object value) {
        long now = System.currentTimeMillis();
        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


            MetricFilter filter,
            List<Metric> metrics,
            ObjectName name)
            throws JMException, IOException {
        // Create tags from the object name
        TagList tags = createTagList(name);
        MBeanInfo info = con.getMBeanInfo(name);
        MBeanAttributeInfo[] attrInfos = info.getAttributes();

        // Restrict to attributes that match the filter
        List<String> matchingNames = Lists.newArrayList();
        for (MBeanAttributeInfo attrInfo : attrInfos) {
            String attrName = attrInfo.getName();
            if (filter.matches(new MonitorConfig.Builder(attrName).withTags(tags).build())) {
                matchingNames.add(attrName);
            }
        }
        List<Attribute> attributeList = safelyLoadAttributes(con, name, matchingNames);

        for (Attribute attr : attributeList) {
            String attrName = attr.getName();
            Object obj = attr.getValue();
            if (obj instanceof CompositeData) {
                Map<String, Object> values = Maps.newHashMap();
                extractValues(null, values, (CompositeData) obj);
                for (Map.Entry<String, Object> e : values.entrySet()) {
                    String key = e.getKey();
                    TagList newTags = SortedTagList.builder()
                        .withTags(tags)
                        .withTag(COMPOSITE_PATH_KEY, key)
                        .build();
                    if (filter.matches(MonitorConfig.builder(attrName).withTags(newTags).build())) {
                        addMetric(metrics, attrName, newTags, e.getValue());
View Full Code Here

    }

    /** {@inheritDoc} */
    public boolean matches(MonitorConfig config) {
        String name = config.getName();
        TagList tags = config.getTags();
        String value;
        if (tagKey == null) {
            value = name;
        } else {
            Tag t = tags.getTag(tagKey);
            value = (t == null) ? null : t.getValue();
        }

        boolean match = matchIfMissingTag;
        if (value != null) {
View Full Code Here

            }
        };
    }

    private static String getDataSourceType(Metric m) {
        final TagList tags = m.getConfig().getTags();
        final String value = tags.getValue(DataSourceType.KEY);
        if (value != null) {
            return value;
        } else {
            return DEFAULT_DSTYPE;
        }
View Full Code Here

    private MonitorConfig toRateConfig(MonitorConfig config) {
        return config.withAdditionalTag(RATE_TAG);
    }

    private boolean isCounter(Metric m) {
        final TagList tags = m.getConfig().getTags();
        final String value = tags.getValue(DataSourceType.KEY);
        return value != null && COUNTER_VALUE.equals(value);
    }
View Full Code Here

    }

    /** {@inheritDoc} */
    @Override
    public MonitorConfig getConfig() {
        TagList contextTags = context.getTags();
        return MonitorConfig.builder(baseConfig.getName())
            .withTags(baseConfig.getTags())
            .withTags(contextTags)
            .build();
    }
View Full Code Here

     *             {@link CompositeMonitor#getMonitors()}.
     *
     * @return     composite monitor based on the fields of the class
     */
    public static CompositeMonitor<?> newObjectMonitor(String id, Object obj) {
        final TagList tags = getMonitorTags(obj);

        List<Monitor<?>> monitors = Lists.newArrayList();
        addMonitors(monitors, id, tags, obj);

        final Class<?> c = obj.getClass();
View Full Code Here

                builder.withTags(tags);
            }
            if (id != null) {
                builder.withTag("id", id);
            }
            final TagList classTags = builder.build();

            final Field[] fields = c.getDeclaredFields();
            for (Field field : fields) {
                if (isMonitorType(field.getType())) {
                    field.setAccessible(true);
View Full Code Here

                        final String totalTagName,
                        final boolean autoStart,
                        final Tag... additionalTags) {
        super(config);
        final Tag statsTotal = Tags.newTag(STATISTIC, totalTagName);
        TagList additionalTagList = new BasicTagList(Arrays.asList(additionalTags));
        this.baseConfig = config.withAdditionalTags(additionalTagList);
        this.cur = new StatsBuffer(statsConfig.getSampleSize(), statsConfig.getPercentiles());
        this.prev = new StatsBuffer(statsConfig.getSampleSize(), statsConfig.getPercentiles());
        this.count = new BasicCounter(baseConfig.withAdditionalTag(STAT_COUNT));
        this.totalMeasurement = new BasicCounter(baseConfig.withAdditionalTag(statsTotal));
View Full Code Here

    }

    private void addMemoryPoolMetrics(long timestamp, MetricList metrics) {
        final List<MemoryPoolMXBean> beans = ManagementFactory.getMemoryPoolMXBeans();
        for (MemoryPoolMXBean bean : beans) {
            final TagList tags = BasicTagList.of("id", bean.getName(),
                    "memtype", bean.getType().name());
            addMemoryUsageMetrics(tags, timestamp, bean.getUsage(), metrics);
        }
    }
View Full Code Here

TOP

Related Classes of com.netflix.servo.tag.TagList

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.