Skip to content

Commit 51656f2

Browse files
first commit
1 parent b364e77 commit 51656f2

File tree

15 files changed

+300
-43
lines changed

15 files changed

+300
-43
lines changed

slo/playground/configs/compose.yaml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ x-runtime: &runtime
77
network_mode: host
88

99
x-ydb-node: &ydb-node
10-
image: cr.yandex/crptqonuodf51kdj7a7d/ydb:24.2.7
10+
image: cr.yandex/crptqonuodf51kdj7a7d/ydb:24.3.11.13
1111
restart: always
1212
<<: *runtime
1313
volumes:
@@ -270,31 +270,31 @@ services:
270270
tenant-init:
271271
condition: service_completed_successfully
272272

273-
prometheus:
274-
image: prom/prometheus
275-
restart: unless-stopped
276-
<<: *runtime
277-
ports:
278-
- "9090:9090"
279-
volumes:
280-
- ./prometheus.yml:/etc/prometheus/prometheus.yml
281-
deploy: &monitoring-deploy
282-
resources:
283-
limits:
284-
cpus: "0.1"
285-
memory: 1000M
286-
reservations:
287-
cpus: "0.001"
288-
memory: 50M
289-
290-
prometheus-pushgateway:
291-
image: prom/pushgateway
292-
restart: unless-stopped
293-
<<: *runtime
294-
ports:
295-
- "9091:9091"
296-
deploy:
297-
<<: *monitoring-deploy
273+
# prometheus:
274+
# image: prom/prometheus
275+
# restart: unless-stopped
276+
# <<: *runtime
277+
# ports:
278+
# - "9090:9090"
279+
# volumes:
280+
# - ./prometheus.yml:/etc/prometheus/prometheus.yml
281+
# deploy: &monitoring-deploy
282+
# resources:
283+
# limits:
284+
# cpus: "0.1"
285+
# memory: 1000M
286+
# reservations:
287+
# cpus: "0.001"
288+
# memory: 50M
289+
#
290+
# prometheus-pushgateway:
291+
# image: prom/pushgateway
292+
# restart: unless-stopped
293+
# <<: *runtime
294+
# ports:
295+
# - "9091:9091"
296+
# deploy:
297+
# <<: *monitoring-deploy
298298

299299
# chaos:
300300
# image: docker:latest

slo/playground/configs/ydb.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
p_q_config:
2+
require_credentials_in_new_protocol: false
3+
14
actor_system_config:
25
cpu_count: 1
36
node_type: STORAGE
@@ -40,7 +43,7 @@ domains_config:
4043
vdisk_kind: Default
4144
state_storage:
4245
- ring:
43-
node: [1]
46+
node: [ 1 ]
4447
nto_select: 1
4548
ssid: 1
4649
host_configs:

slo/src/AdoNet/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
using AdoNet;
44
using Internal;
55

6-
await Cli.Run(new SloContext(), args);
6+
await Cli.Run(new SloTableContext(), args);

slo/src/AdoNet/SloContext.cs renamed to slo/src/AdoNet/SloTableContext.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace AdoNet;
1010

11-
public class SloContext : SloContext<YdbDataSource>
11+
public class SloTableContext : SloTableContext<YdbDataSource>
1212
{
1313
private readonly AsyncPolicy _policy = Policy.Handle<YdbException>(exception => exception.IsTransient)
1414
.WaitAndRetryAsync(10, attempt => TimeSpan.FromMilliseconds(attempt * 10),
@@ -103,6 +103,9 @@ protected override Task<YdbDataSource> CreateClient(Config config)
103103
var port = splitEndpoint[1].Split(":")[1];
104104

105105
return Task.FromResult(new YdbDataSource(new YdbConnectionStringBuilder
106-
{ UseTls = useTls, Host = host, Port = int.Parse(port), Database = config.Db, LoggerFactory = Factory }));
106+
{
107+
UseTls = useTls, Host = host, Port = int.Parse(port), Database = config.Db,
108+
LoggerFactory = ISloContext.Factory
109+
}));
107110
}
108111
}

slo/src/Internal/Cli.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public static class Cli
101101
CreateCommand, RunCommand
102102
};
103103

104-
public static async Task<int> Run<T>(SloContext<T> sloContext, string[] args) where T : IDisposable
104+
public static async Task<int> Run(ISloContext sloContext, string[] args)
105105
{
106106
CreateCommand.SetHandler(async createConfig => { await sloContext.Create(createConfig); },
107107
new CreateConfigBinder(EndpointArgument, DbArgument, ResourceYdbPath, MinPartitionsCountOption,

slo/src/Internal/SloContext.cs renamed to slo/src/Internal/SloTableContext.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
namespace Internal;
99

10-
public abstract class SloContext<T> where T : IDisposable
10+
public interface ISloContext
1111
{
1212
// ReSharper disable once StaticMemberInGenericType
13-
protected static readonly ILoggerFactory Factory =
13+
public static readonly ILoggerFactory Factory =
1414
LoggerFactory.Create(builder =>
1515
{
1616
builder.AddConsole().SetMinimumLevel(LogLevel.Information);
@@ -19,7 +19,15 @@ public abstract class SloContext<T> where T : IDisposable
1919
builder.AddFilter("Ydb.Sdk.Services.Topic", LogLevel.Debug);
2020
});
2121

22-
protected static readonly ILogger Logger = Factory.CreateLogger<SloContext<T>>();
22+
23+
public Task Create(CreateConfig config);
24+
25+
public Task Run(RunConfig runConfig);
26+
}
27+
28+
public abstract class SloTableContext<T> : ISloContext where T : IDisposable
29+
{
30+
protected static readonly ILogger Logger = ISloContext.Factory.CreateLogger<SloTableContext<T>>();
2331

2432
private volatile int _maxId;
2533

slo/src/TableService/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
using Internal;
44
using TableService;
55

6-
return await Cli.Run(new SloContext(), args);
6+
return await Cli.Run(new SloTableContext(), args);

slo/src/TableService/SloContext.cs renamed to slo/src/TableService/SloTableContext.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace TableService;
99

10-
public class SloContext : SloContext<TableClient>
10+
public class SloTableContext : SloTableContext<TableClient>
1111
{
1212
private readonly TxControl _txControl = TxControl.BeginSerializableRW().Commit();
1313
protected override string Job => "TableService";
@@ -79,6 +79,7 @@ protected override async Task Create(TableClient client, string createTableSql,
7979

8080
protected override async Task<TableClient> CreateClient(Config config)
8181
{
82-
return new TableClient(await Driver.CreateInitialized(new DriverConfig(config.Endpoint, config.Db), Factory));
82+
return new TableClient(await Driver.CreateInitialized(new DriverConfig(config.Endpoint, config.Db),
83+
ISloContext.Factory));
8384
}
8485
}

slo/src/TopicService/Program.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
using Internal;
2+
using TopicService;
3+
4+
return await Cli.Run(new SloTopicContext(), args);

0 commit comments

Comments
 (0)