Search in sources :

Example 1 with MetricsConsumer

use of com.yahoo.vespa.model.admin.monitoring.MetricsConsumer 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 MetricsConsumer

use of com.yahoo.vespa.model.admin.monitoring.MetricsConsumer 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)

Example 3 with MetricsConsumer

use of com.yahoo.vespa.model.admin.monitoring.MetricsConsumer in project vespa by vespa-engine.

the class ContentCluster method getConfig.

@Override
public void getConfig(MetricsmanagerConfig.Builder builder) {
    Monitoring monitoring = getMonitoringService();
    if (monitoring != null) {
        builder.snapshot(new MetricsmanagerConfig.Snapshot.Builder().periods(monitoring.getIntervalSeconds()).periods(300));
    }
    builder.consumer(new MetricsmanagerConfig.Consumer.Builder().name("status").addedmetrics("*").removedtags("partofsum"));
    builder.consumer(new MetricsmanagerConfig.Consumer.Builder().name("log").tags("logdefault").removedtags("loadtype"));
    builder.consumer(new MetricsmanagerConfig.Consumer.Builder().name("yamas").tags("yamasdefault").removedtags("loadtype"));
    builder.consumer(new MetricsmanagerConfig.Consumer.Builder().name("health"));
    builder.consumer(new MetricsmanagerConfig.Consumer.Builder().name("fleetcontroller"));
    builder.consumer(new MetricsmanagerConfig.Consumer.Builder().name("statereporter").addedmetrics("*").removedtags("thread").tags("disk"));
    Map<String, MetricsConsumer> consumers = getRoot().getAdmin().getLegacyUserMetricsConsumers();
    if (consumers != null) {
        for (Map.Entry<String, MetricsConsumer> e : consumers.entrySet()) {
            MetricsmanagerConfig.Consumer.Builder b = getMetricBuilder(e.getKey(), builder);
            for (Metric m : e.getValue().getMetrics().values()) {
                b.addedmetrics(m.name);
            }
        }
    }
}
Also used : ContainerModelBuilder(com.yahoo.vespa.model.container.xml.ContainerModelBuilder) MetricsConsumer(com.yahoo.vespa.model.admin.monitoring.MetricsConsumer) MetricsConsumer(com.yahoo.vespa.model.admin.monitoring.MetricsConsumer) Metric(com.yahoo.vespa.model.admin.monitoring.Metric) MetricsmanagerConfig(com.yahoo.metrics.MetricsmanagerConfig) Monitoring(com.yahoo.vespa.model.admin.monitoring.Monitoring)

Example 4 with MetricsConsumer

use of com.yahoo.vespa.model.admin.monitoring.MetricsConsumer in project vespa by vespa-engine.

the class DomAdminBuilderBase method doBuild.

@Override
protected Admin doBuild(AbstractConfigProducer parent, Element adminElement) {
    Monitoring monitoring = getMonitoring(getChildWithFallback(adminElement, "monitoring", "yamas"));
    Metrics metrics = new MetricsBuilder(applicationType, predefinedMetricSets).buildMetrics(XML.getChild(adminElement, "metrics"));
    Map<String, MetricsConsumer> legacyMetricsConsumers = DomMetricBuilderHelper.buildMetricsConsumers(XML.getChild(adminElement, "metric-consumers"));
    FileDistributionConfigProducer fileDistributionConfigProducer = getFileDistributionConfigProducer(parent);
    Admin admin = new Admin(parent, monitoring, metrics, legacyMetricsConsumers, multitenant, fileDistributionConfigProducer);
    admin.setApplicationType(applicationType);
    doBuildAdmin(admin, adminElement);
    new ModelConfigProvider(admin);
    return admin;
}
Also used : FileDistributionConfigProducer(com.yahoo.vespa.model.filedistribution.FileDistributionConfigProducer) Metrics(com.yahoo.vespa.model.admin.monitoring.builder.Metrics) MetricsConsumer(com.yahoo.vespa.model.admin.monitoring.MetricsConsumer) DefaultMonitoring(com.yahoo.vespa.model.admin.monitoring.DefaultMonitoring) Monitoring(com.yahoo.vespa.model.admin.monitoring.Monitoring) MetricsBuilder(com.yahoo.vespa.model.admin.monitoring.builder.xml.MetricsBuilder)

Example 5 with MetricsConsumer

use of com.yahoo.vespa.model.admin.monitoring.MetricsConsumer in project vespa by vespa-engine.

the class DedicatedAdminV4Test method testModelBuilding.

@Test
public void testModelBuilding() throws IOException, SAXException {
    String services = "<services>" + "  <admin version='4.0'>" + "    <slobroks><nodes count='2' dedicated='true'/></slobroks>" + "    <logservers><nodes count='1' dedicated='true'/></logservers>" + "    <yamas systemname='vespa.routing' interval='60' />" + "    <metrics>" + "     <consumer id='slingstone'>" + "        <metric id='foobar.count' display-name='foobar'/>" + "     </consumer>" + "    </metrics>" + "    <metric-consumers>" + "      <consumer name='yamas'>" + "        <metric name='upstreams_generated' />" + "        <metric name='upstreams_nginx_reloads' />" + "        <metric name='nginx.upstreams.down.last' output-name='nginx.upstreams.down'/>" + "      </consumer>" + "    </metric-consumers>" + "    <identity>" + "        <domain>mydomain</domain>" + "        <service>myservice</service>" + "    </identity>" + "  </admin>" + "</services>";
    VespaModel model = createModel(hosts, services);
    assertEquals(3, model.getHosts().size());
    assertHostContainsServices(model, "hosts/myhost0", "slobrok", "logd");
    assertHostContainsServices(model, "hosts/myhost1", "slobrok", "logd");
    assertHostContainsServices(model, "hosts/myhost2", "logserver", "logd");
    Monitoring monitoring = model.getAdmin().getMonitoring();
    assertEquals("vespa.routing", monitoring.getClustername());
    assertEquals(60L, (long) monitoring.getIntervalSeconds());
    MetricsConsumer consumer = model.getAdmin().getUserMetrics().getConsumers().get("slingstone");
    assertNotNull(consumer);
    Metric metric = consumer.getMetrics().get("foobar.count");
    assertNotNull(metric);
    assertEquals("foobar", metric.outputName);
    consumer = model.getAdmin().getLegacyUserMetricsConsumers().get(VESPA_CONSUMER_ID);
    assertNotNull(consumer);
    assertEquals(3, consumer.getMetrics().size());
    metric = consumer.getMetrics().get("nginx.upstreams.down.last");
    assertNotNull(metric);
    assertEquals("nginx.upstreams.down", metric.outputName);
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) MetricsConsumer(com.yahoo.vespa.model.admin.monitoring.MetricsConsumer) Metric(com.yahoo.vespa.model.admin.monitoring.Metric) Monitoring(com.yahoo.vespa.model.admin.monitoring.Monitoring) Test(org.junit.Test)

Aggregations

MetricsConsumer (com.yahoo.vespa.model.admin.monitoring.MetricsConsumer)5 Metric (com.yahoo.vespa.model.admin.monitoring.Metric)3 Monitoring (com.yahoo.vespa.model.admin.monitoring.Monitoring)3 MetricSet (com.yahoo.vespa.model.admin.monitoring.MetricSet)2 Metrics (com.yahoo.vespa.model.admin.monitoring.builder.Metrics)2 Element (org.w3c.dom.Element)2 MetricsmanagerConfig (com.yahoo.metrics.MetricsmanagerConfig)1 VespaModel (com.yahoo.vespa.model.VespaModel)1 DefaultMonitoring (com.yahoo.vespa.model.admin.monitoring.DefaultMonitoring)1 DefaultVespaMetrics (com.yahoo.vespa.model.admin.monitoring.DefaultVespaMetrics)1 DefaultVespaMetrics.defaultVespaMetricSet (com.yahoo.vespa.model.admin.monitoring.DefaultVespaMetrics.defaultVespaMetricSet)1 SystemMetrics.systemMetricSet (com.yahoo.vespa.model.admin.monitoring.SystemMetrics.systemMetricSet)1 MetricsBuilder (com.yahoo.vespa.model.admin.monitoring.builder.xml.MetricsBuilder)1 ContainerModelBuilder (com.yahoo.vespa.model.container.xml.ContainerModelBuilder)1 FileDistributionConfigProducer (com.yahoo.vespa.model.filedistribution.FileDistributionConfigProducer)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 Test (org.junit.Test)1