Skip to content

Commit b1d5d7a

Browse files
authored
Merge branch 'elastic:main' into main
2 parents 2a27c1d + 521f855 commit b1d5d7a

File tree

5 files changed

+47
-52
lines changed

5 files changed

+47
-52
lines changed

docs/changelog/119995.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 119995
2+
summary: "apm-data: Use representative count as event.success_count if available"
3+
area: Ingest Node
4+
type: bug
5+
issues: []

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,6 @@ tests:
274274
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
275275
method: test {yaml=reference/cat/health/cat-health-example}
276276
issue: https://github.com/elastic/elasticsearch/issues/122335
277-
- class: org.elasticsearch.xpack.esql.action.CrossClusterCancellationIT
278-
method: testCloseSkipUnavailable
279-
issue: https://github.com/elastic/elasticsearch/issues/122336
280277
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
281278
method: test {yaml=reference/alias/line_260}
282279
issue: https://github.com/elastic/elasticsearch/issues/122343

x-pack/plugin/apm-data/src/main/resources/ingest-pipelines/[email protected]

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,16 @@ processors:
3030
field: ["event.duration"]
3131
ignore_failure: true
3232
ignore_missing: true
33-
- set:
34-
if: ctx.event?.outcome == 'success'
35-
field: event.success_count
36-
value: 1
3733
- set:
3834
if: ctx.event?.outcome == 'failure'
3935
field: event.success_count
4036
value: 0
37+
- set:
38+
if: ctx.event?.outcome == 'success'
39+
field: event.success_count
40+
value: 1
41+
- script:
42+
if: ctx.event?.outcome == 'success' && ctx[ctx.processor?.event]?.representative_count != null
43+
source: ctx.event.success_count = ctx[ctx.processor?.event]?.representative_count;
4144
- pipeline:
4245
name: apm@pipeline

x-pack/plugin/apm-data/src/yamlRestTest/resources/rest-api-spec/test/20_traces_ingest.yml

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,35 @@ setup:
8080
- '{"@timestamp": "2017-06-22", "event": {"outcome": "unknown"}}'
8181

8282
- create: {}
83-
- '{"@timestamp": "2017-06-22", "event": {"outcome": "success"}}'
83+
- '{
84+
"@timestamp": "2017-06-22",
85+
"processor": {"event": "transaction"},
86+
"event": {"outcome": "success"},
87+
"transaction": {"representative_count": 2}
88+
}'
89+
90+
- create: {}
91+
- '{
92+
"@timestamp": "2017-06-22",
93+
"processor": {"event": "span"},
94+
"event": {"outcome": "success"},
95+
"span": {"representative_count": 3}
96+
}'
97+
98+
- create: {}
99+
- '{
100+
"@timestamp": "2017-06-22",
101+
"processor": {"event": "span"},
102+
"event": {"outcome": "success"},
103+
"span": {"representative_count": null}
104+
}'
105+
106+
- create: {}
107+
- '{
108+
"@timestamp": "2017-06-22",
109+
"processor": {"event": "transaction"},
110+
"event": {"outcome": "success"}
111+
}'
84112

85113
- create: {}
86114
- '{"@timestamp": "2017-06-22", "event": {"outcome": "failure"}}'
@@ -92,8 +120,11 @@ setup:
92120
index: traces-apm-testing
93121
body:
94122
fields: ["event.success_count"]
95-
- length: { hits.hits: 4 }
123+
- length: { hits.hits: 7 }
96124
- match: { hits.hits.0.fields: null }
97125
- match: { hits.hits.1.fields: null }
98-
- match: { hits.hits.2.fields: {"event.success_count": [1]} }
99-
- match: { hits.hits.3.fields: {"event.success_count": [0]} }
126+
- match: { hits.hits.2.fields: {"event.success_count": [2]} }
127+
- match: { hits.hits.3.fields: {"event.success_count": [3]} }
128+
- match: { hits.hits.4.fields: {"event.success_count": [1]} }
129+
- match: { hits.hits.5.fields: {"event.success_count": [1]} }
130+
- match: { hits.hits.6.fields: {"event.success_count": [0]} }

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/CrossClusterCancellationIT.java

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
package org.elasticsearch.xpack.esql.action;
99

10-
import org.elasticsearch.Build;
1110
import org.elasticsearch.action.ActionFuture;
1211
import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksRequest;
1312
import org.elasticsearch.action.admin.cluster.node.tasks.cancel.TransportCancelTasksAction;
@@ -287,44 +286,4 @@ public void testCancelSkipUnavailable() throws Exception {
287286
Exception error = expectThrows(Exception.class, requestFuture::actionGet);
288287
assertThat(error, instanceOf(TaskCancelledException.class));
289288
}
290-
291-
// Check that closing remote node with skip_unavailable=true produces partial
292-
public void testCloseSkipUnavailable() throws Exception {
293-
// We are using delay() here because closing cluster while inside pause fields doesn't seem to produce clean closure
294-
assumeTrue("Only snapshot builds have delay()", Build.current().isSnapshot());
295-
createRemoteIndex(between(1000, 5000));
296-
createLocalIndex(10);
297-
EsqlQueryRequest request = EsqlQueryRequest.syncEsqlQueryRequest();
298-
request.query("""
299-
FROM test*,cluster-a:test* METADATA _index
300-
| EVAL cluster=MV_FIRST(SPLIT(_index, ":"))
301-
| WHERE CASE(cluster == "cluster-a", delay(1ms), true)
302-
| STATS total = sum(const) | LIMIT 1
303-
""");
304-
request.pragmas(randomPragmas());
305-
var requestFuture = client().execute(EsqlQueryAction.INSTANCE, request);
306-
assertTrue(SimplePauseFieldPlugin.startEmitting.await(30, TimeUnit.SECONDS));
307-
SimplePauseFieldPlugin.allowEmitting.countDown();
308-
cluster(REMOTE_CLUSTER).close();
309-
try (var resp = requestFuture.actionGet()) {
310-
EsqlExecutionInfo executionInfo = resp.getExecutionInfo();
311-
assertNotNull(executionInfo);
312-
assertThat(executionInfo.isPartial(), equalTo(true));
313-
314-
List<List<Object>> values = getValuesList(resp);
315-
assertThat(values.get(0).size(), equalTo(1));
316-
// We can't be sure of the exact value here as we don't know if any data from remote came in, but all local data should be there
317-
assertThat((long) values.get(0).get(0), greaterThanOrEqualTo(10L));
318-
319-
EsqlExecutionInfo.Cluster cluster = executionInfo.getCluster(REMOTE_CLUSTER);
320-
EsqlExecutionInfo.Cluster localCluster = executionInfo.getCluster(LOCAL_CLUSTER);
321-
322-
assertThat(localCluster.getStatus(), equalTo(EsqlExecutionInfo.Cluster.Status.SUCCESSFUL));
323-
assertThat(localCluster.getSuccessfulShards(), equalTo(1));
324-
325-
assertThat(cluster.getStatus(), equalTo(EsqlExecutionInfo.Cluster.Status.PARTIAL));
326-
assertThat(cluster.getSuccessfulShards(), equalTo(0));
327-
assertThat(cluster.getFailures().size(), equalTo(1));
328-
}
329-
}
330289
}

0 commit comments

Comments
 (0)