private VdsmVm appendStatistics(VdsmVm vm, V1VirtualMachineInstance vmi) {
        VmStatistics statistics = new VmStatistics();
        statistics.setId(vm.getId());
        DateTime creationTimestampDate = vmi.getMetadata().getCreationTimestamp();
        if (creationTimestampDate != null) {
            DateTime now = DateTime.now();
            Seconds seconds = Seconds.secondsBetween(creationTimestampDate, now);
            statistics.setElapsedTime((double) seconds.getSeconds());
        }
        PrometheusClient promClient = getPrometheusClient();
        if (promClient != null) {
            // FIXME: Kubevirt currently have only kubevirt_vmi_vcpu_seconds, which is total CPU time,
            // so we are setting it here only as system time, which is wrong.
            statistics.setCpuSys(
                    promClient.getVmiCpuUsage(vmi.getMetadata().getName(), vmi.getMetadata().getNamespace())
            );
        }
        return vm.setVmStatistics(statistics)
                .setDiskStatistics(Collections.emptyList())
                .setVmJobs(Collections.emptyList());
    }
private VdsmVm appendStatistics(VdsmVm vm, V1VirtualMachineInstance vmi) {
        VmStatistics statistics = new VmStatistics();
        statistics.setId(vm.getId());
        DateTime creationTimestampDate = vmi.getMetadata().getCreationTimestamp();
        if (creationTimestampDate != null) {
            DateTime now = DateTime.now();
            Seconds seconds = Seconds.secondsBetween(creationTimestampDate, now);
            statistics.setElapsedTime((double) seconds.getSeconds());
        }
        PrometheusClient promClient = getPrometheusClient();
        if (promClient != null) {
           
           
            statistics.setCpuSys(
                    promClient.getVmiCpuUsage(vmi.getMetadata().getName(), vmi.getMetadata().getNamespace())
            );
        }
        return vm.setVmStatistics(statistics)
                .setDiskStatistics(Collections.emptyList())
                .setVmJobs(Collections.emptyList());
    }
private vdsmvm appendstatistics(vdsmvm vm, v1virtualmachineinstance vmi) { vmstatistics statistics = new vmstatistics(); statistics.setid(vm.getid()); datetime creationtimestampdate = vmi.getmetadata().getcreationtimestamp(); if (creationtimestampdate != null) { datetime now = datetime.now(); seconds seconds = seconds.secondsbetween(creationtimestampdate, now); statistics.setelapsedtime((double) seconds.getseconds()); } prometheusclient promclient = getprometheusclient(); if (promclient != null) { statistics.setcpusys( promclient.getvmicpuusage(vmi.getmetadata().getname(), vmi.getmetadata().getnamespace()) ); } return vm.setvmstatistics(statistics) .setdiskstatistics(collections.emptylist()) .setvmjobs(collections.emptylist()); }