Search in sources :

Example 1 with MetricSet

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;
}
Also used : Metrics(com.yahoo.vespa.model.admin.monitoring.builder.Metrics) DefaultVespaMetrics(com.yahoo.vespa.model.admin.monitoring.DefaultVespaMetrics) Element(org.w3c.dom.Element) MetricsConsumer(com.yahoo.vespa.model.admin.monitoring.MetricsConsumer) MetricSet(com.yahoo.vespa.model.admin.monitoring.MetricSet) SystemMetrics.systemMetricSet(com.yahoo.vespa.model.admin.monitoring.SystemMetrics.systemMetricSet) DefaultVespaMetrics.defaultVespaMetricSet(com.yahoo.vespa.model.admin.monitoring.DefaultVespaMetrics.defaultVespaMetricSet)

Example 2 with MetricSet

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;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) MetricsConsumer(com.yahoo.vespa.model.admin.monitoring.MetricsConsumer) Element(org.w3c.dom.Element) Metric(com.yahoo.vespa.model.admin.monitoring.Metric) LinkedHashMap(java.util.LinkedHashMap) MetricSet(com.yahoo.vespa.model.admin.monitoring.MetricSet)

Aggregations

MetricSet (com.yahoo.vespa.model.admin.monitoring.MetricSet)2 MetricsConsumer (com.yahoo.vespa.model.admin.monitoring.MetricsConsumer)2 Element (org.w3c.dom.Element)2 DefaultVespaMetrics (com.yahoo.vespa.model.admin.monitoring.DefaultVespaMetrics)1 DefaultVespaMetrics.defaultVespaMetricSet (com.yahoo.vespa.model.admin.monitoring.DefaultVespaMetrics.defaultVespaMetricSet)1 Metric (com.yahoo.vespa.model.admin.monitoring.Metric)1 SystemMetrics.systemMetricSet (com.yahoo.vespa.model.admin.monitoring.SystemMetrics.systemMetricSet)1 Metrics (com.yahoo.vespa.model.admin.monitoring.builder.Metrics)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1