Search in sources :

Example 1 with ApplicationMetrics

use of com.yahoo.vespa.hosted.controller.api.integration.MetricsService.ApplicationMetrics in project vespa by vespa-engine.

the class ApplicationSerializer method fromSlime.

// ------------------ Deserialization
public Application fromSlime(Slime slime) {
    Inspector root = slime.get();
    ApplicationId id = ApplicationId.fromSerializedForm(root.field(idField).asString());
    DeploymentSpec deploymentSpec = DeploymentSpec.fromXml(root.field(deploymentSpecField).asString(), false);
    ValidationOverrides validationOverrides = ValidationOverrides.fromXml(root.field(validationOverridesField).asString());
    List<Deployment> deployments = deploymentsFromSlime(root.field(deploymentsField));
    DeploymentJobs deploymentJobs = deploymentJobsFromSlime(root.field(deploymentJobsField));
    Change deploying = changeFromSlime(root.field(deployingField));
    Change outstandingChange = changeFromSlime(root.field(outstandingChangeField));
    Optional<IssueId> ownershipIssueId = optionalString(root.field(ownershipIssueIdField)).map(IssueId::from);
    ApplicationMetrics metrics = new ApplicationMetrics(root.field(queryQualityField).asDouble(), root.field(writeQualityField).asDouble());
    Optional<RotationId> rotation = rotationFromSlime(root.field(rotationField));
    return new Application(id, deploymentSpec, validationOverrides, deployments, deploymentJobs, deploying, outstandingChange, ownershipIssueId, metrics, rotation);
}
Also used : Deployment(com.yahoo.vespa.hosted.controller.application.Deployment) Change(com.yahoo.vespa.hosted.controller.application.Change) DeploymentSpec(com.yahoo.config.application.api.DeploymentSpec) DeploymentJobs(com.yahoo.vespa.hosted.controller.application.DeploymentJobs) Inspector(com.yahoo.slime.Inspector) IssueId(com.yahoo.vespa.hosted.controller.api.integration.organization.IssueId) ApplicationId(com.yahoo.config.provision.ApplicationId) ValidationOverrides(com.yahoo.config.application.api.ValidationOverrides) ApplicationMetrics(com.yahoo.vespa.hosted.controller.api.integration.MetricsService.ApplicationMetrics) RotationId(com.yahoo.vespa.hosted.controller.rotation.RotationId) Application(com.yahoo.vespa.hosted.controller.Application)

Example 2 with ApplicationMetrics

use of com.yahoo.vespa.hosted.controller.api.integration.MetricsService.ApplicationMetrics in project vespa by vespa-engine.

the class ApplicationApiTest method setDeploymentMaintainedInfo.

/**
 * Cluster info, utilization and application and deployment metrics are maintained async by maintainers.
 *
 * This sets these values as if the maintainers has been ran.
 *
 * @param controllerTester
 */
private void setDeploymentMaintainedInfo(ContainerControllerTester controllerTester) {
    for (Application application : controllerTester.controller().applications().asList()) {
        controllerTester.controller().applications().lockOrThrow(application.id(), lockedApplication -> {
            lockedApplication = lockedApplication.with(new ApplicationMetrics(0.5, 0.7));
            for (Deployment deployment : application.deployments().values()) {
                Map<ClusterSpec.Id, ClusterInfo> clusterInfo = new HashMap<>();
                List<String> hostnames = new ArrayList<>();
                hostnames.add("host1");
                hostnames.add("host2");
                clusterInfo.put(ClusterSpec.Id.from("cluster1"), new ClusterInfo("flavor1", 37, 2, 4, 50, ClusterSpec.Type.content, hostnames));
                Map<ClusterSpec.Id, ClusterUtilization> clusterUtils = new HashMap<>();
                clusterUtils.put(ClusterSpec.Id.from("cluster1"), new ClusterUtilization(0.3, 0.6, 0.4, 0.3));
                DeploymentMetrics metrics = new DeploymentMetrics(1, 2, 3, 4, 5);
                lockedApplication = lockedApplication.withClusterInfo(deployment.zone(), clusterInfo).withClusterUtilization(deployment.zone(), clusterUtils).with(deployment.zone(), metrics);
            }
            controllerTester.controller().applications().store(lockedApplication);
        });
    }
}
Also used : DeploymentMetrics(com.yahoo.vespa.hosted.controller.application.DeploymentMetrics) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Deployment(com.yahoo.vespa.hosted.controller.application.Deployment) ClusterInfo(com.yahoo.vespa.hosted.controller.application.ClusterInfo) ClusterUtilization(com.yahoo.vespa.hosted.controller.application.ClusterUtilization) ZoneId(com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId) IssueId(com.yahoo.vespa.hosted.controller.api.integration.organization.IssueId) ApplicationId(com.yahoo.config.provision.ApplicationId) PropertyId(com.yahoo.vespa.hosted.controller.api.identifiers.PropertyId) UserId(com.yahoo.vespa.hosted.controller.api.identifiers.UserId) ScrewdriverId(com.yahoo.vespa.hosted.controller.api.identifiers.ScrewdriverId) ApplicationMetrics(com.yahoo.vespa.hosted.controller.api.integration.MetricsService.ApplicationMetrics) Application(com.yahoo.vespa.hosted.controller.Application)

Aggregations

ApplicationId (com.yahoo.config.provision.ApplicationId)2 Application (com.yahoo.vespa.hosted.controller.Application)2 ApplicationMetrics (com.yahoo.vespa.hosted.controller.api.integration.MetricsService.ApplicationMetrics)2 IssueId (com.yahoo.vespa.hosted.controller.api.integration.organization.IssueId)2 Deployment (com.yahoo.vespa.hosted.controller.application.Deployment)2 DeploymentSpec (com.yahoo.config.application.api.DeploymentSpec)1 ValidationOverrides (com.yahoo.config.application.api.ValidationOverrides)1 Inspector (com.yahoo.slime.Inspector)1 PropertyId (com.yahoo.vespa.hosted.controller.api.identifiers.PropertyId)1 ScrewdriverId (com.yahoo.vespa.hosted.controller.api.identifiers.ScrewdriverId)1 UserId (com.yahoo.vespa.hosted.controller.api.identifiers.UserId)1 ZoneId (com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId)1 Change (com.yahoo.vespa.hosted.controller.application.Change)1 ClusterInfo (com.yahoo.vespa.hosted.controller.application.ClusterInfo)1 ClusterUtilization (com.yahoo.vespa.hosted.controller.application.ClusterUtilization)1 DeploymentJobs (com.yahoo.vespa.hosted.controller.application.DeploymentJobs)1 DeploymentMetrics (com.yahoo.vespa.hosted.controller.application.DeploymentMetrics)1 RotationId (com.yahoo.vespa.hosted.controller.rotation.RotationId)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1