Search in sources :

Example 1 with DockerHostCapacity

use of com.yahoo.vespa.hosted.provision.provisioning.DockerHostCapacity in project vespa by vespa-engine.

the class MetricsReporter method updateDockerMetrics.

private void updateDockerMetrics(List<Node> nodes) {
    // Capacity flavors for docker
    DockerHostCapacity capacity = new DockerHostCapacity(nodes);
    metric.set("hostedVespa.docker.totalCapacityCpu", capacity.getCapacityTotal().getCpu(), null);
    metric.set("hostedVespa.docker.totalCapacityMem", capacity.getCapacityTotal().getMemory(), null);
    metric.set("hostedVespa.docker.totalCapacityDisk", capacity.getCapacityTotal().getDisk(), null);
    metric.set("hostedVespa.docker.freeCapacityCpu", capacity.getFreeCapacityTotal().getCpu(), null);
    metric.set("hostedVespa.docker.freeCapacityMem", capacity.getFreeCapacityTotal().getMemory(), null);
    metric.set("hostedVespa.docker.freeCapacityDisk", capacity.getFreeCapacityTotal().getDisk(), null);
    List<Flavor> dockerFlavors = nodeRepository().getAvailableFlavors().getFlavors().stream().filter(f -> f.getType().equals(Flavor.Type.DOCKER_CONTAINER)).collect(Collectors.toList());
    for (Flavor flavor : dockerFlavors) {
        Metric.Context context = getContextAt("flavor", flavor.name());
        metric.set("hostedVespa.docker.freeCapacityFlavor", capacity.freeCapacityInFlavorEquivalence(flavor), context);
        metric.set("hostedVespa.docker.idealHeadroomFlavor", flavor.getIdealHeadroom(), context);
        metric.set("hostedVespa.docker.hostsAvailableFlavor", capacity.getNofHostsAvailableFor(flavor), context);
    }
}
Also used : Metric(com.yahoo.jdisc.Metric) HostNameNotFoundException(com.yahoo.vespa.orchestrator.HostNameNotFoundException) ServiceInstance(com.yahoo.vespa.applicationmodel.ServiceInstance) ServiceMonitor(com.yahoo.vespa.service.monitor.ServiceMonitor) Version(com.yahoo.component.Version) ApplicationId(com.yahoo.config.provision.ApplicationId) NodeType(com.yahoo.config.provision.NodeType) HashMap(java.util.HashMap) Orchestrator(com.yahoo.vespa.orchestrator.Orchestrator) ServiceStatus(com.yahoo.vespa.applicationmodel.ServiceStatus) Node(com.yahoo.vespa.hosted.provision.Node) Collectors(java.util.stream.Collectors) Allocation(com.yahoo.vespa.hosted.provision.node.Allocation) ArrayList(java.util.ArrayList) NodeRepository(com.yahoo.vespa.hosted.provision.NodeRepository) DockerHostCapacity(com.yahoo.vespa.hosted.provision.provisioning.DockerHostCapacity) List(java.util.List) History(com.yahoo.vespa.hosted.provision.node.History) Flavor(com.yahoo.config.provision.Flavor) HostName(com.yahoo.vespa.applicationmodel.HostName) Duration(java.time.Duration) Map(java.util.Map) Optional(java.util.Optional) HostStatus(com.yahoo.vespa.orchestrator.status.HostStatus) Metric(com.yahoo.jdisc.Metric) DockerHostCapacity(com.yahoo.vespa.hosted.provision.provisioning.DockerHostCapacity) Flavor(com.yahoo.config.provision.Flavor)

Aggregations

Version (com.yahoo.component.Version)1 ApplicationId (com.yahoo.config.provision.ApplicationId)1 Flavor (com.yahoo.config.provision.Flavor)1 NodeType (com.yahoo.config.provision.NodeType)1 Metric (com.yahoo.jdisc.Metric)1 HostName (com.yahoo.vespa.applicationmodel.HostName)1 ServiceInstance (com.yahoo.vespa.applicationmodel.ServiceInstance)1 ServiceStatus (com.yahoo.vespa.applicationmodel.ServiceStatus)1 Node (com.yahoo.vespa.hosted.provision.Node)1 NodeRepository (com.yahoo.vespa.hosted.provision.NodeRepository)1 Allocation (com.yahoo.vespa.hosted.provision.node.Allocation)1 History (com.yahoo.vespa.hosted.provision.node.History)1 DockerHostCapacity (com.yahoo.vespa.hosted.provision.provisioning.DockerHostCapacity)1 HostNameNotFoundException (com.yahoo.vespa.orchestrator.HostNameNotFoundException)1 Orchestrator (com.yahoo.vespa.orchestrator.Orchestrator)1 HostStatus (com.yahoo.vespa.orchestrator.status.HostStatus)1 ServiceMonitor (com.yahoo.vespa.service.monitor.ServiceMonitor)1 Duration (java.time.Duration)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1