/** {@inheritDoc} */ @Override public AttributeType getType() { return m_wrapped.getType(); } }
@Override public void visitAttribute(CollectionAttribute attribute) { if (AttributeType.STRING.equals(attribute.getType()) && attributeName.equals(attribute.getName())) attributeValue = attribute.getStringValue(); } }
if (!AttributeType.COUNTER.equals(m_attributes.get(ds).getType())) { LOG.debug("getAttributeValue: id={}, value= {}", id, current); return current;
@Override public void visitAttribute(CollectionAttribute attribute) { if (!attribute.getType().isNumeric()) { context.setVariable(attribute.getName(), attribute.getStringValue()); } }
/** {@inheritDoc} */ @Override public void persistNumericAttribute(CollectionAttribute attribute) { boolean shouldIgnorePersist = isIgnorePersist() && AttributeType.COUNTER.equals(attribute.getType()); LOG.debug("Persisting {} {}", attribute, (shouldIgnorePersist ? ". Ignoring value because of sysUpTime changed." : "")); Number value = shouldIgnorePersist ? Double.NaN : attribute.getNumericValue(); m_builder.setAttributeValue(attribute.getAttributeType(), value); m_builder.setAttributeMetadata(attribute.getMetricIdentifier(), attribute.getName()); }
@Override public void visitAttribute(CollectionAttribute attribute) { if (attribute.getType().equals(AttributeType.STRING)) { CollectionSetProtos.StringAttribute.Builder attributeBuilder = CollectionSetProtos.StringAttribute .newBuilder(); attributeBuilder.setValue(attribute.getStringValue()); attributeBuilder.setName(attribute.getName()); collectionSetResourceBuilder.addString(attributeBuilder); } else { CollectionSetProtos.NumericAttribute.Builder attributeBuilder = CollectionSetProtos.NumericAttribute .newBuilder(); attributeBuilder.setGroup(lastGroupName); attributeBuilder.setName(attribute.getName()); attributeBuilder.setValue(attribute.getNumericValue().longValue()); attributeBuilder.setType((attribute.getType() == AttributeType.GAUGE) ? Type.GAUGE : Type.COUNTER); collectionSetResourceBuilder.addNumeric(attributeBuilder); } }
@Override public void visitAttribute(CollectionAttribute attribute) { if (attribute.getType().equals(AttributeType.STRING)) { CollectionSetProtos.StringAttribute.Builder attributeBuilder = CollectionSetProtos.StringAttribute .newBuilder(); attributeBuilder.setValue(attribute.getStringValue()); attributeBuilder.setName(attribute.getName()); collectionSetResourceBuilder.addString(attributeBuilder); } else { CollectionSetProtos.NumericAttribute.Builder attributeBuilder = CollectionSetProtos.NumericAttribute .newBuilder(); attributeBuilder.setGroup(lastGroupName); attributeBuilder.setName(attribute.getName()); attributeBuilder.setValue(attribute.getNumericValue().longValue()); attributeBuilder.setType((attribute.getType() == AttributeType.GAUGE) ? Type.GAUGE : Type.COUNTER); collectionSetResourceBuilder.addNumeric(attributeBuilder); } }
private void addGroupToBuilder(CollectionSetBuilder builder, Resource resource, AttributeGroup group) { for (CollectionAttribute attribute : group.getAttributes()) { String value; if(!attribute.shouldPersist(params)){ continue; } else if (attribute.getAttributeType() instanceof HexStringAttributeType) { value = ((SnmpAttribute) attribute).getValue().toHexString(); } else { value = attribute.getStringValue(); } builder.withAttribute(resource, group.getName(), attribute.getName(), value, attribute.getType()); } } }
/** {@inheritDoc} */ @Override public void visitGroup(AttributeGroup group) { pushShouldPersist(group); if (shouldPersist()) { Map<String, String> dsNamesToRrdNames = new LinkedHashMap<String , String>(); for (CollectionAttribute a : group.getAttributes()) { if (a.getType().isNumeric()) { dsNamesToRrdNames.put(a.getName(), group.getName()); } } setBuilder(createBuilder(group.getResource(), group.getName(), group.getGroupType().getAttributeTypes())); ResourcePath path = ResourceTypeUtils.getResourcePathWithRepository(getRepository(), group.getResource().getPath()); m_resourceStorageDao.updateMetricToResourceMappings(path, dsNamesToRrdNames); } }
/** {@inheritDoc} */ @Override public void visitGroup(AttributeGroup group) { pushShouldPersist(group); if (shouldPersist()) { Map<String, String> dsNamesToRrdNames = new LinkedHashMap<String , String>(); for (CollectionAttribute a : group.getAttributes()) { if (a.getType().isNumeric()) { dsNamesToRrdNames.put(a.getName(), group.getName()); } } setBuilder(createBuilder(group.getResource(), group.getName(), group.getGroupType().getAttributeTypes())); ResourcePath path = ResourceTypeUtils.getResourcePathWithRepository(getRepository(), group.getResource().getPath()); m_resourceStorageDao.updateMetricToResourceMappings(path, dsNamesToRrdNames); } }