From c544f3b3273a658c083ad5f89d9ac306bc219247 Mon Sep 17 00:00:00 2001 From: Vladislav Polyakov Date: Tue, 26 Nov 2024 00:32:39 +0300 Subject: [PATCH] refactor: rename sdk to workload in SLO workflows and metrics --- .github/workflows/slo-report.yml | 4 ++-- .github/workflows/slo.yml | 26 +++++++++++++------------- tests/slo/src/metrics.py | 8 +++++--- tests/slo/src/runner.py | 8 ++++---- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/.github/workflows/slo-report.yml b/.github/workflows/slo-report.yml index 816d190b..29dd5ec0 100644 --- a/.github/workflows/slo-report.yml +++ b/.github/workflows/slo-report.yml @@ -18,5 +18,5 @@ jobs: - name: Publish YDB SLO Report uses: ydb-platform/ydb-slo-action/report@main with: - token: ${{ secrets.GITHUB_TOKEN }} - run_id: ${{ github.event.workflow_run.id }} + github_token: ${{ secrets.GITHUB_TOKEN }} + github_run_id: ${{ github.event.workflow_run.id }} diff --git a/.github/workflows/slo.yml b/.github/workflows/slo.yml index a4b90864..9ea5abd4 100644 --- a/.github/workflows/slo.yml +++ b/.github/workflows/slo.yml @@ -30,12 +30,12 @@ jobs: strategy: matrix: - sdk: - - py-sync-table - - py-sync-query + workload: + - sync-table + - sync-query concurrency: - group: slo-${{ github.ref }}-${{ matrix.sdk }} + group: slo-${{ github.ref }}-${{ matrix.workload }} cancel-in-progress: true steps: @@ -59,7 +59,7 @@ jobs: with: github_pull_request_number: ${{ github.event.inputs.github_pull_request_number }} github_token: ${{ secrets.GITHUB_TOKEN }} - sdk_name: ${{ matrix.sdk }} + workload_name: ${{ matrix.workload }} ydb_database_node_count: 5 - name: Prepare SLO Database @@ -69,7 +69,7 @@ jobs: - name: Run SLO Tests env: REF: '${{ github.head_ref || github.ref }}' - SDK_SERVICE: '${{ matrix.sdk }}' + WORKLOAD: '${{ matrix.workload }}' run: | python ./tests/slo/src run grpc://localhost:2135 /Root/testdb \ --prom-pgw localhost:9091 \ @@ -78,7 +78,12 @@ jobs: --read-rps ${{inputs.slo_workload_read_max_rps || 1000}} \ --write-rps ${{inputs.slo_workload_write_max_rps || 100}} \ --read-timeout 1000 \ - --write-timeout 1000 || true + --write-timeout 1000 + + - if: always() + name: Cleanup SLO Database + run: | + python ./tests/slo/src cleanup grpc://localhost:2135 /Root/testdb - if: always() name: Store ydb chaos testing logs @@ -88,11 +93,6 @@ jobs: - if: always() uses: actions/upload-artifact@v4 with: - name: ${{ matrix.sdk }}-chaos-ydb.log + name: ${{ matrix.workload }}-chaos-ydb.log path: ./chaos-ydb.log retention-days: 1 - - - if: always() - name: Cleanup SLO Database - run: | - python ./tests/slo/src cleanup grpc://localhost:2135 /Root/testdb || true diff --git a/tests/slo/src/metrics.py b/tests/slo/src/metrics.py index e89dbbec..ccfff5be 100644 --- a/tests/slo/src/metrics.py +++ b/tests/slo/src/metrics.py @@ -13,7 +13,7 @@ OP_STATUS_SUCCESS, OP_STATUS_FAILURE = "success", "err" REF = environ.get("REF", "main") -SDK_SERVICE_NAME = environ.get("SDK_SERVICE", "py-sync-table") +WORKLOAD = environ.get("WORKLOAD", "sync-query") class Metrics: @@ -151,12 +151,14 @@ def stop(self, labels, start_time, attempts=1, error=None): def push(self): push_to_gateway( self._push_gtw, - job=f"workload-{SDK_SERVICE_NAME}", + job=f"workload-{WORKLOAD_NAME}", registry=self._registry, grouping_key={ "ref": REF, - "sdk": SDK_SERVICE_NAME, + "sdk": "ydb-python-sdk", "sdk_version": version("ydb"), + "workload": WORKLOAD_NAME, + "workload_version": "0.0.0", }, ) diff --git a/tests/slo/src/runner.py b/tests/slo/src/runner.py index 1472d49a..a636309e 100644 --- a/tests/slo/src/runner.py +++ b/tests/slo/src/runner.py @@ -14,7 +14,7 @@ run_write_jobs_query, run_metric_job, ) -from metrics import Metrics, SDK_SERVICE_NAME +from metrics import Metrics, WORKLOAD logger = logging.getLogger(__name__) @@ -91,20 +91,20 @@ def run_slo(args, driver, tb_name): logger.info("Max ID: %s", max_id) metrics = Metrics(args.prom_pgw) - if SDK_SERVICE_NAME == "py-sync-table": + if WORKLOAD == "sync-table": futures = ( *run_read_jobs(args, driver, tb_name, max_id, metrics), *run_write_jobs(args, driver, tb_name, max_id, metrics), run_metric_job(args, metrics), ) - elif SDK_SERVICE_NAME == "py-sync-query": + elif WORKLOAD == "sync-query": futures = ( *run_read_jobs_query(args, driver, tb_name, max_id, metrics), *run_write_jobs_query(args, driver, tb_name, max_id, metrics), run_metric_job(args, metrics), ) else: - raise ValueError(f"Unsupported service: {SDK_SERVICE_NAME}") + raise ValueError(f"Unsupported service: {WORKLOAD}") for future in futures: future.join()