forked from BLC/sgeUpdated
Add city to datacenter, cloudsystem to summary, fix listener
This commit is contained in:
@@ -2,6 +2,7 @@ package com.sgs.graphql.dataCenter.domain;
|
|||||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||||
import com.sgs.graphql.area.domain.Area;
|
import com.sgs.graphql.area.domain.Area;
|
||||||
|
import com.sgs.graphql.city.domain.City;
|
||||||
import com.sgs.graphql.sector.domain.Sector;
|
import com.sgs.graphql.sector.domain.Sector;
|
||||||
import com.sgs.graphql.subSector.domain.SubSector;
|
import com.sgs.graphql.subSector.domain.SubSector;
|
||||||
import com.sgs.graphql.emissionScope.domain.EmissionScope;
|
import com.sgs.graphql.emissionScope.domain.EmissionScope;
|
||||||
@@ -29,6 +30,7 @@ public class DataCenter extends BaseDomain {
|
|||||||
|
|
||||||
private Integer number;
|
private Integer number;
|
||||||
private Area area;
|
private Area area;
|
||||||
|
private City city;
|
||||||
|
|
||||||
private List<PhysicalMachine> physicalMachines = new ArrayList<>();
|
private List<PhysicalMachine> physicalMachines = new ArrayList<>();
|
||||||
private List<DataCenterEmissionSource> dataCenterEmissionSources = new ArrayList<>();
|
private List<DataCenterEmissionSource> dataCenterEmissionSources = new ArrayList<>();
|
||||||
@@ -134,6 +136,16 @@ public class DataCenter extends BaseDomain {
|
|||||||
this.area = area;
|
this.area = area;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.EAGER)
|
||||||
|
@JoinColumn(name = "city_id")
|
||||||
|
public City getCity() {
|
||||||
|
return city;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCity(City city) {
|
||||||
|
this.city = city;
|
||||||
|
}
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.EAGER)
|
@ManyToOne(fetch = FetchType.EAGER)
|
||||||
@JoinColumn(name = "sub_sector_id")
|
@JoinColumn(name = "sub_sector_id")
|
||||||
public SubSector getSubSector() {
|
public SubSector getSubSector() {
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ public class DataCenterCreateInput extends BaseCreateInput {
|
|||||||
@NotNull(message = "Alan ID gereklidir")
|
@NotNull(message = "Alan ID gereklidir")
|
||||||
private UUID areaId;
|
private UUID areaId;
|
||||||
|
|
||||||
|
private UUID cityId;
|
||||||
|
|
||||||
@NotNull(message = "Sektör ID gereklidir")
|
@NotNull(message = "Sektör ID gereklidir")
|
||||||
private UUID sectorId;
|
private UUID sectorId;
|
||||||
|
|
||||||
@@ -51,6 +53,9 @@ public class DataCenterCreateInput extends BaseCreateInput {
|
|||||||
public UUID getAreaId() { return areaId; }
|
public UUID getAreaId() { return areaId; }
|
||||||
public void setAreaId(UUID areaId) { this.areaId = areaId; }
|
public void setAreaId(UUID areaId) { this.areaId = areaId; }
|
||||||
|
|
||||||
|
public UUID getCityId() { return cityId; }
|
||||||
|
public void setCityId(UUID cityId) { this.cityId = cityId; }
|
||||||
|
|
||||||
public UUID getSectorId() { return sectorId; }
|
public UUID getSectorId() { return sectorId; }
|
||||||
public void setSectorId(UUID sectorId) { this.sectorId = sectorId; }
|
public void setSectorId(UUID sectorId) { this.sectorId = sectorId; }
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ public class DataCenterUpdateInput extends BaseUpdateInput {
|
|||||||
private Double consuptionAmount;
|
private Double consuptionAmount;
|
||||||
|
|
||||||
private UUID areaId;
|
private UUID areaId;
|
||||||
|
private UUID cityId;
|
||||||
private UUID sectorId;
|
private UUID sectorId;
|
||||||
private UUID subSectorId;
|
private UUID subSectorId;
|
||||||
private UUID emissionScopeId;
|
private UUID emissionScopeId;
|
||||||
@@ -41,6 +42,9 @@ public class DataCenterUpdateInput extends BaseUpdateInput {
|
|||||||
public UUID getAreaId() { return areaId; }
|
public UUID getAreaId() { return areaId; }
|
||||||
public void setAreaId(UUID areaId) { this.areaId = areaId; }
|
public void setAreaId(UUID areaId) { this.areaId = areaId; }
|
||||||
|
|
||||||
|
public UUID getCityId() { return cityId; }
|
||||||
|
public void setCityId(UUID cityId) { this.cityId = cityId; }
|
||||||
|
|
||||||
public UUID getSectorId() { return sectorId; }
|
public UUID getSectorId() { return sectorId; }
|
||||||
public void setSectorId(UUID sectorId) { this.sectorId = sectorId; }
|
public void setSectorId(UUID sectorId) { this.sectorId = sectorId; }
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.sgs.graphql.emissionSource.service.EmissionSourceService;
|
|||||||
import com.sgs.graphql.emissionScope.service.EmissionScopeService;
|
import com.sgs.graphql.emissionScope.service.EmissionScopeService;
|
||||||
import com.sgs.graphql.consuptionUnit.service.ConsuptionUnitService;
|
import com.sgs.graphql.consuptionUnit.service.ConsuptionUnitService;
|
||||||
import com.sgs.graphql.activitySubUnit.service.ActivitySubUnitService;
|
import com.sgs.graphql.activitySubUnit.service.ActivitySubUnitService;
|
||||||
|
import com.sgs.graphql.city.service.CityService;
|
||||||
import com.sgs.lib.dao.mutation.mapper.BaseCreateUpdateMapper;
|
import com.sgs.lib.dao.mutation.mapper.BaseCreateUpdateMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -29,12 +30,13 @@ public class DataCenterMapper extends BaseCreateUpdateMapper<DataCenter, DataCen
|
|||||||
private final EmissionScopeService emissionScopeService;
|
private final EmissionScopeService emissionScopeService;
|
||||||
private final ConsuptionUnitService consuptionUnitService;
|
private final ConsuptionUnitService consuptionUnitService;
|
||||||
private final ActivitySubUnitService activitySubUnitService;
|
private final ActivitySubUnitService activitySubUnitService;
|
||||||
|
private final CityService cityService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public DataCenterMapper(AreaService areaService, SectorService sectorService,
|
public DataCenterMapper(AreaService areaService, SectorService sectorService,
|
||||||
SubSectorService subSectorService, EmissionSourceService emissionSourceService,
|
SubSectorService subSectorService, EmissionSourceService emissionSourceService,
|
||||||
EmissionScopeService emissionScopeService, ConsuptionUnitService consuptionUnitService,
|
EmissionScopeService emissionScopeService, ConsuptionUnitService consuptionUnitService,
|
||||||
ActivitySubUnitService activitySubUnitService) {
|
ActivitySubUnitService activitySubUnitService, CityService cityService) {
|
||||||
this.areaService = areaService;
|
this.areaService = areaService;
|
||||||
this.sectorService = sectorService;
|
this.sectorService = sectorService;
|
||||||
this.subSectorService = subSectorService;
|
this.subSectorService = subSectorService;
|
||||||
@@ -42,6 +44,7 @@ public class DataCenterMapper extends BaseCreateUpdateMapper<DataCenter, DataCen
|
|||||||
this.emissionScopeService = emissionScopeService;
|
this.emissionScopeService = emissionScopeService;
|
||||||
this.consuptionUnitService = consuptionUnitService;
|
this.consuptionUnitService = consuptionUnitService;
|
||||||
this.activitySubUnitService = activitySubUnitService;
|
this.activitySubUnitService = activitySubUnitService;
|
||||||
|
this.cityService = cityService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -58,6 +61,9 @@ public class DataCenterMapper extends BaseCreateUpdateMapper<DataCenter, DataCen
|
|||||||
if (input.getAreaId() != null) {
|
if (input.getAreaId() != null) {
|
||||||
entity.setArea(areaService.findById(input.getAreaId()).orElse(null));
|
entity.setArea(areaService.findById(input.getAreaId()).orElse(null));
|
||||||
}
|
}
|
||||||
|
if (input.getCityId() != null) {
|
||||||
|
entity.setCity(cityService.findById(input.getCityId()).orElse(null));
|
||||||
|
}
|
||||||
|
|
||||||
if (input.getSectorId() != null) {
|
if (input.getSectorId() != null) {
|
||||||
entity.setSector(sectorService.findById(input.getSectorId()).orElse(null));
|
entity.setSector(sectorService.findById(input.getSectorId()).orElse(null));
|
||||||
@@ -135,6 +141,9 @@ public class DataCenterMapper extends BaseCreateUpdateMapper<DataCenter, DataCen
|
|||||||
if (input.getAreaId() != null) {
|
if (input.getAreaId() != null) {
|
||||||
entity.setArea(areaService.findById(input.getAreaId()).orElse(null));
|
entity.setArea(areaService.findById(input.getAreaId()).orElse(null));
|
||||||
}
|
}
|
||||||
|
if (input.getCityId() != null) {
|
||||||
|
entity.setCity(cityService.findById(input.getCityId()).orElse(null));
|
||||||
|
}
|
||||||
|
|
||||||
if (input.getSectorId() != null) {
|
if (input.getSectorId() != null) {
|
||||||
entity.setSector(sectorService.findById(input.getSectorId()).orElse(null));
|
entity.setSector(sectorService.findById(input.getSectorId()).orElse(null));
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class VMEmissionSummary {
|
|||||||
private Double totalEmission; // Individual record's total emission
|
private Double totalEmission; // Individual record's total emission
|
||||||
private LocalDateTime createdDate; // When this specific record was created
|
private LocalDateTime createdDate; // When this specific record was created
|
||||||
private String physicalMachine;
|
private String physicalMachine;
|
||||||
private String project;
|
private String cloudSystem; // From physical machine
|
||||||
private String dataCenter;
|
private String dataCenter;
|
||||||
|
|
||||||
// Individual emission values for this specific record
|
// Individual emission values for this specific record
|
||||||
@@ -31,7 +31,7 @@ public class VMEmissionSummary {
|
|||||||
|
|
||||||
public VMEmissionSummary(UUID vmId, String vmName, Double vmPower, String vmStatus,
|
public VMEmissionSummary(UUID vmId, String vmName, Double vmPower, String vmStatus,
|
||||||
Double totalEmission, LocalDateTime createdDate,
|
Double totalEmission, LocalDateTime createdDate,
|
||||||
String physicalMachine, String project, String dataCenter,
|
String physicalMachine, String cloudSystem, String dataCenter,
|
||||||
Double co2, Double ch4, Double n2o) {
|
Double co2, Double ch4, Double n2o) {
|
||||||
this.vmId = vmId;
|
this.vmId = vmId;
|
||||||
this.vmName = vmName;
|
this.vmName = vmName;
|
||||||
@@ -40,7 +40,7 @@ public class VMEmissionSummary {
|
|||||||
this.totalEmission = totalEmission;
|
this.totalEmission = totalEmission;
|
||||||
this.createdDate = createdDate;
|
this.createdDate = createdDate;
|
||||||
this.physicalMachine = physicalMachine;
|
this.physicalMachine = physicalMachine;
|
||||||
this.project = project;
|
this.cloudSystem = cloudSystem;
|
||||||
this.dataCenter = dataCenter;
|
this.dataCenter = dataCenter;
|
||||||
this.co2 = co2;
|
this.co2 = co2;
|
||||||
this.ch4 = ch4;
|
this.ch4 = ch4;
|
||||||
@@ -70,8 +70,8 @@ public class VMEmissionSummary {
|
|||||||
public String getPhysicalMachine() { return physicalMachine; }
|
public String getPhysicalMachine() { return physicalMachine; }
|
||||||
public void setPhysicalMachine(String physicalMachine) { this.physicalMachine = physicalMachine; }
|
public void setPhysicalMachine(String physicalMachine) { this.physicalMachine = physicalMachine; }
|
||||||
|
|
||||||
public String getProject() { return project; }
|
public String getCloudSystem() { return cloudSystem; }
|
||||||
public void setProject(String project) { this.project = project; }
|
public void setCloudSystem(String cloudSystem) { this.cloudSystem = cloudSystem; }
|
||||||
|
|
||||||
public String getDataCenter() { return dataCenter; }
|
public String getDataCenter() { return dataCenter; }
|
||||||
public void setDataCenter(String dataCenter) { this.dataCenter = dataCenter; }
|
public void setDataCenter(String dataCenter) { this.dataCenter = dataCenter; }
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class MainDataTableQueryResolver implements GraphQLQueryResolver {
|
|||||||
* @param projectId Optional project ID to filter VMs by project
|
* @param projectId Optional project ID to filter VMs by project
|
||||||
* @return List of VM emission summaries including datacenter, project, aggregate, and physical machine info
|
* @return List of VM emission summaries including datacenter, project, aggregate, and physical machine info
|
||||||
*/
|
*/
|
||||||
public List<VMEmissionSummary> vmEmissionSummary(UUID datacenterId, UUID projectId) {
|
public List<VMEmissionSummary> vmEmissionSummary(UUID datacenterId) {
|
||||||
return mainDataTableService.getVMEmissionSummaries(datacenterId, projectId);
|
return mainDataTableService.getVMEmissionSummaries(datacenterId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,24 +33,16 @@ public class MainDataTableService extends BaseService<MainDataTable, MainDataTab
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<VMEmissionSummary> getVMEmissionSummaries() {
|
public List<VMEmissionSummary> getVMEmissionSummaries() {
|
||||||
return getVMEmissionSummaries(null, null);
|
return getVMEmissionSummaries(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<VMEmissionSummary> getVMEmissionSummaries(UUID datacenterId) {
|
public List<VMEmissionSummary> getVMEmissionSummaries(UUID datacenterId) {
|
||||||
return getVMEmissionSummaries(datacenterId, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<VMEmissionSummary> getVMEmissionSummaries(UUID datacenterId, UUID projectId) {
|
|
||||||
List<String> whereConditions = new ArrayList<>();
|
List<String> whereConditions = new ArrayList<>();
|
||||||
|
|
||||||
if (datacenterId != null) {
|
if (datacenterId != null) {
|
||||||
whereConditions.add("dc.id = decode(replace(:datacenterId, '-', ''), 'hex')");
|
whereConditions.add("dc.id = decode(replace(:datacenterId, '-', ''), 'hex')");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (projectId != null) {
|
|
||||||
whereConditions.add("p.id = decode(replace(:projectId, '-', ''), 'hex')");
|
|
||||||
}
|
|
||||||
|
|
||||||
String whereClause = whereConditions.isEmpty() ? "" :
|
String whereClause = whereConditions.isEmpty() ? "" :
|
||||||
"WHERE " + String.join(" AND ", whereConditions) + " ";
|
"WHERE " + String.join(" AND ", whereConditions) + " ";
|
||||||
|
|
||||||
@@ -63,7 +55,7 @@ public class MainDataTableService extends BaseService<MainDataTable, MainDataTab
|
|||||||
mdt.total_emission,
|
mdt.total_emission,
|
||||||
mdt.created_date,
|
mdt.created_date,
|
||||||
pm.name as physical_machine_name,
|
pm.name as physical_machine_name,
|
||||||
p.name as project_name,
|
pm.cloud_system as cloud_system,
|
||||||
dc.data_center_name as datacenter_name,
|
dc.data_center_name as datacenter_name,
|
||||||
mdt.co2,
|
mdt.co2,
|
||||||
mdt.ch4,
|
mdt.ch4,
|
||||||
@@ -71,8 +63,7 @@ public class MainDataTableService extends BaseService<MainDataTable, MainDataTab
|
|||||||
FROM main_data_table mdt
|
FROM main_data_table mdt
|
||||||
JOIN vm v ON mdt.vm_id = v.id
|
JOIN vm v ON mdt.vm_id = v.id
|
||||||
LEFT JOIN physical_machine pm ON v.physical_machine_id = pm.id
|
LEFT JOIN physical_machine pm ON v.physical_machine_id = pm.id
|
||||||
LEFT JOIN project p ON pm.project_id = p.id
|
LEFT JOIN data_center dc ON pm.data_center_id = dc.id
|
||||||
LEFT JOIN data_center dc ON p.data_center_id = dc.id
|
|
||||||
""" + whereClause + """
|
""" + whereClause + """
|
||||||
ORDER BY mdt.created_date DESC, v.vm_name
|
ORDER BY mdt.created_date DESC, v.vm_name
|
||||||
""";
|
""";
|
||||||
@@ -84,10 +75,6 @@ public class MainDataTableService extends BaseService<MainDataTable, MainDataTab
|
|||||||
query.setParameter("datacenterId", datacenterId.toString());
|
query.setParameter("datacenterId", datacenterId.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (projectId != null) {
|
|
||||||
query.setParameter("projectId", projectId.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<Object[]> results = query.getResultList();
|
List<Object[]> results = query.getResultList();
|
||||||
|
|
||||||
@@ -111,7 +98,7 @@ public class MainDataTableService extends BaseService<MainDataTable, MainDataTab
|
|||||||
}
|
}
|
||||||
|
|
||||||
summary.setPhysicalMachine((String) row[6]);
|
summary.setPhysicalMachine((String) row[6]);
|
||||||
summary.setProject((String) row[7]);
|
summary.setCloudSystem((String) row[7]);
|
||||||
summary.setDataCenter((String) row[8]);
|
summary.setDataCenter((String) row[8]);
|
||||||
|
|
||||||
// Individual emission values
|
// Individual emission values
|
||||||
|
|||||||
@@ -217,6 +217,7 @@ public class MessageListener {
|
|||||||
pm.setName(pmDto.getName());
|
pm.setName(pmDto.getName());
|
||||||
pm.setIp(pmIp); // Use the IP from the map key
|
pm.setIp(pmIp); // Use the IP from the map key
|
||||||
pm.setTag(pmDto.getTag());
|
pm.setTag(pmDto.getTag());
|
||||||
|
pm.setCloudSystem(pmDto.getCloudSystem());
|
||||||
pm.setPower(pmDto.getPower());
|
pm.setPower(pmDto.getPower());
|
||||||
pm.setDataCenter(entity);
|
pm.setDataCenter(entity);
|
||||||
|
|
||||||
@@ -282,16 +283,17 @@ public class MessageListener {
|
|||||||
pm.setName(newPm.getName());
|
pm.setName(newPm.getName());
|
||||||
pm.setIp(newPm.getIp());
|
pm.setIp(newPm.getIp());
|
||||||
pm.setTag(newPm.getTag());
|
pm.setTag(newPm.getTag());
|
||||||
|
pm.setCloudSystem(newPm.getCloudSystem());
|
||||||
pm.setPower(newPm.getPower());
|
pm.setPower(newPm.getPower());
|
||||||
|
|
||||||
System.out.println("✅ Updated existing PM: " + pm.getName() + " (IP: " + pm.getIp() + ")");
|
System.out.println("✅ Updated existing PM: " + pm.getName() + " (IP: " + pm.getIp() + ") - CloudSystem: " + pm.getCloudSystem());
|
||||||
} else {
|
} else {
|
||||||
// Create new PM
|
// Create new PM
|
||||||
pm = newPm;
|
pm = newPm;
|
||||||
pm.setDataCenter(dc);
|
pm.setDataCenter(dc);
|
||||||
dc.getPhysicalMachines().add(pm);
|
dc.getPhysicalMachines().add(pm);
|
||||||
|
|
||||||
System.out.println("✅ Created new PM: " + pm.getName() + " (IP: " + pm.getIp() + ")");
|
System.out.println("✅ Created new PM: " + pm.getName() + " (IP: " + pm.getIp() + ") - CloudSystem: " + pm.getCloudSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process VMs that are already assigned to this PM
|
// Process VMs that are already assigned to this PM
|
||||||
@@ -547,15 +549,46 @@ public class MessageListener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the emission source by name/tag
|
// Find the emission source by name/tag from datacenter's configured emission sources
|
||||||
|
EmissionSource emissionSource = null;
|
||||||
|
|
||||||
|
// First, try to find the emission source from datacenter's configured sources
|
||||||
|
if (dataCenter.getDataCenterEmissionSources() != null && !dataCenter.getDataCenterEmissionSources().isEmpty()) {
|
||||||
|
for (DataCenterEmissionSource dces : dataCenter.getDataCenterEmissionSources()) {
|
||||||
|
if (dces.getEmissionSource() != null &&
|
||||||
|
emissionSourceName.equalsIgnoreCase(dces.getEmissionSource().getTag())) {
|
||||||
|
emissionSource = dces.getEmissionSource();
|
||||||
|
System.out.println("✅ Found emission source '" + emissionSourceName +
|
||||||
|
"' in datacenter's configured sources (ID: " + emissionSource.getId() + ")");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If not found in datacenter's sources, fall back to subsector-specific search
|
||||||
|
if (emissionSource == null && dataCenter.getSubSector() != null) {
|
||||||
|
emissionSource = emissionSourceRepo.findByTagAndSubSectorIgnoreCase(emissionSourceName, dataCenter.getSubSector());
|
||||||
|
if (emissionSource != null) {
|
||||||
|
System.out.println("⚠️ Using subsector fallback for emission source '" + emissionSourceName +
|
||||||
|
"' (ID: " + emissionSource.getId() + ") - Consider configuring it for datacenter");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Last resort: global search
|
||||||
|
if (emissionSource == null) {
|
||||||
List<EmissionSource> emissionSources = emissionSourceRepo.findByTag(emissionSourceName);
|
List<EmissionSource> emissionSources = emissionSourceRepo.findByTag(emissionSourceName);
|
||||||
if (emissionSources.isEmpty()) {
|
if (!emissionSources.isEmpty()) {
|
||||||
|
emissionSource = emissionSources.get(0);
|
||||||
|
System.out.println("⚠️ Using global fallback for emission source '" + emissionSourceName +
|
||||||
|
"' (ID: " + emissionSource.getId() + ") - This may cause incorrect calculations!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (emissionSource == null) {
|
||||||
System.err.println("❌ Could not find emission source: " + emissionSourceName);
|
System.err.println("❌ Could not find emission source: " + emissionSourceName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EmissionSource emissionSource = emissionSources.get(0);
|
|
||||||
|
|
||||||
// Calculate power consumption for this emission source (percentage of total VM power)
|
// Calculate power consumption for this emission source (percentage of total VM power)
|
||||||
double sourceSpecificPower = vm.getPower() * (percentage / 100.0);
|
double sourceSpecificPower = vm.getPower() * (percentage / 100.0);
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ app.survey.base-url=http://localhost.com
|
|||||||
# spring.rabbitmq.username=testuser
|
# spring.rabbitmq.username=testuser
|
||||||
# spring.rabbitmq.password=JGasF24561AZv2894De
|
# spring.rabbitmq.password=JGasF24561AZv2894De
|
||||||
|
|
||||||
spring.rabbitmq.host=rabbitmq
|
#spring.rabbitmq.host=rabbitmq
|
||||||
#spring.rabbitmq.host=localhost
|
spring.rabbitmq.host=localhost
|
||||||
spring.rabbitmq.port=5672
|
spring.rabbitmq.port=5672
|
||||||
spring.rabbitmq.username=guest
|
spring.rabbitmq.username=guest
|
||||||
spring.rabbitmq.password=guest
|
spring.rabbitmq.password=guest
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ input DataCenterCreateInput {
|
|||||||
|
|
||||||
consuptionAmount: Float
|
consuptionAmount: Float
|
||||||
areaId: ID
|
areaId: ID
|
||||||
|
cityId: ID
|
||||||
number: Int
|
number: Int
|
||||||
ayposURL: String
|
ayposURL: String
|
||||||
address: String
|
address: String
|
||||||
@@ -31,6 +32,7 @@ input DataCenterUpdateInput {
|
|||||||
|
|
||||||
consuptionAmount: Float
|
consuptionAmount: Float
|
||||||
areaId: ID
|
areaId: ID
|
||||||
|
cityId: ID
|
||||||
number: Int
|
number: Int
|
||||||
ayposURL: String
|
ayposURL: String
|
||||||
address: String
|
address: String
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ type DataCenter {
|
|||||||
|
|
||||||
physicalMachines: [PhysicalMachine]
|
physicalMachines: [PhysicalMachine]
|
||||||
area: Area
|
area: Area
|
||||||
|
city: City
|
||||||
number: Int
|
number: Int
|
||||||
|
|
||||||
ayposURL: String
|
ayposURL: String
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ extend type Query{
|
|||||||
mainDataTable(id: ID!): MainDataTable!
|
mainDataTable(id: ID!): MainDataTable!
|
||||||
mainDataTables(criteria: MainDataTableCriteria, sortBy: [SortBy!]): [MainDataTable!]
|
mainDataTables(criteria: MainDataTableCriteria, sortBy: [SortBy!]): [MainDataTable!]
|
||||||
paginateMainDataTables(pagination : Pagination!, criteria: MainDataTableCriteria, sortBy:[SortBy!] ) : MainDataTablePageable!
|
paginateMainDataTables(pagination : Pagination!, criteria: MainDataTableCriteria, sortBy:[SortBy!] ) : MainDataTablePageable!
|
||||||
vmEmissionSummary(datacenterId: ID, projectId: ID): [VMEmissionSummary!]!
|
vmEmissionSummary(datacenterId: ID): [VMEmissionSummary!]!
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ type Config {
|
|||||||
totalEmission: Float!
|
totalEmission: Float!
|
||||||
createdDate: LocalDateTime!
|
createdDate: LocalDateTime!
|
||||||
physicalMachine: String
|
physicalMachine: String
|
||||||
project: String
|
cloudSystem: String
|
||||||
dataCenter: String
|
dataCenter: String
|
||||||
# Individual emission values per record
|
# Individual emission values per record
|
||||||
co2: Float!
|
co2: Float!
|
||||||
|
|||||||
Reference in New Issue
Block a user