Skip to content

Commit

Permalink
[Profiling] Accept OTEL host architecture values (elastic#106494)
Browse files Browse the repository at this point in the history
  • Loading branch information
rockdaboot authored Mar 19, 2024
1 parent 022dc4d commit 97b8977
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,13 @@ public double getAnnualCO2Tons(String hostID, long samples) {
}

private double getKiloWattsPerCore(HostMetadata host) {
if ("aarch64".equals(host.profilingHostMachine)) {
// Assume that AARCH64 (aka ARM64) machines are more energy efficient than x86_64 machines.
return customKilowattsPerCoreARM64;
}
if ("x86_64".equals(host.profilingHostMachine)) {
return customKilowattsPerCoreX86;
}
return DEFAULT_KILOWATTS_PER_CORE;
return switch (host.profilingHostMachine) {
// For the OTEL donation of the profiling agent, we switch to OTEL semantic conventions,
// which require "arm64" and "amd64" to be reported as the host architecture.
case "arm64", "aarch64" -> customKilowattsPerCoreARM64;
case "amd64", "x86_64" -> customKilowattsPerCoreX86;
default -> DEFAULT_KILOWATTS_PER_CORE;
};
}

private double getCO2TonsPerKWH(HostMetadata host) {
Expand Down

0 comments on commit 97b8977

Please sign in to comment.