Skip to content

Commit 5ca5531

Browse files
committed
feat: add metrics collection for slo tests
1 parent bb6b7cb commit 5ca5531

File tree

12 files changed

+1253
-286
lines changed

12 files changed

+1253
-286
lines changed

.github/workflows/slo-report.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: slo-report
2+
3+
on:
4+
workflow_run:
5+
workflows: [ 'SLO' ]
6+
types:
7+
- completed
8+
9+
jobs:
10+
test-ydb-slo-action:
11+
runs-on: ubuntu-latest
12+
name: Publish YDB SLO Report
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
if: github.event.workflow_run.conclusion == 'success'
17+
steps:
18+
- name: Publish YDB SLO Report
19+
uses: ydb-platform/ydb-slo-action/report@main
20+
with:
21+
github_token: ${{ secrets.GITHUB_TOKEN }}
22+
github_run_id: ${{ github.event.workflow_run.id }}

.github/workflows/slo.yml

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: SLO tests
1+
name: SLO
22

33
on:
44
push:
@@ -31,30 +31,27 @@ env:
3131

3232
jobs:
3333
ydb-slo-action-init:
34-
# // https://github.com/ydb-platform/ydb-rs-sdk/issues/227
35-
if: ${{ false }}
3634
if: (!contains(github.event.pull_request.labels.*.name, 'no slo'))
3735

3836
name: Run YDB SLO Tests
3937
runs-on: ubuntu-latest
4038

4139
strategy:
4240
matrix:
43-
example:
44-
- native
41+
sdk:
42+
- name: native
43+
label: native
4544
rust_version:
4645
- "RUST_VERSION_OLD"
4746
- "RUST_VERSION_NEW"
4847

4948
concurrency:
50-
group: slo-${{ github.ref }}-${{ matrix.example }}-${{ matrix.rust_version }}
49+
group: slo-${{ github.ref }}-${{ matrix.sdk.name }}-${{ matrix.rust_version }}
5150
cancel-in-progress: true
5251

5352
steps:
54-
- name: Checkout
53+
- name: Checkout repository
5554
uses: actions/checkout@v4
56-
with:
57-
submodules: true
5855

5956
- name: Install rust
6057
uses: dtolnay/rust-toolchain@v1
@@ -73,33 +70,36 @@ jobs:
7370
- name: Rust cache
7471
uses: Swatinem/rust-cache@v2
7572

73+
- name: Prepare envs
74+
run: |
75+
REF=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
76+
REF_SAFE=${REF//\//__}
77+
echo "METRICS_REF=$REF_SAFE" >> $GITHUB_ENV
78+
echo "METRICS_LABEL=${{ matrix.sdk.label }}" >> $GITHUB_ENV
79+
echo "METRICS_JOB_NAME=${{ matrix.sdk.name }}" >> $GITHUB_ENV
80+
7681
- name: Initialize YDB SLO
7782
uses: ydb-platform/ydb-slo-action/init@main
7883
with:
7984
github_pull_request_number: ${{ github.event.inputs.github_pull_request_number }}
8085
github_token: ${{ secrets.GITHUB_TOKEN }}
81-
workload_name: ${{ matrix.example }}-${{ matrix.rust_version }}
86+
workload_name: ${{ matrix.sdk.name }}-${{ matrix.rust_version }}
8287
ydb_database_node_count: 5
8388

8489
- name: Prepare SLO Database
8590
run: |
86-
cargo run --example ${{ matrix.example }} grpc://localhost:2135 /Root/testdb tableName create
91+
cargo run --example ${{ matrix.sdk.name }} grpc://localhost:2135 /Root/testdb tableName create
8792
8893
- name: Run SLO Tests
89-
env:
90-
REF: '${{ github.head_ref || github.ref }}'
9194
run: |
92-
cargo run --example ${{ matrix.example }} grpc://localhost:2135 /Root/testdb tableName run \
95+
cargo run --example ${{ matrix.sdk.name }} grpc://localhost:2135 /Root/testdb tableName run \
96+
--prom-pgw localhost:9091 \
97+
--report-period 250 \
9398
--time ${{ inputs.slo_workload_duration_seconds || 600}} \
9499
--read-rps ${{ inputs.slo_workload_read_max_rps || 1000}} \
95100
--write-rps ${{ inputs.slo_workload_write_max_rps || 100}} \
96-
--read-timeout 10000 \
97-
--write-timeout 10000 || true
98-
99-
- if: always()
100-
name: Cleanup SLO Database
101-
run: |
102-
cargo run --example ${{ matrix.example }} grpc://localhost:2135 /Root/testdb tableName cleanup
101+
--read-timeout 1000 \
102+
--write-timeout 1000 || true
103103
104104
- if: always()
105105
name: Store ydb chaos testing logs
@@ -109,6 +109,11 @@ jobs:
109109
- if: always()
110110
uses: actions/upload-artifact@v4
111111
with:
112-
name: ${{ matrix.example}}-${{ matrix.rust_version }}-chaos-ydb.log
112+
name: ${{ matrix.sdk.name}}-${{ matrix.rust_version }}-chaos-ydb.log
113113
path: ./chaos-ydb.log
114-
retention-days: 1
114+
retention-days: 1
115+
116+
- if: always()
117+
name: Cleanup SLO Database
118+
run: |
119+
cargo run --example ${{ matrix.sdk.name }} grpc://localhost:2135 /Root/testdb tableName cleanup || true

0 commit comments

Comments
 (0)