/** * Sets the last timestamp. * * @param resource the resource * @param timestamp the timestamp */ private void setLastTimestamp(CollectionResource resource, long timestamp) { ResourcePath path = ResourceTypeUtils.getResourcePathWithRepository(m_repository, resource.getPath()); LOG.debug("Setting timestamp to {} at path {}", timestamp, path); m_resourceStorageDao.setStringAttribute(path, LAST_TIMESTAMP, Long.toString(timestamp)); } }
/** * Gets the last timestamp. * * @param resource the TCA resource * @return the last timestamp */ private long getLastTimestamp(CollectionResource resource) { long timestamp = 0; ResourcePath path = ResourceTypeUtils.getResourcePathWithRepository(m_repository, resource.getPath()); try { LOG.debug("Retrieving timestamp from path {}", path); String ts = m_resourceStorageDao.getStringAttribute(path, LAST_TIMESTAMP); if (ts != null) { timestamp = Long.parseLong(ts); } } catch (Exception e) { LOG.error("Failed to retrieve timestamp from path {}", path, e); } return timestamp; }
/** {@inheritDoc} */ @Override public void persistStringAttribute(CollectionAttribute attribute) { LOG.debug("Persisting {}", attribute); CollectionResource resource = attribute.getResource(); String value = attribute.getStringValue(); if (value == null) { LOG.info("No data collected for attribute {}. Skipping.", attribute); return; } try { ResourcePath path = ResourceTypeUtils.getResourcePathWithRepository(m_repository, resource.getPath()); persistStringAttribute(path, attribute.getName(), value); } catch(PersistException e) { LOG.error("Unable to save string attribute {}.", attribute, e); } }
ResourcePath path = ResourceTypeUtils.getResourcePathWithRepository(m_repository, m_resource.getPath()); retval = m_resourceStorageDao.getStringAttribute(path, ds); if (retval != null) {
public List<Sample> getSamplesToInsert() { final List<Sample> samples = Lists.newLinkedList(); ResourcePath path = ResourceTypeUtils.getResourcePathWithRepository(m_repository, ResourcePath.get(m_resource.getPath(), m_name));
public List<Sample> getSamplesToInsert() { final List<Sample> samples = Lists.newLinkedList(); ResourcePath path = ResourceTypeUtils.getResourcePathWithRepository(m_repository, ResourcePath.get(m_resource.getPath(), m_name));
/** {@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); } }