Skip to content

Commit

Permalink
[Observability] filter "hasData" api by processor event (#72810) (#72833
Browse files Browse the repository at this point in the history
)

* filtering hasdata by processor event

* adding api test

Co-authored-by: Cauê Marcondes <55978943+cauemarcondes@users.noreply.github.com>
  • Loading branch information
kibanamachine and cauemarcondes authored Jul 22, 2020
1 parent 7842a82 commit 2c0e089
Show file tree
Hide file tree
Showing 6 changed files with 4,342 additions and 1 deletion.
21 changes: 20 additions & 1 deletion x-pack/plugins/apm/server/lib/observability_overview/has_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { PROCESSOR_EVENT } from '../../../common/elasticsearch_fieldnames';
import { ProcessorEvent } from '../../../common/processor_event';
import { Setup } from '../helpers/setup_request';

export async function hasData({ setup }: { setup: Setup }) {
Expand All @@ -15,7 +17,24 @@ export async function hasData({ setup }: { setup: Setup }) {
indices['apm_oss.metricsIndices'],
],
terminateAfter: 1,
size: 0,
body: {
size: 0,
query: {
bool: {
filter: [
{
terms: {
[PROCESSOR_EVENT]: [
ProcessorEvent.error,
ProcessorEvent.metric,
ProcessorEvent.transaction,
],
},
},
],
},
},
},
};

const response = await client.search(params);
Expand Down
Binary file not shown.
Loading

0 comments on commit 2c0e089

Please sign in to comment.