Skip to content

Commit faefe32

Browse files
committed
plugin: add representative count to apm-data
1 parent 385040d commit faefe32

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ processors:
3030
field: ["event.duration"]
3131
ignore_failure: true
3232
ignore_missing: true
33-
- set:
33+
- script:
3434
if: ctx.event?.outcome == 'success'
35-
field: event.success_count
36-
value: 1
35+
source: |
36+
ctx.event.success_count = ctx[ctx.processor?.event].representative_count;
3737
- set:
3838
if: ctx.event?.outcome == 'failure'
3939
field: event.success_count

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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,20 @@ 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+
}'
8497

8598
- create: {}
8699
- '{"@timestamp": "2017-06-22", "event": {"outcome": "failure"}}'
@@ -92,8 +105,9 @@ setup:
92105
index: traces-apm-testing
93106
body:
94107
fields: ["event.success_count"]
95-
- length: { hits.hits: 4 }
108+
- length: { hits.hits: 5 }
96109
- match: { hits.hits.0.fields: null }
97110
- 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]} }
111+
- match: { hits.hits.2.fields: {"event.success_count": [2]} }
112+
- match: { hits.hits.3.fields: {"event.success_count": [3]} }
113+
- match: { hits.hits.4.fields: {"event.success_count": [0]} }

0 commit comments

Comments
 (0)