From b72601c283bd9982ef2ed415b40e3cef179e19ac Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Tue, 19 Jul 2022 09:35:54 +0200 Subject: [PATCH] [performance] Re-enable apm extraction step (#136555) * [kbn-performance-testing-dataset-extractor] add extra logging * re-enable step --- .buildkite/pipelines/performance/daily.yml | 10 +++++----- .../src/es_client.ts | 13 ++++++++++--- .../src/extractor.ts | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.buildkite/pipelines/performance/daily.yml b/.buildkite/pipelines/performance/daily.yml index fdc4ae17d69a2..28f58d6c814ef 100644 --- a/.buildkite/pipelines/performance/daily.yml +++ b/.buildkite/pipelines/performance/daily.yml @@ -19,11 +19,11 @@ steps: depends_on: build key: tests - # - label: ':shipit: Performance Tests dataset extraction for scalability benchmarking' - # command: .buildkite/scripts/steps/functional/scalability_dataset_extraction.sh - # agents: - # queue: n2-2 - # depends_on: tests + - label: ':shipit: Performance Tests dataset extraction for scalability benchmarking' + command: .buildkite/scripts/steps/functional/scalability_dataset_extraction.sh + agents: + queue: n2-2 + depends_on: tests - label: ':chart_with_upwards_trend: Report performance metrics to ci-stats' command: .buildkite/scripts/steps/functional/report_performance_metrics.sh diff --git a/packages/kbn-performance-testing-dataset-extractor/src/es_client.ts b/packages/kbn-performance-testing-dataset-extractor/src/es_client.ts index d115b2f3bbabd..83ba9a16e851b 100644 --- a/packages/kbn-performance-testing-dataset-extractor/src/es_client.ts +++ b/packages/kbn-performance-testing-dataset-extractor/src/es_client.ts @@ -8,6 +8,8 @@ import { Client } from '@elastic/elasticsearch'; import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types'; +import { SearchRequest } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { ToolingLog } from '@kbn/tooling-log'; interface ClientOptions { node: string; @@ -81,7 +83,7 @@ const addRangeFilter = (range: { startTime: string; endTime: string }): QueryDsl }; }; -export function initClient(options: ClientOptions) { +export function initClient(options: ClientOptions, log: ToolingLog) { const client = new Client({ node: options.node, auth: { @@ -119,8 +121,9 @@ export function initClient(options: ClientOptions) { const queryFilters = filters.map((filter) => addBooleanFilter(filter)); return await this.getTransactions(queryFilters); }, + async getTransactions(queryFilters: QueryDslQueryContainer[]) { - const result = await client.search({ + const searchRequest: SearchRequest = { body: { track_total_hits: true, sort: [ @@ -149,7 +152,11 @@ export function initClient(options: ClientOptions) { }, }, }, - }); + }; + + log.debug(`Search request: ${JSON.stringify(searchRequest)}`); + const result = await client.search(searchRequest); + log.debug(`Search result: ${JSON.stringify(result)}`); return result?.hits?.hits; }, }; diff --git a/packages/kbn-performance-testing-dataset-extractor/src/extractor.ts b/packages/kbn-performance-testing-dataset-extractor/src/extractor.ts index 1e2b1234c52cc..1335f6c4b47c5 100644 --- a/packages/kbn-performance-testing-dataset-extractor/src/extractor.ts +++ b/packages/kbn-performance-testing-dataset-extractor/src/extractor.ts @@ -107,7 +107,7 @@ export const extractor = async ({ param, client, log }: CLIParams) => { log.info( `Searching transactions with 'labels.testBuildId=${buildId}' and 'labels.journeyName=${journeyName}'` ); - const esClient = initClient(authOptions); + const esClient = initClient(authOptions, log); const ftrTransactionHits = await esClient.getFtrTransactions(buildId, journeyName); if (!ftrTransactionHits || ftrTransactionHits.length === 0) { log.warning(