Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.core.UpdateForV10;

import java.util.Map;

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

@UpdateForV9(owner = UpdateForV9.Owner.PROFILING) // only allow OTEL semantic conventions
@UpdateForV10(owner = UpdateForV10.Owner.PROFILING) // only allow OTEL semantic conventions
// still required for data that has been migrated from 8.x to 9.x
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,7 +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.core.UpdateForV10;
import org.elasticsearch.xcontent.ToXContent;

import java.io.IOException;
Expand All @@ -25,9 +25,7 @@ public class GetFlamegraphResponse extends ActionResponse implements ChunkedToXC
private final int size;
private final double samplingRate;
private final long selfCPU;
@UpdateForV9(owner = UpdateForV9.Owner.PROFILING) // remove this field - it is unused in Kibana
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

totalCPU is still used in Kibana, removed annotation

private final long totalCPU;
@UpdateForV9(owner = UpdateForV9.Owner.PROFILING) // remove this field - it is unused in Kibana
private final long totalSamples;
Copy link
Contributor Author

@rockdaboot rockdaboot Mar 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`totalSamples is still used in Kibana, removed annotation.

private final List<Map<String, Integer>> edges;
private final List<String> fileIds;
Expand Down Expand Up @@ -173,7 +171,7 @@ public long getTotalSamples() {
return totalSamples;
}

@UpdateForV9(owner = UpdateForV9.Owner.PROFILING) // change casing from Camel Case to Snake Case (requires updates in Kibana as well)
@UpdateForV10(owner = UpdateForV10.Owner.PROFILING) // change casing from Camel Case to Snake Case (requires updates in Kibana as well)
@Override
public Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params params) {
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
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,10 +28,8 @@ public class GetStackTracesResponse extends ActionResponse implements ChunkedToX
private final Map<String, StackFrame> stackFrames;
@Nullable
private final Map<String, String> executables;
@UpdateForV9(owner = UpdateForV9.Owner.PROFILING) // remove this field - it is unused in Kibana
@Nullable
private final Map<String, TraceEvent> stackTraceEvents;
@UpdateForV9(owner = UpdateForV9.Owner.PROFILING) // remove this field - it is unused in Kibana
private final int totalFrames;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need to keep this around?

Copy link
Contributor Author

@rockdaboot rockdaboot Mar 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Sorry, I put the comment at the wrong place:
totalFrames is still used in internally to calculate sizes for map allocations. Removed sending the value as total_frames to Kibana, where it isn't used any more.`

private final double samplingRate;
private final long totalSamples;
Expand Down Expand Up @@ -101,7 +98,6 @@ public Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params params
stackTraceEvents,
(n, v) -> ChunkedToXContentHelper.object(n, v, entry -> (b, p) -> b.field(entry.getKey(), entry.getValue().count))
),
Iterators.single((b, p) -> b.field("total_frames", totalFrames)),
Iterators.single((b, p) -> b.field("sampling_rate", samplingRate)),
// the following fields are intentionally not written to the XContent representation (only needed on the transport layer):
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

package org.elasticsearch.xpack.profiling.action;

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

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

@UpdateForV9(owner = UpdateForV9.Owner.PROFILING)
@UpdateForV10(owner = UpdateForV10.Owner.PROFILING)
// remove fallback to the "profiling.host.machine" field and remove it from the component template "profiling-hosts".
// still required for data that has been migrated from 8.x to 9.x
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,7 +7,7 @@

package org.elasticsearch.xpack.profiling.action;

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

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

@UpdateForV9(owner = UpdateForV9.Owner.PROFILING) // remove this method
@UpdateForV10(owner = UpdateForV10.Owner.PROFILING) // remove this method
// still required for data that has been migrated from 8.x to 9.x
private static InstanceType fromObsoleteHostSource(Map<String, Object> source) {
// Check and handle AWS.
String region = (String) source.get("ec2.placement.region");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.core.UpdateForV10;
import org.elasticsearch.xcontent.ToXContentFragment;
import org.elasticsearch.xcontent.XContentBuilder;

Expand All @@ -19,7 +19,7 @@
public class SubGroup implements ToXContentFragment {
private final String name;
private Long count;
@UpdateForV9(owner = UpdateForV9.Owner.PROFILING) // remove legacy XContent rendering
@UpdateForV10(owner = UpdateForV10.Owner.PROFILING) // remove legacy XContent rendering
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unclear why XContent is legacy. The API isn't deprecated. The profiling team hasn't any further knowledge.

private final Map<String, SubGroup> subgroups;

public static SubGroup root(String name) {
Expand Down