Skip to content

Commit 673c268

Browse files
authored
resolve merge conflicts in apm-data plugin unit test (#123165)
1 parent 3b1c857 commit 673c268

File tree

3 files changed

+49
-9
lines changed

3 files changed

+49
-9
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: []

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: 37 additions & 5 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,11 +120,15 @@ 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]} }
131+
100132
---
101133
"Test traces-apm-* setting event.ingested via ingest pipeline":
102134
- requires:
@@ -123,4 +155,4 @@ setup:
123155
fields: ["event.ingested"]
124156
- length: { hits.hits: 2 }
125157
- is_after: { hits.hits.1.fields.event\.ingested.0: "2017-06-22T00:00:00.000Z" }
126-
158+

0 commit comments

Comments
 (0)