use of com.yahoo.vespa.model.admin.monitoring.MetricSet in project vespa by vespa-engine.
the class MetricsBuilder method buildMetrics.
public Metrics buildMetrics(Element metricsElement) {
Metrics metrics = new Metrics();
for (Element consumerElement : XML.getChildren(metricsElement, "consumer")) {
String consumerId = consumerElement.getAttribute(ID_ATTRIBUTE);
throwIfIllegalConsumerId(metrics, consumerId);
MetricSet metricSet = buildMetricSet(consumerId, consumerElement);
metrics.addConsumer(new MetricsConsumer(consumerId, metricSet));
}
return metrics;
}
use of com.yahoo.vespa.model.admin.monitoring.MetricSet in project vespa by vespa-engine.
the class DomMetricBuilderHelper method buildMetricsConsumers.
/**
* Build metricConsumer config
*
* @param spec xml element
* @return a map from metric name to a {@link MetricsConsumer}
*/
protected static Map<String, MetricsConsumer> buildMetricsConsumers(Element spec) {
Map<String, MetricsConsumer> metricsConsumers = new LinkedHashMap<>();
List<Element> consumersElem = XML.getChildren(spec, "consumer");
for (Element consumer : consumersElem) {
String consumerName = getConsumerName(consumer);
Set<Metric> metrics = new LinkedHashSet<>();
List<Element> metricsEl = XML.getChildren(consumer, "metric");
if (metricsEl != null) {
for (Element metric : metricsEl) {
String metricName = metric.getAttribute("name");
String outputName = metric.getAttribute("output-name");
metrics.add(new Metric(metricName, outputName));
}
}
MetricsConsumer metricsConsumer = new MetricsConsumer(consumerName, new MetricSet(metricSetId(consumerName), metrics));
metricsConsumers.put(consumerName, metricsConsumer);
}
return metricsConsumers;
}
Aggregations