Skip to content

Commit 564bb28

Browse files
feat: update slo
1 parent eebd1cf commit 564bb28

File tree

7 files changed

+147
-168
lines changed

7 files changed

+147
-168
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+
ydb-slo-action-report:
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+
token: ${{ secrets.GITHUB_TOKEN }}
22+
run_id: ${{ github.event.workflow_run.id }}

.github/workflows/slo.yml

Lines changed: 61 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,80 @@
11
on:
22
push:
3-
branches: [main]
3+
branches:
4+
- main
45
pull_request:
5-
branches: [main]
6+
branches:
7+
- main
68
workflow_dispatch:
9+
inputs:
10+
github_pull_request_number:
11+
required: true
12+
slo_workload_duration_seconds:
13+
default: '600'
14+
required: false
15+
slo_workload_read_max_rps:
16+
default: '1000'
17+
required: false
18+
slo_workload_write_max_rps:
19+
default: '1000'
20+
required: false
721

8-
name: SLO
22+
name: slo
923

1024
jobs:
11-
test-slo:
12-
concurrency:
13-
group: slo-${{ github.ref }}
25+
ydb-slo-action:
1426
if: (!contains(github.event.pull_request.labels.*.name, 'no slo'))
1527

16-
runs-on: ubuntu-latest
1728
name: SLO test
18-
permissions:
19-
checks: write
20-
pull-requests: write
21-
contents: read
22-
issues: write
29+
runs-on: ubuntu-latest
30+
strategy:
31+
matrix:
32+
sdk:
33+
- TableService
34+
- AdoNet
2335

2436
steps:
2537
- name: Checkout repository
2638
uses: actions/checkout@v4
27-
if: env.DOCKER_REPO != null
28-
env:
29-
DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }}
3039

31-
- name: Run SLO
32-
uses: ydb-platform/slo-tests@main
33-
if: env.DOCKER_REPO != null
34-
env:
35-
DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }}
36-
continue-on-error: true
40+
- name: Install .NET
41+
uses: actions/setup-dotnet@v4
42+
with:
43+
dotnet-version: 8.0.x
44+
45+
- name: Initialize YDB SLO
46+
uses: ydb-platform/ydb-slo-action/init@main
3747
with:
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39-
KUBECONFIG_B64: ${{ secrets.SLO_KUBE_CONFIG }}
40-
AWS_CREDENTIALS_B64: ${{ secrets.SLO_AWS_CREDENTIALS }}
41-
AWS_CONFIG_B64: ${{ secrets.SLO_AWS_CONFIG }}
42-
DOCKER_USERNAME: ${{ secrets.SLO_DOCKER_USERNAME }}
43-
DOCKER_PASSWORD: ${{ secrets.SLO_DOCKER_PASSWORD }}
44-
DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }}
45-
DOCKER_FOLDER: ${{ secrets.SLO_DOCKER_FOLDER }}
46-
s3_endpoint: ${{ secrets.SLO_S3_ENDPOINT }}
47-
s3_images_folder: ${{ vars.SLO_S3_IMAGES_FOLDER }}
48-
grafana_domain: ${{ vars.SLO_GRAFANA_DOMAIN }}
49-
# grafana_dashboard: ${{ vars.SLO_GRAFANA_DASHBOARD }}
50-
grafana_dashboard: dca60386-0d3d-43f5-a2af-5f3fd3e3b295
51-
grafana_dashboard_width: 2000
52-
grafana_dashboard_height: 2300
53-
ydb_version: 'newest'
54-
timeBetweenPhases: 30
55-
shutdownTime: 30
48+
github_pull_request_number: ${{ github.event.inputs.github_pull_request_number }}
49+
github_token: ${{ secrets.GITHUB_TOKEN }}
50+
sdk_name: ${{ matrix.sdk }}
51+
ydb_database_node_count: 5
52+
53+
- name: Prepare SLO Database
54+
run: |
55+
cd slo/src/${{ matrix.sdk }}
56+
dotnet run create grpc://localhost:2135 /Root/testdb
57+
58+
- name: Run SLO Tests
59+
run: |
60+
cd slo/src/${{ matrix.sdk }}
61+
dotnet run run grpc://localhost:2135 /Root/testdb \
62+
--prom-pgw localhost:9091 \
63+
--report-period 250 \
64+
--time ${{inputs.slo_workload_duration_seconds || 600 }} \
65+
--read-rps ${{inputs.slo_workload_read_max_rps || 1000 }} \
66+
--write-rps ${{inputs.slo_workload_write_max_rps || 1000 }} \
67+
--read-timeout 1000 \
68+
--write-timeout 1000
5669
57-
language_id0: 'table-service'
58-
workload_path0: 'slo/src'
59-
language0: '.NET SDK over table-service'
60-
workload_build_context0: ../..
61-
workload_build_options0: -f Dockerfile --build-arg SRC_PATH=TableService
62-
63-
language_id1: 'ado-net'
64-
workload_path1: 'slo/src'
65-
language1: 'ADO.NET over query-service'
66-
workload_build_context1: ../..
67-
workload_build_options1: -f Dockerfile --build-arg SRC_PATH=AdoNet
70+
- if: always()
71+
name: Store ydb chaos testing logs
72+
run: |
73+
docker logs ydb-chaos > chaos-ydb.log
6874
69-
- uses: actions/upload-artifact@v3
70-
if: always() && env.DOCKER_REPO != null
71-
env:
72-
DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }}
75+
- if: always()
76+
uses: actions/upload-artifact@v4
7377
with:
74-
name: slo-logs
75-
path: logs/
78+
name: ${{ matrix.workload }}-chaos-ydb.log
79+
path: ./chaos-ydb.log
80+
retention-days: 1

slo/src/Dockerfile

Lines changed: 0 additions & 15 deletions
This file was deleted.

slo/src/Internal/Cli.cs

Lines changed: 29 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,19 @@ public static class Cli
1212
"db",
1313
"YDB database to connect to");
1414

15-
private static readonly Option<string> TableOption = new(
15+
private static readonly Option<string> PromPgwOption = new(
16+
"--prom-pgw",
17+
"minimum amount of partitions in table") { IsRequired = true };
18+
19+
private static readonly Option<string> ResourceYdbPath = new(
1620
new[] { "-t", "--table-name" },
1721
() => "testingTable",
1822
"table name to create\n ");
1923

2024
private static readonly Option<int> WriteTimeoutOption = new(
2125
"--write-timeout",
22-
() => 100,
23-
"write timeout seconds");
24-
25-
private static readonly Option<int> MinPartitionsCountOption = new(
26-
"--min-partitions-count",
27-
() => 6,
28-
"minimum amount of partitions in table");
29-
30-
private static readonly Option<int> MaxPartitionsCountOption = new(
31-
"--max-partitions-count",
3226
() => 1000,
33-
"maximum amount of partitions in table");
34-
35-
private static readonly Option<int> PartitionSizeOption = new(
36-
"--partition-size",
37-
() => 1,
38-
"partition size in mb");
39-
40-
private static readonly Option<int> InitialDataCountOption = new(
41-
new[] { "-c", "--initial-data-count" },
42-
() => 1000,
43-
"amount of initially created rows");
44-
45-
private static readonly Option<string> PromPgwOption = new(
46-
"--prom-pgw",
47-
"minimum amount of partitions in table") { IsRequired = true };
27+
"write timeout seconds");
4828

4929
private static readonly Option<int> ReportPeriodOption = new(
5030
"--report-period",
@@ -58,34 +38,43 @@ public static class Cli
5838

5939
private static readonly Option<int> ReadTimeoutOption = new(
6040
"--read-timeout",
61-
() => 100,
41+
() => 1000,
6242
"read timeout seconds");
6343

6444
private static readonly Option<int> WriteRpsOption = new(
6545
"--write-rps",
66-
() => 100,
46+
() => 1000,
6747
"write RPS");
6848

6949
private static readonly Option<int> TimeOption = new(
7050
"--time",
71-
() => 140,
51+
() => 600,
7252
"run time in seconds");
7353

74-
private static readonly Option<int> ShutdownTimeOption = new(
75-
"--shutdown-time",
76-
() => 30,
77-
"time to wait before force kill workers");
54+
private static readonly Option<int> MinPartitionsCountOption = new(
55+
"--min-partitions-count",
56+
() => 5,
57+
"minimum amount of partitions in table");
58+
59+
private static readonly Option<int> MaxPartitionsCountOption = new(
60+
"--max-partitions-count",
61+
() => 10,
62+
"maximum amount of partitions in table");
63+
64+
private static readonly Option<int> InitialDataCountOption = new(
65+
new[] { "-c", "--initial-data-count" },
66+
() => 1000,
67+
"amount of initially created rows");
7868

7969
private static readonly Command CreateCommand = new(
8070
"create",
8171
"creates table in database")
8272
{
8373
EndpointArgument,
8474
DbArgument,
85-
TableOption,
75+
ResourceYdbPath,
8676
MinPartitionsCountOption,
8777
MaxPartitionsCountOption,
88-
PartitionSizeOption,
8978
InitialDataCountOption,
9079
WriteTimeoutOption
9180
};
@@ -96,16 +85,14 @@ public static class Cli
9685
{
9786
EndpointArgument,
9887
DbArgument,
99-
TableOption,
10088
InitialDataCountOption,
10189
PromPgwOption,
10290
ReportPeriodOption,
10391
ReadRpsOption,
10492
ReadTimeoutOption,
10593
WriteRpsOption,
10694
WriteTimeoutOption,
107-
TimeOption,
108-
ShutdownTimeOption
95+
TimeOption
10996
};
11097

11198
private static readonly RootCommand RootCommand = new("SLO app")
@@ -116,12 +103,12 @@ public static class Cli
116103
public static async Task<int> Run<T>(SloContext<T> sloContext, string[] args) where T : IDisposable
117104
{
118105
CreateCommand.SetHandler(async createConfig => { await sloContext.Create(createConfig); },
119-
new CreateConfigBinder(EndpointArgument, DbArgument, TableOption, MinPartitionsCountOption,
120-
MaxPartitionsCountOption, PartitionSizeOption, InitialDataCountOption, WriteTimeoutOption));
106+
new CreateConfigBinder(EndpointArgument, DbArgument, ResourceYdbPath, MinPartitionsCountOption,
107+
MaxPartitionsCountOption, InitialDataCountOption, WriteTimeoutOption));
121108

122109
RunCommand.SetHandler(async runConfig => { await sloContext.Run(runConfig); },
123-
new RunConfigBinder(EndpointArgument, DbArgument, TableOption, PromPgwOption, ReportPeriodOption,
124-
ReadRpsOption, ReadTimeoutOption, WriteRpsOption, WriteTimeoutOption, TimeOption, ShutdownTimeOption));
110+
new RunConfigBinder(EndpointArgument, DbArgument, ResourceYdbPath, PromPgwOption, ReportPeriodOption,
111+
ReadRpsOption, ReadTimeoutOption, WriteRpsOption, WriteTimeoutOption, TimeOption));
125112

126113
return await RootCommand.InvokeAsync(args);
127114
}

slo/src/Internal/ConfigBinders.cs

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ namespace Internal;
66
public class CreateConfigBinder(
77
Argument<string> endpointArgument,
88
Argument<string> dbArgument,
9-
Option<string> tableOption,
9+
Option<string> resourceYdbPath,
1010
Option<int> minPartitionsCountOption,
1111
Option<int> maxPartitionsCountOption,
12-
Option<int> partitionSizeOption,
1312
Option<int> initialDataCountOption,
1413
Option<int> writeTimeoutOption)
1514
: BinderBase<CreateConfig>
@@ -19,62 +18,41 @@ protected override CreateConfig GetBoundValue(BindingContext bindingContext)
1918
return new CreateConfig(
2019
bindingContext.ParseResult.GetValueForArgument(endpointArgument),
2120
bindingContext.ParseResult.GetValueForArgument(dbArgument),
22-
bindingContext.ParseResult.GetValueForOption(tableOption)!,
21+
bindingContext.ParseResult.GetValueForOption(resourceYdbPath)!,
2322
bindingContext.ParseResult.GetValueForOption(minPartitionsCountOption),
2423
bindingContext.ParseResult.GetValueForOption(maxPartitionsCountOption),
25-
bindingContext.ParseResult.GetValueForOption(partitionSizeOption),
2624
bindingContext.ParseResult.GetValueForOption(initialDataCountOption),
2725
bindingContext.ParseResult.GetValueForOption(writeTimeoutOption)
2826
);
2927
}
3028
}
3129

32-
internal class CleanUpConfigBinder(
33-
Argument<string> endpointArgument,
34-
Argument<string> dbArgument,
35-
Option<string> tableOption,
36-
Option<int> writeTimeoutOption)
37-
: BinderBase<CleanUpConfig>
38-
{
39-
protected override CleanUpConfig GetBoundValue(BindingContext bindingContext)
40-
{
41-
return new CleanUpConfig(
42-
bindingContext.ParseResult.GetValueForArgument(endpointArgument),
43-
bindingContext.ParseResult.GetValueForArgument(dbArgument),
44-
bindingContext.ParseResult.GetValueForOption(tableOption)!,
45-
bindingContext.ParseResult.GetValueForOption(writeTimeoutOption)
46-
);
47-
}
48-
}
49-
5030
internal class RunConfigBinder(
5131
Argument<string> endpointArgument,
5232
Argument<string> dbArgument,
53-
Option<string> tableOption,
33+
Option<string> resourceYdbPath,
5434
Option<string> promPgwOption,
5535
Option<int> reportPeriodOption,
5636
Option<int> readRpsOption,
5737
Option<int> readTimeoutOption,
5838
Option<int> writeRpsOption,
5939
Option<int> writeTimeoutOption,
60-
Option<int> timeOption,
61-
Option<int> shutdownTimeOption)
40+
Option<int> timeOption)
6241
: BinderBase<RunConfig>
6342
{
6443
protected override RunConfig GetBoundValue(BindingContext bindingContext)
6544
{
6645
return new RunConfig(
6746
bindingContext.ParseResult.GetValueForArgument(endpointArgument),
6847
bindingContext.ParseResult.GetValueForArgument(dbArgument),
69-
bindingContext.ParseResult.GetValueForOption(tableOption)!,
48+
bindingContext.ParseResult.GetValueForOption(resourceYdbPath)!,
7049
bindingContext.ParseResult.GetValueForOption(promPgwOption)!,
7150
bindingContext.ParseResult.GetValueForOption(reportPeriodOption),
7251
bindingContext.ParseResult.GetValueForOption(readRpsOption),
7352
bindingContext.ParseResult.GetValueForOption(readTimeoutOption),
7453
bindingContext.ParseResult.GetValueForOption(writeRpsOption),
7554
bindingContext.ParseResult.GetValueForOption(writeTimeoutOption),
76-
bindingContext.ParseResult.GetValueForOption(timeOption),
77-
bindingContext.ParseResult.GetValueForOption(shutdownTimeOption)
55+
bindingContext.ParseResult.GetValueForOption(timeOption)
7856
);
7957
}
8058
}

0 commit comments

Comments
 (0)