Skip to content

Commit 1db2ea8

Browse files
authored
[Profiling] Fix ES queries for serverless (elastic#130624)
* [Profiling] Fix ES queries for serverless * Remove Resampler and its tests * Remove the final keyword from local variables
1 parent 71434e6 commit 1db2ea8

File tree

5 files changed

+196
-395
lines changed

5 files changed

+196
-395
lines changed

x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/action/GetStackTracesRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@ public boolean equals(Object o) {
398398
public int hashCode() {
399399
// The object representation of `query` may use Lucene's ByteRef to represent values. This class' hashCode implementation
400400
// uses StringUtils.GOOD_FAST_HASH_SEED which is reinitialized for each JVM. This means that hashcode is consistent *within*
401-
// a JVM but will not be consistent across the cluster. As we use hashCode e.g. to initialize the random number generator in
402-
// Resampler to produce a consistent downsampling results, relying on the default hashCode implementation of `query` will
401+
// a JVM but will not be consistent across the cluster. As we use hashCode to initialize random number generators
402+
// to produce consistent downsampling results, relying on the default hashCode implementation of `query` will
403403
// produce consistent results per node but not across the cluster. To avoid this, we produce the hashCode based on the
404404
// string representation instead, which will produce consistent results for the entire cluster and across node restarts.
405405
return Objects.hash(Objects.toString(query, "null"), sampleSize, Arrays.hashCode(indices), stackTraceIdsField);

x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/action/GetStackTracesResponseBuilder.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class GetStackTracesResponseBuilder {
2020
private Map<TraceEventID, TraceEvent> stackTraceEvents;
2121
private double samplingRate;
2222
private long totalSamples;
23+
private long samplingFrequency;
2324
private Double requestedDuration;
2425
private final Double awsCostFactor;
2526
private final Double azureCostFactor;
@@ -155,4 +156,12 @@ public GetStackTracesResponse build() {
155156
}
156157
return new GetStackTracesResponse(stackTraces, stackFrames, executables, stackTraceEvents, totalFrames, samplingRate, totalSamples);
157158
}
159+
160+
public void setSamplingFrequency(long samplingFrequency) {
161+
this.samplingFrequency = samplingFrequency;
162+
}
163+
164+
public long getSamplingFrequency() {
165+
return samplingFrequency;
166+
}
158167
}

x-pack/plugin/profiling/src/main/java/org/elasticsearch/xpack/profiling/action/Resampler.java

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)