Skip to content

Commit

Permalink
[Profiling] Annotate TODOs for 9.0.0 upgrade
Browse files Browse the repository at this point in the history
As suggested by David in elastic#106592, we're adding the annotation
`@UpdateForV9` to all places in the Universal Profiling plugin that
can be removed once we move to 9.0.0.

Relates elastic#106592
  • Loading branch information
danielmitterdorfer committed Apr 5, 2024
1 parent 18be49b commit dccec19
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

package org.elasticsearch.xpack.profiling;

import org.elasticsearch.core.UpdateForV9;

import java.util.Map;

final class CO2Calculator {
Expand Down Expand Up @@ -52,6 +54,7 @@ public double getAnnualCO2Tons(String hostID, long samples) {
return getKiloWattsPerCore(host) * getCO2TonsPerKWH(host) * annualCoreHours * getDatacenterPUE(host);
}

@UpdateForV9 // only allow OTEL semantic conventions
private double getKiloWattsPerCore(HostMetadata host) {
return switch (host.hostArchitecture) {
// For the OTEL donation of the profiling agent, we switch to OTEL semantic conventions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ChunkedToXContentHelper;
import org.elasticsearch.common.xcontent.ChunkedToXContentObject;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.xcontent.ToXContent;

import java.io.IOException;
Expand All @@ -24,7 +25,9 @@ public class GetFlamegraphResponse extends ActionResponse implements ChunkedToXC
private final int size;
private final double samplingRate;
private final long selfCPU;
@UpdateForV9 // remove this field - it is unused in Kibana
private final long totalCPU;
@UpdateForV9 // remove this field - it is unused in Kibana
private final long totalSamples;
private final List<Map<String, Integer>> edges;
private final List<String> fileIds;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.elasticsearch.common.xcontent.ChunkedToXContentHelper;
import org.elasticsearch.common.xcontent.ChunkedToXContentObject;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.xcontent.ToXContent;

import java.util.Collections;
Expand All @@ -29,8 +30,10 @@ public class GetStackTracesResponse extends ActionResponse implements ChunkedToX
private final Map<String, StackFrame> stackFrames;
@Nullable
private final Map<String, String> executables;
@UpdateForV9 // remove this field - it is unused in Kibana
@Nullable
private final Map<String, TraceEvent> stackTraceEvents;
@UpdateForV9 // remove this field - it is unused in Kibana
private final int totalFrames;
private final double samplingRate;
private final long totalSamples;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

package org.elasticsearch.xpack.profiling;

import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.xcontent.ToXContentObject;
import org.elasticsearch.xcontent.XContentBuilder;

Expand All @@ -30,6 +31,7 @@ final class HostMetadata implements ToXContentObject {
this.profilingNumCores = profilingNumCores != null ? profilingNumCores : DEFAULT_PROFILING_NUM_CORES;
}

@UpdateForV9 // remove fallback to the "profiling.host.machine" field and remove it from the component template "profiling-hosts".
public static HostMetadata fromSource(Map<String, Object> source) {
if (source != null) {
String hostID = (String) source.get("host.id");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

package org.elasticsearch.xpack.profiling;

import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.xcontent.ToXContentObject;
import org.elasticsearch.xcontent.XContentBuilder;

Expand Down Expand Up @@ -73,6 +74,7 @@ public static InstanceType fromHostSource(Map<String, Object> source) {
return new InstanceType(provider, region, null);
}

@UpdateForV9 // remove this method
private static InstanceType fromObsoleteHostSource(Map<String, Object> source) {
// Check and handle AWS.
String region = (String) source.get("ec2.placement.region");
Expand Down

0 comments on commit dccec19

Please sign in to comment.