Esempio n. 1
0
void HostHealthMonitor::loadMetrics() {
  for (auto const metric : GetHealthMonitorMetrics()) {
    if (metric->enabled()) {
      registerMetric(metric);
    }
  }
}
Esempio n. 2
0
LoadMetric<MetricType>::LoadMetric(const LoadMetric<MetricType>& other, MetricSet* owner)
    : MetricSet(other.getName(), {}, other.getDescription(), owner),
      _metrics(),
      _sum("sum", {{"loadsum"},{"sum"}}, "Sum of all load metrics", this)
{
    _metrics.resize(2 * other._metrics.size());
    setTags(other.getTags());
    Tags noTags;
    for (const auto & metric : other._metrics) {
        MetricTypeUP copy(dynamic_cast<MetricType*>(metric.second->clone(_ownerList, CLONE, 0, false)));
        assert(copy.get());
        copy->setName(metric.second->getName());
        copy->setTags(noTags);
        registerMetric(*copy);
        _sum.addMetricToSum(*copy);
        _metrics[metric.first] = std::move(copy);
    }
    _ownerList.shrink_to_fit();
}
Esempio n. 3
0
LoadMetric<MetricType>::LoadMetric(const LoadTypeSet& loadTypes, const MetricType& metric, MetricSet* owner)
    : MetricSet(metric.getName(), {}, metric.getDescription(), owner),
      _metrics(),
      _sum("sum", {{"loadsum"},{"sum"}}, "Sum of all load metrics", this)
{
    _metrics.resize(loadTypes.size());
        // Currently, we only set tags and description on the metric set
        // itself, to cut down on size of output when downloading metrics,
        // and since matching tags of parent is just as good as matching
        // them specifically.
    setTags(metric.getTags());
    Tags noTags;
    for (uint32_t i=0; i<loadTypes.size(); ++i) {
        MetricTypeUP copy(dynamic_cast<MetricType*>(metric.clone(_ownerList, CLONE, 0, false)));
        assert(copy.get());
        copy->setName(loadTypes[i].getName());
        copy->setTags(noTags);
        registerMetric(*copy);
        _sum.addMetricToSum(*copy);
        _metrics[loadTypes[i].getId()] = std::move(copy);
    }
    _ownerList.shrink_to_fit();
}