-
Notifications
You must be signed in to change notification settings - Fork 0
386 lines (325 loc) · 13.5 KB
/
benchmarks.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
name: Benchmarks
on:
push:
branches:
- main
merge_group:
pull_request:
branches:
- main
schedule:
- cron: '0 4 * * *'
permissions:
contents: read
# We don't want to cancel any redundant runs on main so we use run_id when head_ref is
# not available
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
# Special orphan git branch which is used to store benchmark results
BENCHMARK_RESULTS_BRANCH_NAME: "benchmark-results-dont-push-manually"
jobs:
benchmarks_local_dummy_server:
name: Benchmarks - Local Dummy Server
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'
token: ${{ github.token }}
- name: Build Docker Images
uses: ./.github/actions/build-docker-images/
- name: Prepare Test Environment
run: |
# Store value so we can reference it in other steps
export TEST_RUN_SERVERHOST="otel-cicd-benchmarks-e2e-local-dummy-server-mock-loglines-${GITHUB_SHA}-${GITHUB_RUN_ID}"
echo "TEST_RUN_SERVERHOST=${TEST_RUN_SERVERHOST}" >> ${GITHUB_ENV}
- name: Install required tools
run: |
sudo apt-get update
sudo apt-get install -y jq
npm install [email protected]
- name: Run Benchmark
working-directory: ./scripts/e2e
run: |
sudo usermod -aG docker $USER
./test.sh --check-limit 300
- name: Print Results
id: benchmark-result-json
run: |
result_multiline=$(cat scripts/e2e/benchmark.log | tail -1 | jq -C)
result_online=$(cat scripts/e2e/benchmark.log | tail -1 | jq -c)
echo -e "${result_multiline}"
echo "json=[$result_online]" >> "$GITHUB_OUTPUT"
- name: Store Results as Artifact
# We also store artifacts on failure to make troubleshooting easier
if: ${{ success() || failure() }}
uses: actions/upload-artifact@v4
with:
name: benchmark-results-local-dummy-server
path: |
scripts/e2e/benchmark.log
scripts/e2e/collector-logs.log
scripts/e2e/stats-col-*.json
scripts/e2e/log.log
scripts/e2e/log.log.used*
- name: Convert Result to Markdown Table
uses: buildingcash/json-to-markdown-table-action@b442169239ef35f1dc4e5c8c3d47686c081a7e65 # v1.1.0
id: md-table
with:
json: ${{ steps.benchmark-result-json.outputs.json }}
- name: Print Table and Add Job Summary
run: |
result=$(echo "${{ steps.md-table.outputs.table }}" | awk '{$1=$1;print}' | node scripts/ci/invert_markdown_table.js)
echo "# Benchmark Results" > results.md
echo "Those benchmarks utilize local dummy addEvents server and mock pre-generated log lines" >> results.md
echo "Meaning of the columns is in the 'scripts/e2e/README.md'." >> results.md
echo "${result}" >> results.md
echo "" >> results.md
cat results.md >> "$GITHUB_STEP_SUMMARY"
- name: Notify Slack on Failure
if: ${{ failure() && github.ref_name == 'master' }}
uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#eng-dataset-o11y'
- name: Stop containers
if: always()
working-directory: ./scripts/e2e
run: |
docker compose down
benchmarks_local_dummy_server_commit_results:
name: Commit Results To a Branch
runs-on: ubuntu-latest
needs:
- benchmarks_local_dummy_server
# We only want to run this job for push / merge to master and not also for cron runs
if: ${{ github.event_name != 'schedule' && github.ref_name == 'main' }}
timeout-minutes: 5
permissions:
actions: write # Needed for skip-duplicate-jobs job
contents: write # Needed so we can push benchmark results
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: "${{ env.BENCHMARK_RESULTS_BRANCH_NAME }}"
token: ${{ github.token }}
# There is a known race / bug so sometimes this step will fail, see
# https://github.com/actions/download-artifact/issues/140#issuecomment-1314062872 for details
- name: Download result artifacts
uses: actions/download-artifact@v4
with:
name: benchmark-results-local-dummy-server
path: /tmp/
- name: Commit Results to Branch
run: |
git config --global user.email "[email protected]"
git config --global user.name "GHA CI/CD automation"
# Print it for troubleshooting, etc.
cat /tmp/benchmark.log
# File may contain multiple old results and we only want the last (more recent) one
cat /tmp/benchmark.log | tail -1 >> benchmark-results.json
# Sanity check to ensure the file indeed contains current / todays results
cat benchmark-results.json | grep "$(date +%Y-%m-%d)"
git add benchmark-results.json
git commit -m "Add latest benchmark results on $(date +%Y-%m-%d)"
git push origin "${{ env.BENCHMARK_RESULTS_BRANCH_NAME }}"
- name: Notify Slack on Failure
if: ${{ failure() && github.ref_name == 'master' }}
uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#eng-dataset-o11y'
benchmarks_dataset_prod_server_mock_loglines:
name: Benchmarks - DataSet Prod US - mock log lines
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'
token: ${{ github.token }}
- name: Checkout Agent Repository
uses: actions/checkout@v4
with:
repository: "scalyr/scalyr-agent-2"
path: "scalyr-agent-2"
- name: Setup Python
uses: actions/setup-python@v5
id: setup-python
with:
python-version: 3.11
- name: Install Scalyr Tool
run: |
curl https://raw.githubusercontent.com/scalyr/scalyr-tool/master/scalyr > scalyr
chmod +x scalyr
sudo mv scalyr /usr/local/bin
- name: Build Docker Images
uses: ./.github/actions/build-docker-images/
- name: Prepare Test Environment
run: |
# Store value so we can reference it in other steps
export TEST_RUN_SERVERHOST="otel-cicd-benchmarks-e2e-prod-us-mock-loglines-${GITHUB_SHA}-${GITHUB_RUN_ID}"
export SCALYR_QUERY_SCRIPT_PATH="./scalyr-agent-2/scripts/cicd/scalyr-query.sh"
echo "TEST_RUN_SERVERHOST=${TEST_RUN_SERVERHOST}" >> ${GITHUB_ENV}
echo "SCALYR_QUERY_SCRIPT_PATH=${SCALYR_QUERY_SCRIPT_PATH}" >> ${GITHUB_ENV}
- name: Install required tools
run: |
sudo apt-get update
sudo apt-get install -y jq
npm install [email protected]
- name: Run Benchmark
working-directory: ./scripts/e2e
env:
DATASET_URL: "https://app.scalyr.com"
DATASET_API_KEY: "${{ secrets.DATASET_PRODUS_CLOUDTECH_TESTING_WRITELOGS_TOKEN }}"
run: |
sudo usermod -aG docker $USER
./test.sh --check-limit 100
- name: Verify Data Has Been Ingested
env:
# Needed for scalyr-tool
scalyr_server: "https://app.scalyr.com"
scalyr_readlog_token: "${{ secrets.DATASET_PRODUS_CLOUDTECH_TESTING_READLOGS_TOKEN }}"
run: |
# TODO: Add more advanced checks and verify all data has been ingested and ingested
# correctly. For that we will also need to update data so each message includes unique
# incremental counter.
${SCALYR_QUERY_SCRIPT_PATH} \
'serverHost="'${TEST_RUN_SERVERHOST}'"' \
'message contains "AAAAAAAAAAAAAAA"'
- name: Print Results
id: benchmark-result-json
run: |
result_multiline=$(cat scripts/e2e/benchmark.log | tail -1 | jq -C)
result_online=$(cat scripts/e2e/benchmark.log | tail -1 | jq -c)
echo -e "${result_multiline}"
echo "json=[$result_online]" >> "$GITHUB_OUTPUT"
- name: Store Results as Artifact
uses: actions/upload-artifact@v4
with:
name: benchmark-results-dataset-prod-us
path: |
scripts/e2e/benchmark.log
scripts/e2e/collector-logs.log
scripts/e2e/stats-col-*.json
- name: Convert Result to Markdown Table
uses: buildingcash/json-to-markdown-table-action@b442169239ef35f1dc4e5c8c3d47686c081a7e65 # v1.1.0
id: md-table
with:
json: ${{ steps.benchmark-result-json.outputs.json }}
- name: Print Table and Add Job Summary
run: |
result=$(echo "${{ steps.md-table.outputs.table }}" | awk '{$1=$1;print}' | node scripts/ci/invert_markdown_table.js)
echo "# Benchmark Results" > results.md
echo "Those benchmarks utilize DataSet Prod US and mock pre-generated log lines" >> results.md
echo "Meaning of the columns is in the 'scripts/e2e/README.md'." >> results.md
echo "${result}" >> results.md
echo "" >> results.md
cat results.md >> "$GITHUB_STEP_SUMMARY"
- name: Notify Slack on Failure
if: ${{ failure() && github.ref_name == 'master' }}
uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#eng-dataset-o11y'
- name: Stop containers
if: always()
working-directory: ./scripts/e2e
run: |
docker compose down
benchmarks_dataset_prod_server_telemetrygen:
name: Benchmarks - DataSet Prod US - telemetrygen
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: 'true'
token: ${{ github.token }}
# Needed so we can build telemetrygen locally - sadly it's currently not available for arm so
# we need to use this workaround
- name: Checkout OTel Contrib Repository
uses: actions/checkout@v4
with:
repository: "open-telemetry/opentelemetry-collector-contrib"
path: "opentelemetry-collector-contrib"
- name: Checkout Agent Repository
uses: actions/checkout@v4
with:
repository: "scalyr/scalyr-agent-2"
path: "scalyr-agent-2"
- name: Setup Python
uses: actions/setup-python@v5
id: setup-python
with:
python-version: 3.11
- name: Install Scalyr Tool
run: |
curl https://raw.githubusercontent.com/scalyr/scalyr-tool/master/scalyr > scalyr
chmod +x scalyr
sudo mv scalyr /usr/local/bin
- name: Prepare Docker buildx
uses: docker/setup-buildx-action@v3
# TODO(Tomaz): Set up image / layer caching to speed up the build
- name: Build Telemetrygen Docker Image
working-directory: ./opentelemetry-collector-contrib
run: |
make docker-telemetrygen
- name: Build Other Docker Images
uses: ./.github/actions/build-docker-images/
- name: Prepare Test Environment
run: |
# Store value so we can reference it in other steps
export TEST_RUN_SERVERHOST="otel-cicd-benchmarks-e2e-telemetrygen-${GITHUB_SHA}-${GITHUB_RUN_ID}"
export SCALYR_QUERY_SCRIPT_PATH="./scalyr-agent-2/scripts/cicd/scalyr-query.sh"
echo "TEST_RUN_SERVERHOST=${TEST_RUN_SERVERHOST}" >> ${GITHUB_ENV}
echo "SCALYR_QUERY_SCRIPT_PATH=${SCALYR_QUERY_SCRIPT_PATH}" >> ${GITHUB_ENV}
- name: Run Benchmarks
working-directory: ./scripts/benchmarking
env:
DATASET_URL: "https://app.scalyr.com"
DATASET_API_KEY: "${{ secrets.DATASET_PRODUS_CLOUDTECH_TESTING_WRITELOGS_TOKEN }}"
run: |
./test.sh
- name: Verify Data Has Been Ingested
env:
# Needed for scalyr-tool
scalyr_server: "https://app.scalyr.com"
scalyr_readlog_token: "${{ secrets.DATASET_PRODUS_CLOUDTECH_TESTING_READLOGS_TOKEN }}"
run: |
# TODO: Add more advanced checks and verify all data has been ingested and ingested
# correctly. For that we will also need to update data so each message includes unique
# incremental counter.
${SCALYR_QUERY_SCRIPT_PATH} \
'resource.attributes.serverHost="'${TEST_RUN_SERVERHOST}'"' \
'resource.attributes.key="A"'
- name: Notify Slack on Failure
if: ${{ failure() && github.ref_name == 'main' }}
uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#eng-dataset-o11y'
- name: Stop containers
if: always()
working-directory: ./scripts/benchmarking
run: |
docker compose down