Skip to content

Commit

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

* adding api test
  • Loading branch information
cauemarcondes committed Jul 22, 2020
1 parent e389968 commit c8c04f9
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 c8c04f9

Please sign in to comment.