Skip to content

Commit 0113501

Browse files
committed
Merge remote-tracking branch 'upstream/main' into add-base64-encoded-float32-support
2 parents 24d33ce + f3cc558 commit 0113501

File tree

47 files changed

+634
-1160
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+634
-1160
lines changed

build-tools/src/main/java/org/elasticsearch/gradle/testclusters/MockApmServer.java

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99

1010
package org.elasticsearch.gradle.testclusters;
1111

12+
import com.fasterxml.jackson.databind.JsonNode;
1213
import com.fasterxml.jackson.databind.ObjectMapper;
1314
import com.fasterxml.jackson.databind.node.ObjectNode;
15+
import com.fasterxml.jackson.databind.util.LRUMap;
16+
import com.fasterxml.jackson.databind.util.LookupCache;
1417
import com.sun.net.httpserver.HttpExchange;
1518
import com.sun.net.httpserver.HttpHandler;
1619
import com.sun.net.httpserver.HttpServer;
@@ -28,7 +31,9 @@
2831
import java.io.InputStreamReader;
2932
import java.io.OutputStream;
3033
import java.net.InetSocketAddress;
34+
import java.util.ArrayList;
3135
import java.util.Arrays;
36+
import java.util.List;
3237
import java.util.regex.Pattern;
3338
import java.util.stream.Collectors;
3439

@@ -48,6 +53,8 @@
4853
public class MockApmServer {
4954
private static final Logger logger = Logging.getLogger(MockApmServer.class);
5055
private static final org.slf4j.Logger log = LoggerFactory.getLogger(MockApmServer.class);
56+
private static final LookupCache<String, String> transactionCache = new LRUMap(16, 16);
57+
5158
private final Pattern metricFilter;
5259
private final Pattern transactionFilter;
5360
private final Pattern transactionExcludesFilter;
@@ -136,22 +143,28 @@ private void logFiltered(InputStream body) throws IOException {
136143
ObjectMapper mapper = new ObjectMapper();
137144
try (BufferedReader reader = new BufferedReader(new InputStreamReader(body))) {
138145
String line;
139-
String tier = null;
140-
String node = null;
146+
String nodeMetadata = null;
147+
148+
List<JsonNode> spans = new ArrayList<>();
141149

142150
while ((line = reader.readLine()) != null) {
143151
var jsonNode = mapper.readTree(line);
144152

145153
if (jsonNode.has("metadata")) {
146-
node = jsonNode.path("metadata").path("service").path("node").path("configured_name").asText(null);
147-
tier = jsonNode.path("metadata").path("labels").path("node_tier").asText(null);
154+
nodeMetadata = jsonNode.path("metadata").path("service").path("node").path("configured_name").asText(null);
155+
var tier = jsonNode.path("metadata").path("labels").path("node_tier").asText(null);
156+
nodeMetadata += tier != null ? "/" + tier : "";
157+
148158
} else if (transactionFilter != null && jsonNode.has("transaction")) {
149159
var transaction = jsonNode.get("transaction");
150160
var name = transaction.get("name").asText();
151161
if (transactionFilter.matcher(name).matches()
152162
&& (transactionExcludesFilter == null || transactionExcludesFilter.matcher(name).matches() == false)) {
153-
logger.lifecycle("Transaction [{}/{}]: {}", node, tier, transaction);
163+
transactionCache.put(transaction.get("id").asText(), name);
164+
logger.lifecycle("Transaction {} [{}]: {}", name, nodeMetadata, transaction);
154165
}
166+
} else if (jsonNode.has("span")) {
167+
spans.add(jsonNode.get("span")); // make sure to record all transactions first
155168
} else if (metricFilter != null && jsonNode.has("metricset")) {
156169
var metricset = jsonNode.get("metricset");
157170
var samples = (ObjectNode) metricset.get("samples");
@@ -161,10 +174,20 @@ private void logFiltered(InputStream body) throws IOException {
161174
}
162175
}
163176
if (samples.isEmpty() == false) {
164-
logger.lifecycle("Metricset [{}/{}]", node, tier, metricset);
177+
logger.lifecycle("Metricset [{}]: {}", nodeMetadata, metricset);
165178
}
166179
}
167180
}
181+
182+
// emit only spans for previously matched transactions using the transaction cache
183+
for (var span : spans) {
184+
var name = span.get("name").asText();
185+
var transactionId = span.get("transaction_id").asText();
186+
var transactionName = transactionCache.get(transactionId);
187+
if (transactionName != null) {
188+
logger.lifecycle("Span {} of {} [{}]: {}", name, transactionName, nodeMetadata, span);
189+
}
190+
}
168191
}
169192
}
170193
}

distribution/tools/server-cli/src/main/java/org/elasticsearch/server/cli/APMJvmOptions.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ class APMJvmOptions {
8181
"metrics_interval", "120s",
8282
"breakdown_metrics", "false",
8383
"central_config", "false",
84-
"transaction_sample_rate", "0.2"
84+
"transaction_sample_rate", "0.2",
85+
// Don't collect stacktraces for spans, typically these are of little use as
86+
// always pointing to APMTracer.stopTrace invoked from TaskManager
87+
"stack_trace_limit", "0"
8588
);
8689
// end::noformat
8790

docs/changelog/136951.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 136951
2+
summary: Support different downsampling methods through ILM
3+
area: "ILM+SLM"
4+
type: enhancement
5+
issues: []

docs/changelog/137244.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 137244
2+
summary: Preserve deployments with zero allocations during assignment planning
3+
area: Machine Learning
4+
type: bug
5+
issues:
6+
- 137134

docs/reference/elasticsearch/index-lifecycle-actions/ilm-downsample.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ To use the `downsample` action in the `hot` phase, the `rollover` action **must*
1919

2020
`fixed_interval`
2121
: (Required, string) The [fixed time interval](docs-content://manage-data/lifecycle/rollup/understanding-groups.md#rollup-understanding-group-intervals) into which the data will be downsampled.
22+
2223
`force_merge_index` {applies_to}`stack: ga 9.3`
2324
: (Optional, boolean) When true, the downsampled index will be [force merged](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-forcemerge) to one [segment](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-segments). Defaults to `true`.
2425

26+
`sampling_method` {applies_to}`stack: ga 9.3`
27+
: (Optional, string) The sampling method that will be used to sample metrics; there are two methods available `aggregate` and
28+
the `last_value`. Defaults to `aggregate`.
2529

2630
## Example [ilm-downsample-ex]
2731

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,6 @@ tests:
501501
- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
502502
method: test {yaml=indices.validate_query/20_query_string/validate_query with query_string parameters}
503503
issue: https://github.com/elastic/elasticsearch/issues/137391
504-
- class: org.elasticsearch.xpack.downsample.ILMDownsampleDisruptionIT
505-
method: testILMDownsampleRollingRestart
506-
issue: https://github.com/elastic/elasticsearch/issues/136585
507504

508505
# Examples:
509506
#

qa/ccs-common-rest/src/yamlRestTest/java/org/elasticsearch/test/rest/yaml/CcsCommonYamlTestSuiteIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ public class CcsCommonYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
9696
// geohex_grid requires gold license
9797
.setting("xpack.license.self_generated.type", "trial")
9898
.feature(FeatureFlag.TIME_SERIES_MODE)
99-
.feature(FeatureFlag.SUB_OBJECTS_AUTO_ENABLED)
10099
.feature(FeatureFlag.SYNTHETIC_VECTORS);
101100

102101
private static ElasticsearchCluster remoteCluster = ElasticsearchCluster.local()

qa/ccs-common-rest/src/yamlRestTest/java/org/elasticsearch/test/rest/yaml/RcsCcsCommonYamlTestSuiteIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ public class RcsCcsCommonYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
9595
.setting("xpack.security.remote_cluster_server.ssl.enabled", "false")
9696
.setting("xpack.security.remote_cluster_client.ssl.enabled", "false")
9797
.feature(FeatureFlag.TIME_SERIES_MODE)
98-
.feature(FeatureFlag.SUB_OBJECTS_AUTO_ENABLED)
9998
.feature(FeatureFlag.SYNTHETIC_VECTORS)
10099
.user("test_admin", "x-pack-test-password");
101100

qa/mixed-cluster/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ buildParams.bwcVersions.withWireCompatible { bwcVersion, baseName ->
8989
setting 'health.master_history.no_master_transitions_threshold', '10'
9090
}
9191
requiresFeature 'es.index_mode_feature_flag_registered', Version.fromString("8.0.0")
92-
requiresFeature 'sub_objects_auto', Version.fromString("8.16.0")
9392
if (bwcVersion.before(Version.fromString("8.18.0"))) {
9493
jvmArgs '-da:org.elasticsearch.index.mapper.DocumentMapper'
9594
jvmArgs '-da:org.elasticsearch.index.mapper.MapperService'
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.packaging.test;
11+
12+
import org.elasticsearch.packaging.util.Platforms;
13+
import org.elasticsearch.packaging.util.ProcessInfo;
14+
import org.junit.BeforeClass;
15+
16+
import java.util.List;
17+
18+
import static com.carrotsearch.randomizedtesting.RandomizedTest.assumeTrue;
19+
import static org.hamcrest.Matchers.equalTo;
20+
21+
// tests for how the linux distro interacts with the OS
22+
public class LinuxSystemTests extends PackagingTestCase {
23+
24+
@BeforeClass
25+
public static void ensureLinux() {
26+
assumeTrue(Platforms.LINUX);
27+
}
28+
29+
public void test10Install() throws Exception {
30+
install();
31+
}
32+
33+
public void test20CoredumpFilter() throws Exception {
34+
startElasticsearch();
35+
36+
// find the Elasticsearch process
37+
int esPid = -1;
38+
List<ProcessInfo> procs = ProcessInfo.getProcessInfo(sh, "java");
39+
for (ProcessInfo proc : procs) {
40+
if (proc.commandLine().contains("org.elasticsearch.bootstrap.Elasticsearch")) {
41+
esPid = proc.pid();
42+
}
43+
}
44+
if (esPid == -1) {
45+
fail("Could not find Elasticsearch process, existing processes:\n" + procs);
46+
}
47+
48+
// check the coredump filter was set correctly
49+
String coredumpFilter = sh.run("cat /proc/" + esPid + "/coredump_filter").stdout().trim();
50+
assertThat(coredumpFilter, equalTo("00000023"));
51+
}
52+
53+
}

0 commit comments

Comments
 (0)