Skip to content

Commit bec4d36

Browse files
idegtiarenkojoshua-adams-1
authored andcommitted
Script for indexing micro benchmark results (elastic#128557)
1 parent 997c1fd commit bec4d36

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

.buildkite/hooks/pre-command

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,18 @@ if [[ "${USE_PROD_DOCKER_CREDENTIALS:-}" == "true" ]]; then
9494
fi
9595
fi
9696

97+
if [[ "${USE_PERF_CREDENTIALS:-}" == "true" ]]; then
98+
PERF_METRICS_HOST=$(vault read -field=es_host /secret/ci/elastic-elasticsearch/esbench-metics)
99+
PERF_METRICS_INDEX="dummy-micro-benchmarks"
100+
PERF_METRICS_USERNAME=$(vault read -field=es_username /secret/ci/elastic-elasticsearch/esbench-metics)
101+
PERF_METRICS_PASSWORD=$(vault read -field=es_password /secret/ci/elastic-elasticsearch/esbench-metics)
102+
103+
export PERF_METRICS_HOST
104+
export PERF_METRICS_INDEX
105+
export PERF_METRICS_USERNAME
106+
export PERF_METRICS_PASSWORD
107+
fi
108+
97109
# Authenticate to the Docker Hub public read-only registry
98110
if which docker > /dev/null 2>&1; then
99111
DOCKERHUB_REGISTRY_USERNAME="$(vault read -field=username secret/ci/elastic-elasticsearch/docker_hub_public_ro_credentials)"

.buildkite/pipelines/periodic-micro-benchmarks.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ steps:
22
- label: periodic-micro-benchmarks
33
command: |
44
.ci/scripts/run-gradle.sh :benchmarks:run --args 'org.elasticsearch.benchmark._nightly -rf json -rff build/result.json'
5+
.buildkite/scripts/index-micro-benchmark-results.sh
6+
env:
7+
USE_PERF_CREDENTIALS: "true"
58
timeout_in_minutes: 300
69
agents:
710
provider: gcp
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
jq -c '.[]' "benchmarks/build/result.json" | while read -r doc; do
4+
doc=$(echo "$doc" | jq --argjson timestamp "$(date +%s000)" '. + {"@timestamp": $timestamp}')
5+
echo "Indexing $(echo "$doc" | jq -r '.benchmark')"
6+
curl -s -X POST "https://$PERF_METRICS_HOST/$PERF_METRICS_INDEX/_doc" \
7+
-u "$PERF_METRICS_USERNAME:$PERF_METRICS_PASSWORD" \
8+
-H 'Content-Type: application/json' \
9+
-d "$doc"
10+
done

0 commit comments

Comments
 (0)