Skip to content

Commit 2c0e089

Browse files
[Observability] filter "hasData" api by processor event (#72810) (#72833)
* filtering hasdata by processor event * adding api test Co-authored-by: Cauê Marcondes <55978943+cauemarcondes@users.noreply.github.com>
1 parent 7842a82 commit 2c0e089

File tree

6 files changed

+4342
-1
lines changed

6 files changed

+4342
-1
lines changed

x-pack/plugins/apm/server/lib/observability_overview/has_data.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* or more contributor license agreements. Licensed under the Elastic License;
44
* you may not use this file except in compliance with the Elastic License.
55
*/
6+
import { PROCESSOR_EVENT } from '../../../common/elasticsearch_fieldnames';
7+
import { ProcessorEvent } from '../../../common/processor_event';
68
import { Setup } from '../helpers/setup_request';
79

810
export async function hasData({ setup }: { setup: Setup }) {
@@ -15,7 +17,24 @@ export async function hasData({ setup }: { setup: Setup }) {
1517
indices['apm_oss.metricsIndices'],
1618
],
1719
terminateAfter: 1,
18-
size: 0,
20+
body: {
21+
size: 0,
22+
query: {
23+
bool: {
24+
filter: [
25+
{
26+
terms: {
27+
[PROCESSOR_EVENT]: [
28+
ProcessorEvent.error,
29+
ProcessorEvent.metric,
30+
ProcessorEvent.transaction,
31+
],
32+
},
33+
},
34+
],
35+
},
36+
},
37+
},
1938
};
2039

2140
const response = await client.search(params);
Binary file not shown.

0 commit comments

Comments
 (0)