From 1498dd6266895016e6c2152add88f26cbe4009e4 Mon Sep 17 00:00:00 2001 From: "ievgen.degtiarenko" Date: Wed, 28 May 2025 11:30:04 +0200 Subject: [PATCH 1/8] Script for indexing micro benchmark results --- .buildkite/pipelines/periodic-micro-benchmarks.yml | 1 + .buildkite/scripts/index-micro-benchmark-results.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100755 .buildkite/scripts/index-micro-benchmark-results.sh diff --git a/.buildkite/pipelines/periodic-micro-benchmarks.yml b/.buildkite/pipelines/periodic-micro-benchmarks.yml index 102fa2483b7b6..92d98e093ee44 100644 --- a/.buildkite/pipelines/periodic-micro-benchmarks.yml +++ b/.buildkite/pipelines/periodic-micro-benchmarks.yml @@ -2,6 +2,7 @@ steps: - label: periodic-micro-benchmarks command: | .ci/scripts/run-gradle.sh -p benchmarks/ run --args 'org.elasticsearch.benchmark._nightly -rf json -rff build/result.json' + .ci/scripts/index-micro-benchmark-results.sh timeout_in_minutes: 300 agents: provider: gcp diff --git a/.buildkite/scripts/index-micro-benchmark-results.sh b/.buildkite/scripts/index-micro-benchmark-results.sh new file mode 100755 index 0000000000000..ea774a56319c4 --- /dev/null +++ b/.buildkite/scripts/index-micro-benchmark-results.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +METRICS_HOST=$(vault read -field=es_host /secret/performance/employees/cloud/nightly-rally-metrics) +METRICS_INDEX_NAME="dummy-micro-benchmarks" +METRICS_USERNAME=$(vault read -field=es_username /secret/performance/employees/cloud/nightly-rally-metrics) +METRICS_PASSWORD=$(vault read -field=es_password /secret/performance/employees/cloud/nightly-rally-metrics) + +jq -c '.[]' "benchmarks/build/result.json" | while read -r doc; do + curl -s -X POST "https://$METRICS_HOST/$METRICS_INDEX_NAME/_doc" \ + -u "$METRICS_USERNAME:$METRICS_PASSWORD" \ + -H 'Content-Type: application/json' \ + -d "$doc" +done From 7cf6370eaac23e622e4f75710d4f58a92b7a0d4a Mon Sep 17 00:00:00 2001 From: "ievgen.degtiarenko" Date: Wed, 28 May 2025 11:48:58 +0200 Subject: [PATCH 2/8] use esbench for now --- .buildkite/scripts/index-micro-benchmark-results.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.buildkite/scripts/index-micro-benchmark-results.sh b/.buildkite/scripts/index-micro-benchmark-results.sh index ea774a56319c4..38a4d7f779bb8 100755 --- a/.buildkite/scripts/index-micro-benchmark-results.sh +++ b/.buildkite/scripts/index-micro-benchmark-results.sh @@ -1,9 +1,9 @@ #!/bin/bash -METRICS_HOST=$(vault read -field=es_host /secret/performance/employees/cloud/nightly-rally-metrics) +METRICS_HOST=$(vault read -field=es_host /secret/performance/employees/cloud/esbench-metrics) METRICS_INDEX_NAME="dummy-micro-benchmarks" -METRICS_USERNAME=$(vault read -field=es_username /secret/performance/employees/cloud/nightly-rally-metrics) -METRICS_PASSWORD=$(vault read -field=es_password /secret/performance/employees/cloud/nightly-rally-metrics) +METRICS_USERNAME=$(vault read -field=es_username /secret/performance/employees/cloud/esbench-metrics) +METRICS_PASSWORD=$(vault read -field=es_password /secret/performance/employees/cloud/esbench-metrics) jq -c '.[]' "benchmarks/build/result.json" | while read -r doc; do curl -s -X POST "https://$METRICS_HOST/$METRICS_INDEX_NAME/_doc" \ From a18428c2fe78d3f4a7debc0621b578c1c001a298 Mon Sep 17 00:00:00 2001 From: "ievgen.degtiarenko" Date: Mon, 2 Jun 2025 09:33:26 +0200 Subject: [PATCH 3/8] move credentials --- .buildkite/hooks/pre-command | 12 ++++++++++++ .buildkite/scripts/index-micro-benchmark-results.sh | 10 +++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index 6bb549df8a1fb..805a6f25f8501 100644 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -94,6 +94,18 @@ if [[ "${USE_PROD_DOCKER_CREDENTIALS:-}" == "true" ]]; then fi fi +if [[ "${USE_PERF_CREDENTIALS:-}" == "true" ]]; then + PERF_METRICS_HOST=$(vault read -field=es_host /secret/ci/elastic-elasticsearch/esbench-metics) + PERF_METRICS_INDEX="dummy-micro-benchmarks" + PERF_METRICS_USERNAME=$(vault read -field=es_username /secret/ci/elastic-elasticsearch/esbench-metics) + PERF_METRICS_PASSWORD=$(vault read -field=es_password /secret/ci/elastic-elasticsearch/esbench-metics) + + export METRICS_HOST + export PERF_METRICS_INDEX + export METRICS_USERNAME + export METRICS_PASSWORD +fi + # Authenticate to the Docker Hub public read-only registry if which docker > /dev/null 2>&1; then DOCKERHUB_REGISTRY_USERNAME="$(vault read -field=username secret/ci/elastic-elasticsearch/docker_hub_public_ro_credentials)" diff --git a/.buildkite/scripts/index-micro-benchmark-results.sh b/.buildkite/scripts/index-micro-benchmark-results.sh index 38a4d7f779bb8..98dea481f31fb 100755 --- a/.buildkite/scripts/index-micro-benchmark-results.sh +++ b/.buildkite/scripts/index-micro-benchmark-results.sh @@ -1,13 +1,9 @@ #!/bin/bash -METRICS_HOST=$(vault read -field=es_host /secret/performance/employees/cloud/esbench-metrics) -METRICS_INDEX_NAME="dummy-micro-benchmarks" -METRICS_USERNAME=$(vault read -field=es_username /secret/performance/employees/cloud/esbench-metrics) -METRICS_PASSWORD=$(vault read -field=es_password /secret/performance/employees/cloud/esbench-metrics) - jq -c '.[]' "benchmarks/build/result.json" | while read -r doc; do - curl -s -X POST "https://$METRICS_HOST/$METRICS_INDEX_NAME/_doc" \ - -u "$METRICS_USERNAME:$METRICS_PASSWORD" \ + echo "Indexing $(echo "$doc" | jq -r '.benchmark')" + curl -s -X POST "https://$PERF_METRICS_HOST/$PERF_METRICS_INDEX/_doc" \ + -u "$PERF_METRICS_USERNAME:$PERF_METRICS_PASSWORD" \ -H 'Content-Type: application/json' \ -d "$doc" done From 4fb16395e2a6b3f0fec66b8e5d96d74068dc2199 Mon Sep 17 00:00:00 2001 From: "ievgen.degtiarenko" Date: Mon, 2 Jun 2025 09:37:20 +0200 Subject: [PATCH 4/8] use credentials --- .buildkite/hooks/pre-command | 6 +++--- .buildkite/pipelines/periodic-micro-benchmarks.yml | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index 805a6f25f8501..dbd5b77562106 100644 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -100,10 +100,10 @@ if [[ "${USE_PERF_CREDENTIALS:-}" == "true" ]]; then PERF_METRICS_USERNAME=$(vault read -field=es_username /secret/ci/elastic-elasticsearch/esbench-metics) PERF_METRICS_PASSWORD=$(vault read -field=es_password /secret/ci/elastic-elasticsearch/esbench-metics) - export METRICS_HOST + export PERF_METRICS_HOST export PERF_METRICS_INDEX - export METRICS_USERNAME - export METRICS_PASSWORD + export PERF_METRICS_USERNAME + export PERF_METRICS_PASSWORD fi # Authenticate to the Docker Hub public read-only registry diff --git a/.buildkite/pipelines/periodic-micro-benchmarks.yml b/.buildkite/pipelines/periodic-micro-benchmarks.yml index be1d2dc37477c..5cc59a1c77521 100644 --- a/.buildkite/pipelines/periodic-micro-benchmarks.yml +++ b/.buildkite/pipelines/periodic-micro-benchmarks.yml @@ -3,6 +3,8 @@ steps: command: | .ci/scripts/run-gradle.sh :benchmarks:run --args 'org.elasticsearch.benchmark._nightly -rf json -rff build/result.json' .ci/scripts/index-micro-benchmark-results.sh + env: + USE_PERF_CREDENTIALS: "true" timeout_in_minutes: 300 agents: provider: gcp From 41941bcc37b1f7a257f9f4550f2abd3edea217cc Mon Sep 17 00:00:00 2001 From: "ievgen.degtiarenko" Date: Mon, 2 Jun 2025 10:06:27 +0200 Subject: [PATCH 5/8] fix script location --- .buildkite/pipelines/periodic-micro-benchmarks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/pipelines/periodic-micro-benchmarks.yml b/.buildkite/pipelines/periodic-micro-benchmarks.yml index 5cc59a1c77521..56748d3a0911d 100644 --- a/.buildkite/pipelines/periodic-micro-benchmarks.yml +++ b/.buildkite/pipelines/periodic-micro-benchmarks.yml @@ -2,7 +2,7 @@ steps: - label: periodic-micro-benchmarks command: | .ci/scripts/run-gradle.sh :benchmarks:run --args 'org.elasticsearch.benchmark._nightly -rf json -rff build/result.json' - .ci/scripts/index-micro-benchmark-results.sh + .buildkite/scripts/index-micro-benchmark-results.sh env: USE_PERF_CREDENTIALS: "true" timeout_in_minutes: 300 From 0697c91eb8814615fcad427466939aa5b73fe6dc Mon Sep 17 00:00:00 2001 From: "ievgen.degtiarenko" Date: Mon, 2 Jun 2025 13:47:00 +0200 Subject: [PATCH 6/8] append timestamp field --- .buildkite/scripts/index-micro-benchmark-results.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.buildkite/scripts/index-micro-benchmark-results.sh b/.buildkite/scripts/index-micro-benchmark-results.sh index 98dea481f31fb..d9026c1dde9c2 100755 --- a/.buildkite/scripts/index-micro-benchmark-results.sh +++ b/.buildkite/scripts/index-micro-benchmark-results.sh @@ -2,6 +2,7 @@ jq -c '.[]' "benchmarks/build/result.json" | while read -r doc; do echo "Indexing $(echo "$doc" | jq -r '.benchmark')" + doc = $doc | jq --arg timestamp "$(date +%s000)" '. + {"@timestamp": $timestamp}' curl -s -X POST "https://$PERF_METRICS_HOST/$PERF_METRICS_INDEX/_doc" \ -u "$PERF_METRICS_USERNAME:$PERF_METRICS_PASSWORD" \ -H 'Content-Type: application/json' \ From 3d3e67b907f145467323a865e4125d3d09a7b3e1 Mon Sep 17 00:00:00 2001 From: "ievgen.degtiarenko" Date: Mon, 2 Jun 2025 14:11:05 +0200 Subject: [PATCH 7/8] fix field appending --- .buildkite/scripts/index-micro-benchmark-results.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/scripts/index-micro-benchmark-results.sh b/.buildkite/scripts/index-micro-benchmark-results.sh index d9026c1dde9c2..a47ede7577632 100755 --- a/.buildkite/scripts/index-micro-benchmark-results.sh +++ b/.buildkite/scripts/index-micro-benchmark-results.sh @@ -1,8 +1,8 @@ #!/bin/bash jq -c '.[]' "benchmarks/build/result.json" | while read -r doc; do + doc=$(echo "$doc" | jq --arg timestamp "$(date +%s000)" '. + {"@timestamp": $timestamp}') echo "Indexing $(echo "$doc" | jq -r '.benchmark')" - doc = $doc | jq --arg timestamp "$(date +%s000)" '. + {"@timestamp": $timestamp}' curl -s -X POST "https://$PERF_METRICS_HOST/$PERF_METRICS_INDEX/_doc" \ -u "$PERF_METRICS_USERNAME:$PERF_METRICS_PASSWORD" \ -H 'Content-Type: application/json' \ From a3e652375519b40f3309ed1b7345542246fd4dad Mon Sep 17 00:00:00 2001 From: "ievgen.degtiarenko" Date: Mon, 2 Jun 2025 14:46:08 +0200 Subject: [PATCH 8/8] remove timestamp quotes --- .buildkite/scripts/index-micro-benchmark-results.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/scripts/index-micro-benchmark-results.sh b/.buildkite/scripts/index-micro-benchmark-results.sh index a47ede7577632..b7ffd82c529f1 100755 --- a/.buildkite/scripts/index-micro-benchmark-results.sh +++ b/.buildkite/scripts/index-micro-benchmark-results.sh @@ -1,7 +1,7 @@ #!/bin/bash jq -c '.[]' "benchmarks/build/result.json" | while read -r doc; do - doc=$(echo "$doc" | jq --arg timestamp "$(date +%s000)" '. + {"@timestamp": $timestamp}') + doc=$(echo "$doc" | jq --argjson timestamp "$(date +%s000)" '. + {"@timestamp": $timestamp}') echo "Indexing $(echo "$doc" | jq -r '.benchmark')" curl -s -X POST "https://$PERF_METRICS_HOST/$PERF_METRICS_INDEX/_doc" \ -u "$PERF_METRICS_USERNAME:$PERF_METRICS_PASSWORD" \