Browse Source

[Profiling] Remove unused serialization code (#102932)

With this commit we remove serialization code that is never exercised.
That code would only be necessary if the respective transport action
would be handled on different nodes in the cluster. As our transport
actions are handled locally on the coordinating node, there is no point
in implementing this serialization. See also #100111 for more background
info and rationale.

Relates #100111
Daniel Mitterdorfer 1 year ago
parent
commit
ccbf242c53

+ 2 - 1
x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/GetFlamegraphAction.java

@@ -7,12 +7,13 @@
 package org.elasticsearch.xpack.profiling;
 
 import org.elasticsearch.action.ActionType;
+import org.elasticsearch.common.io.stream.Writeable;
 
 public final class GetFlamegraphAction extends ActionType<GetFlamegraphResponse> {
     public static final GetFlamegraphAction INSTANCE = new GetFlamegraphAction();
     public static final String NAME = "indices:data/read/profiling/flamegraph";
 
     private GetFlamegraphAction() {
-        super(NAME, GetFlamegraphResponse::new);
+        super(NAME, Writeable.Reader.localOnly());
     }
 }

+ 2 - 46
x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/GetFlamegraphResponse.java

@@ -8,8 +8,8 @@
 package org.elasticsearch.xpack.profiling;
 
 import org.elasticsearch.action.ActionResponse;
+import org.elasticsearch.action.support.TransportAction;
 import org.elasticsearch.common.collect.Iterators;
-import org.elasticsearch.common.io.stream.StreamInput;
 import org.elasticsearch.common.io.stream.StreamOutput;
 import org.elasticsearch.common.xcontent.ChunkedToXContentHelper;
 import org.elasticsearch.common.xcontent.ChunkedToXContentObject;
@@ -43,30 +43,6 @@ public class GetFlamegraphResponse extends ActionResponse implements ChunkedToXC
     private final List<Double> annualCostsUSDInclusive;
     private final List<Double> annualCostsUSDExclusive;
 
-    public GetFlamegraphResponse(StreamInput in) throws IOException {
-        this.size = in.readInt();
-        this.samplingRate = in.readDouble();
-        this.edges = in.readCollectionAsList(i -> i.readMap(StreamInput::readInt));
-        this.fileIds = in.readCollectionAsList(StreamInput::readString);
-        this.frameTypes = in.readCollectionAsList(StreamInput::readInt);
-        this.inlineFrames = in.readCollectionAsList(StreamInput::readBoolean);
-        this.fileNames = in.readCollectionAsList(StreamInput::readString);
-        this.addressOrLines = in.readCollectionAsList(StreamInput::readInt);
-        this.functionNames = in.readCollectionAsList(StreamInput::readString);
-        this.functionOffsets = in.readCollectionAsList(StreamInput::readInt);
-        this.sourceFileNames = in.readCollectionAsList(StreamInput::readString);
-        this.sourceLines = in.readCollectionAsList(StreamInput::readInt);
-        this.countInclusive = in.readCollectionAsList(StreamInput::readLong);
-        this.countExclusive = in.readCollectionAsList(StreamInput::readLong);
-        this.annualCO2TonsInclusive = in.readCollectionAsList(StreamInput::readDouble);
-        this.annualCO2TonsExclusive = in.readCollectionAsList(StreamInput::readDouble);
-        this.annualCostsUSDInclusive = in.readCollectionAsList(StreamInput::readDouble);
-        this.annualCostsUSDExclusive = in.readCollectionAsList(StreamInput::readDouble);
-        this.selfCPU = in.readLong();
-        this.totalCPU = in.readLong();
-        this.totalSamples = in.readLong();
-    }
-
     public GetFlamegraphResponse(
         int size,
         double samplingRate,
@@ -115,27 +91,7 @@ public class GetFlamegraphResponse extends ActionResponse implements ChunkedToXC
 
     @Override
     public void writeTo(StreamOutput out) throws IOException {
-        out.writeInt(this.size);
-        out.writeDouble(this.samplingRate);
-        out.writeCollection(this.edges, (o, v) -> o.writeMap(v, StreamOutput::writeString, StreamOutput::writeInt));
-        out.writeCollection(this.fileIds, StreamOutput::writeString);
-        out.writeCollection(this.frameTypes, StreamOutput::writeInt);
-        out.writeCollection(this.inlineFrames, StreamOutput::writeBoolean);
-        out.writeCollection(this.fileNames, StreamOutput::writeString);
-        out.writeCollection(this.addressOrLines, StreamOutput::writeInt);
-        out.writeCollection(this.functionNames, StreamOutput::writeString);
-        out.writeCollection(this.functionOffsets, StreamOutput::writeInt);
-        out.writeCollection(this.sourceFileNames, StreamOutput::writeString);
-        out.writeCollection(this.sourceLines, StreamOutput::writeInt);
-        out.writeCollection(this.countInclusive, StreamOutput::writeLong);
-        out.writeCollection(this.countExclusive, StreamOutput::writeLong);
-        out.writeCollection(this.annualCO2TonsInclusive, StreamOutput::writeDouble);
-        out.writeCollection(this.annualCO2TonsExclusive, StreamOutput::writeDouble);
-        out.writeCollection(this.annualCostsUSDInclusive, StreamOutput::writeDouble);
-        out.writeCollection(this.annualCostsUSDExclusive, StreamOutput::writeDouble);
-        out.writeLong(this.selfCPU);
-        out.writeLong(this.totalCPU);
-        out.writeLong(this.totalSamples);
+        TransportAction.localOnly();
     }
 
     public int getSize() {

+ 2 - 1
x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/GetStackTracesAction.java

@@ -7,12 +7,13 @@
 package org.elasticsearch.xpack.profiling;
 
 import org.elasticsearch.action.ActionType;
+import org.elasticsearch.common.io.stream.Writeable;
 
 public final class GetStackTracesAction extends ActionType<GetStackTracesResponse> {
     public static final GetStackTracesAction INSTANCE = new GetStackTracesAction();
     public static final String NAME = "indices:data/read/profiling/stack_traces";
 
     private GetStackTracesAction() {
-        super(NAME, GetStackTracesResponse::new);
+        super(NAME, Writeable.Reader.localOnly());
     }
 }

+ 3 - 29
x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/GetStackTracesRequest.java

@@ -10,8 +10,8 @@ import org.elasticsearch.action.ActionRequest;
 import org.elasticsearch.action.ActionRequestValidationException;
 import org.elasticsearch.action.IndicesRequest;
 import org.elasticsearch.action.support.IndicesOptions;
+import org.elasticsearch.action.support.TransportAction;
 import org.elasticsearch.common.ParsingException;
-import org.elasticsearch.common.io.stream.StreamInput;
 import org.elasticsearch.common.io.stream.StreamOutput;
 import org.elasticsearch.index.query.QueryBuilder;
 import org.elasticsearch.tasks.CancellableTask;
@@ -93,35 +93,9 @@ public class GetStackTracesRequest extends ActionRequest implements IndicesReque
         this.customCostPerCoreHour = customCostPerCoreHour;
     }
 
-    public GetStackTracesRequest(StreamInput in) throws IOException {
-        this.query = in.readOptionalNamedWriteable(QueryBuilder.class);
-        this.sampleSize = in.readOptionalInt();
-        this.requestedDuration = in.readOptionalDouble();
-        this.awsCostFactor = in.readOptionalDouble();
-        this.adjustSampleCount = in.readOptionalBoolean();
-        this.indices = in.readOptionalString();
-        this.stackTraceIds = in.readOptionalString();
-        this.customCO2PerKWH = in.readOptionalDouble();
-        this.customDatacenterPUE = in.readOptionalDouble();
-        this.customPerCoreWattX86 = in.readOptionalDouble();
-        this.customPerCoreWattARM64 = in.readOptionalDouble();
-        this.customCostPerCoreHour = in.readOptionalDouble();
-    }
-
     @Override
-    public void writeTo(StreamOutput out) throws IOException {
-        out.writeOptionalNamedWriteable(query);
-        out.writeOptionalInt(sampleSize);
-        out.writeOptionalDouble(requestedDuration);
-        out.writeOptionalDouble(awsCostFactor);
-        out.writeOptionalBoolean(adjustSampleCount);
-        out.writeOptionalString(indices);
-        out.writeOptionalString(stackTraceIds);
-        out.writeOptionalDouble(customCO2PerKWH);
-        out.writeOptionalDouble(customDatacenterPUE);
-        out.writeOptionalDouble(customPerCoreWattX86);
-        out.writeOptionalDouble(customPerCoreWattARM64);
-        out.writeOptionalDouble(customCostPerCoreHour);
+    public void writeTo(StreamOutput out) {
+        TransportAction.localOnly();
     }
 
     public Integer getSampleSize() {

+ 3 - 77
x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/GetStackTracesResponse.java

@@ -7,16 +7,15 @@
 package org.elasticsearch.xpack.profiling;
 
 import org.elasticsearch.action.ActionResponse;
+import org.elasticsearch.action.support.TransportAction;
 import org.elasticsearch.common.Strings;
 import org.elasticsearch.common.collect.Iterators;
-import org.elasticsearch.common.io.stream.StreamInput;
 import org.elasticsearch.common.io.stream.StreamOutput;
 import org.elasticsearch.common.xcontent.ChunkedToXContentHelper;
 import org.elasticsearch.common.xcontent.ChunkedToXContentObject;
 import org.elasticsearch.core.Nullable;
 import org.elasticsearch.xcontent.ToXContent;
 
-import java.io.IOException;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.Map;
@@ -36,37 +35,6 @@ public class GetStackTracesResponse extends ActionResponse implements ChunkedToX
     private final double samplingRate;
     private final long totalSamples;
 
-    public GetStackTracesResponse(StreamInput in) throws IOException {
-        this.stackTraces = in.readBoolean()
-            ? in.readMap(
-                i -> new StackTrace(
-                    i.readCollectionAsList(StreamInput::readInt),
-                    i.readCollectionAsList(StreamInput::readString),
-                    i.readCollectionAsList(StreamInput::readString),
-                    i.readCollectionAsList(StreamInput::readInt),
-                    i.readDouble(),
-                    i.readDouble(),
-                    i.readLong()
-                )
-            )
-            : null;
-        this.stackFrames = in.readBoolean()
-            ? in.readMap(
-                i -> new StackFrame(
-                    i.readCollectionAsList(StreamInput::readString),
-                    i.readCollectionAsList(StreamInput::readString),
-                    i.readCollectionAsList(StreamInput::readInt),
-                    i.readCollectionAsList(StreamInput::readInt)
-                )
-            )
-            : null;
-        this.executables = in.readBoolean() ? in.readMap(StreamInput::readString) : null;
-        this.stackTraceEvents = in.readBoolean() ? in.readMap(i -> new TraceEvent(i.readString(), i.readLong())) : null;
-        this.totalFrames = in.readInt();
-        this.samplingRate = in.readDouble();
-        this.totalSamples = in.readLong();
-    }
-
     public GetStackTracesResponse(
         Map<String, StackTrace> stackTraces,
         Map<String, StackFrame> stackFrames,
@@ -86,50 +54,8 @@ public class GetStackTracesResponse extends ActionResponse implements ChunkedToX
     }
 
     @Override
-    public void writeTo(StreamOutput out) throws IOException {
-        if (stackTraces != null) {
-            out.writeBoolean(true);
-            out.writeMap(stackTraces, (o, v) -> {
-                o.writeCollection(v.addressOrLines, StreamOutput::writeInt);
-                o.writeStringCollection(v.fileIds);
-                o.writeStringCollection(v.frameIds);
-                o.writeCollection(v.typeIds, StreamOutput::writeInt);
-                o.writeDouble(v.annualCO2Tons);
-                o.writeDouble(v.annualCostsUSD);
-                o.writeLong(v.count);
-            });
-        } else {
-            out.writeBoolean(false);
-        }
-        if (stackFrames != null) {
-            out.writeBoolean(true);
-            out.writeMap(stackFrames, (o, v) -> {
-                o.writeStringCollection(v.fileName);
-                o.writeStringCollection(v.functionName);
-                o.writeCollection(v.functionOffset, StreamOutput::writeInt);
-                o.writeCollection(v.lineNumber, StreamOutput::writeInt);
-            });
-        } else {
-            out.writeBoolean(false);
-        }
-        if (executables != null) {
-            out.writeBoolean(true);
-            out.writeMap(executables, StreamOutput::writeString);
-        } else {
-            out.writeBoolean(false);
-        }
-        if (stackTraceEvents != null) {
-            out.writeBoolean(true);
-            out.writeMap(stackTraceEvents, (o, v) -> {
-                o.writeString(v.stacktraceID);
-                o.writeLong(v.count);
-            });
-        } else {
-            out.writeBoolean(false);
-        }
-        out.writeInt(totalFrames);
-        out.writeDouble(samplingRate);
-        out.writeLong(totalSamples);
+    public void writeTo(StreamOutput out) {
+        TransportAction.localOnly();
     }
 
     public Map<String, StackTrace> getStackTraces() {

+ 3 - 4
x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/TransportGetFlamegraphAction.java

@@ -11,12 +11,11 @@ import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.elasticsearch.action.ActionListener;
 import org.elasticsearch.action.support.ActionFilters;
-import org.elasticsearch.action.support.HandledTransportAction;
+import org.elasticsearch.action.support.TransportAction;
 import org.elasticsearch.client.internal.Client;
 import org.elasticsearch.client.internal.ParentTaskAssigningClient;
 import org.elasticsearch.client.internal.node.NodeClient;
 import org.elasticsearch.common.inject.Inject;
-import org.elasticsearch.common.util.concurrent.EsExecutors;
 import org.elasticsearch.tasks.Task;
 import org.elasticsearch.transport.TransportService;
 
@@ -27,7 +26,7 @@ import java.util.Map;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
-public class TransportGetFlamegraphAction extends HandledTransportAction<GetStackTracesRequest, GetFlamegraphResponse> {
+public class TransportGetFlamegraphAction extends TransportAction<GetStackTracesRequest, GetFlamegraphResponse> {
     private static final Logger log = LogManager.getLogger(TransportGetFlamegraphAction.class);
     private static final StackFrame EMPTY_STACKFRAME = new StackFrame("", "", 0, 0);
 
@@ -36,7 +35,7 @@ public class TransportGetFlamegraphAction extends HandledTransportAction<GetStac
 
     @Inject
     public TransportGetFlamegraphAction(NodeClient nodeClient, TransportService transportService, ActionFilters actionFilters) {
-        super(GetFlamegraphAction.NAME, transportService, actionFilters, GetStackTracesRequest::new, EsExecutors.DIRECT_EXECUTOR_SERVICE);
+        super(GetFlamegraphAction.NAME, actionFilters, transportService.getTaskManager());
         this.nodeClient = nodeClient;
         this.transportService = transportService;
     }

+ 3 - 4
x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/TransportGetStackTracesAction.java

@@ -13,8 +13,8 @@ import org.elasticsearch.action.get.MultiGetItemResponse;
 import org.elasticsearch.action.get.MultiGetResponse;
 import org.elasticsearch.action.search.SearchResponse;
 import org.elasticsearch.action.support.ActionFilters;
-import org.elasticsearch.action.support.HandledTransportAction;
 import org.elasticsearch.action.support.RefCountAwareThreadedActionListener;
+import org.elasticsearch.action.support.TransportAction;
 import org.elasticsearch.client.internal.Client;
 import org.elasticsearch.client.internal.ParentTaskAssigningClient;
 import org.elasticsearch.client.internal.node.NodeClient;
@@ -25,7 +25,6 @@ import org.elasticsearch.common.Strings;
 import org.elasticsearch.common.inject.Inject;
 import org.elasticsearch.common.settings.Setting;
 import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.util.concurrent.EsExecutors;
 import org.elasticsearch.core.TimeValue;
 import org.elasticsearch.index.Index;
 import org.elasticsearch.index.IndexNotFoundException;
@@ -65,7 +64,7 @@ import java.util.concurrent.Executor;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.Function;
 
-public class TransportGetStackTracesAction extends HandledTransportAction<GetStackTracesRequest, GetStackTracesResponse> {
+public class TransportGetStackTracesAction extends TransportAction<GetStackTracesRequest, GetStackTracesResponse> {
     private static final Logger log = LogManager.getLogger(TransportGetStackTracesAction.class);
 
     public static final Setting<Integer> PROFILING_MAX_STACKTRACE_QUERY_SLICES = Setting.intSetting(
@@ -133,7 +132,7 @@ public class TransportGetStackTracesAction extends HandledTransportAction<GetSta
         InstanceTypeService instanceTypeService,
         IndexNameExpressionResolver resolver
     ) {
-        super(GetStackTracesAction.NAME, transportService, actionFilters, GetStackTracesRequest::new, EsExecutors.DIRECT_EXECUTOR_SERVICE);
+        super(GetStackTracesAction.NAME, actionFilters, transportService.getTaskManager());
         this.nodeClient = nodeClient;
         this.licenseChecker = licenseChecker;
         this.instanceTypeService = instanceTypeService;

+ 60 - 47
x-pack/plugin/profiling/src/test/java/org/elasticsearch/xpack/profiling/GetStackTracesRequestTests.java

@@ -8,12 +8,8 @@
 package org.elasticsearch.xpack.profiling;
 
 import org.elasticsearch.common.ParsingException;
-import org.elasticsearch.common.io.stream.BytesStreamOutput;
-import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput;
 import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
 import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.index.query.BoolQueryBuilder;
-import org.elasticsearch.index.query.QueryBuilder;
 import org.elasticsearch.index.query.RangeQueryBuilder;
 import org.elasticsearch.search.SearchModule;
 import org.elasticsearch.test.ESTestCase;
@@ -28,47 +24,6 @@ import java.util.Set;
 import static java.util.Collections.emptyList;
 
 public class GetStackTracesRequestTests extends ESTestCase {
-    public void testSerialization() throws IOException {
-        Integer sampleSize = randomIntBetween(1, Integer.MAX_VALUE);
-        Double requestedDuration = randomBoolean() ? randomDoubleBetween(0.001d, Double.MAX_VALUE, true) : null;
-        Double awsCostFactor = randomBoolean() ? randomDoubleBetween(0.1d, 5.0d, true) : null;
-        Double customCO2PerKWH = randomBoolean() ? randomDoubleBetween(0.000001d, 0.001d, true) : null;
-        Double datacenterPUE = randomBoolean() ? randomDoubleBetween(1.0d, 3.0d, true) : null;
-        Double perCoreWattX86 = randomBoolean() ? randomDoubleBetween(0.01d, 20.0d, true) : null;
-        Double perCoreWattARM64 = randomBoolean() ? randomDoubleBetween(0.01d, 20.0d, true) : null;
-        Double customCostPerCoreHour = randomBoolean() ? randomDoubleBetween(0.001d, 1000.0d, true) : null;
-        QueryBuilder query = randomBoolean() ? new BoolQueryBuilder() : null;
-
-        GetStackTracesRequest request = new GetStackTracesRequest(
-            sampleSize,
-            requestedDuration,
-            awsCostFactor,
-            query,
-            null,
-            null,
-            customCO2PerKWH,
-            datacenterPUE,
-            perCoreWattX86,
-            perCoreWattARM64,
-            customCostPerCoreHour
-        );
-        try (BytesStreamOutput out = new BytesStreamOutput()) {
-            request.writeTo(out);
-            try (NamedWriteableAwareStreamInput in = new NamedWriteableAwareStreamInput(out.bytes().streamInput(), writableRegistry())) {
-                GetStackTracesRequest deserialized = new GetStackTracesRequest(in);
-                assertEquals(sampleSize, deserialized.getSampleSize());
-                assertEquals(requestedDuration, deserialized.getRequestedDuration());
-                assertEquals(awsCostFactor, deserialized.getAwsCostFactor());
-                assertEquals(customCO2PerKWH, deserialized.getCustomCO2PerKWH());
-                assertEquals(datacenterPUE, deserialized.getCustomDatacenterPUE());
-                assertEquals(perCoreWattX86, deserialized.getCustomPerCoreWattX86());
-                assertEquals(perCoreWattARM64, deserialized.getCustomPerCoreWattARM64());
-                assertEquals(customCostPerCoreHour, deserialized.getCustomCostPerCoreHour());
-                assertEquals(query, deserialized.getQuery());
-            }
-        }
-    }
-
     public void testParseValidXContent() throws IOException {
         try (XContentParser content = createParser(XContentFactory.jsonBuilder()
         //tag::noformat
@@ -93,6 +48,15 @@ public class GetStackTracesRequestTests extends ESTestCase {
             assertEquals(Double.valueOf(100.54d), request.getRequestedDuration());
             // a basic check suffices here
             assertEquals("@timestamp", ((RangeQueryBuilder) request.getQuery()).fieldName());
+            // Expect the default values
+            assertNull(request.getIndices());
+            assertNull(request.getStackTraceIds());
+            assertNull(request.getAwsCostFactor());
+            assertNull(request.getCustomCO2PerKWH());
+            assertNull(request.getCustomDatacenterPUE());
+            assertNull(request.getCustomCostPerCoreHour());
+            assertNull(request.getCustomPerCoreWattX86());
+            assertNull(request.getCustomPerCoreWattARM64());
         }
     }
 
@@ -124,7 +88,57 @@ public class GetStackTracesRequestTests extends ESTestCase {
             assertEquals("@timestamp", ((RangeQueryBuilder) request.getQuery()).fieldName());
 
             // Expect the default values
-            assertEquals(null, request.getRequestedDuration());
+            assertNull(request.getRequestedDuration());
+            assertNull(request.getAwsCostFactor());
+            assertNull(request.getCustomCO2PerKWH());
+            assertNull(request.getCustomDatacenterPUE());
+            assertNull(request.getCustomCostPerCoreHour());
+            assertNull(request.getCustomPerCoreWattX86());
+            assertNull(request.getCustomPerCoreWattARM64());
+        }
+    }
+
+    public void testParseValidXContentWithCustomCostAndCO2Data() throws IOException {
+        try (XContentParser content = createParser(XContentFactory.jsonBuilder()
+        //tag::noformat
+            .startObject()
+                .field("sample_size", 2000)
+                .field("requested_duration", 100.54d)
+                .field("aws_cost_factor", 7.3d)
+                .field("co2_per_kwh", 22.4d)
+                .field("datacenter_pue", 1.05d)
+                .field("cost_per_core_hour", 3.32d)
+                .field("per_core_watt_x86", 7.2d)
+                .field("per_core_watt_arm64", 2.82d)
+                .startObject("query")
+                    .startObject("range")
+                        .startObject("@timestamp")
+                            .field("gte", "2022-10-05")
+                        .endObject()
+                    .endObject()
+                .endObject()
+            .endObject()
+        //end::noformat
+        )) {
+
+            GetStackTracesRequest request = new GetStackTracesRequest();
+            request.parseXContent(content);
+
+            assertEquals(Integer.valueOf(2000), request.getSampleSize());
+            assertEquals(Double.valueOf(100.54d), request.getRequestedDuration());
+            assertEquals(Double.valueOf(7.3d), request.getAwsCostFactor());
+            assertEquals(Double.valueOf(22.4d), request.getCustomCO2PerKWH());
+            assertEquals(Double.valueOf(1.05d), request.getCustomDatacenterPUE());
+            assertEquals(Double.valueOf(3.32d), request.getCustomCostPerCoreHour());
+            assertEquals(Double.valueOf(7.2d), request.getCustomPerCoreWattX86());
+            assertEquals(Double.valueOf(2.82d), request.getCustomPerCoreWattARM64());
+
+            // a basic check suffices here
+            assertEquals("@timestamp", ((RangeQueryBuilder) request.getQuery()).fieldName());
+
+            // Expect the default values
+            assertNull(request.getIndices());
+            assertNull(request.getStackTraceIds());
         }
     }
 
@@ -246,7 +260,6 @@ public class GetStackTracesRequestTests extends ESTestCase {
     }
 
     public void testConsidersDefaultIndicesInRelatedIndices() {
-        String customIndex = randomAlphaOfLength(5);
         GetStackTracesRequest request = new GetStackTracesRequest(1, 1.0d, 1.0d, null, null, null, null, null, null, null, null);
         String[] indices = request.indices();
         assertEquals(15, indices.length);

+ 3 - 15
x-pack/plugin/profiling/src/test/java/org/elasticsearch/xpack/profiling/GetStackTracesResponseTests.java

@@ -7,20 +7,18 @@
 
 package org.elasticsearch.xpack.profiling;
 
-import org.elasticsearch.common.io.stream.Writeable;
 import org.elasticsearch.test.AbstractChunkedSerializingTestCase;
-import org.elasticsearch.test.AbstractWireSerializingTestCase;
+import org.elasticsearch.test.ESTestCase;
 
 import java.util.List;
 import java.util.Map;
 
-public class GetStackTracesResponseTests extends AbstractWireSerializingTestCase<GetStackTracesResponse> {
+public class GetStackTracesResponseTests extends ESTestCase {
     private <T> T randomNullable(T v) {
         return randomBoolean() ? v : null;
     }
 
-    @Override
-    protected GetStackTracesResponse createTestInstance() {
+    private GetStackTracesResponse createTestInstance() {
         int totalFrames = randomIntBetween(1, 100);
 
         Map<String, StackTrace> stackTraces = randomNullable(
@@ -57,16 +55,6 @@ public class GetStackTracesResponseTests extends AbstractWireSerializingTestCase
         return new GetStackTracesResponse(stackTraces, stackFrames, executables, stackTraceEvents, totalFrames, 1.0, totalSamples);
     }
 
-    @Override
-    protected GetStackTracesResponse mutateInstance(GetStackTracesResponse instance) {
-        return null;// TODO implement https://github.com/elastic/elasticsearch/issues/25929
-    }
-
-    @Override
-    protected Writeable.Reader<GetStackTracesResponse> instanceReader() {
-        return GetStackTracesResponse::new;
-    }
-
     public void testChunking() {
         AbstractChunkedSerializingTestCase.assertChunkCount(createTestInstance(), instance -> {
             // start, end, total_frames, samplingrate