Skip to content

Commit

Permalink
added debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillKurdyukov committed Aug 14, 2024
1 parent 20d3ffb commit 9ac96c4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion slo/src/Internal/SloContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ public async Task Run(RunConfig runConfig)
new Dictionary<string, YdbValue>(), runConfig.ReadTimeout);
_maxId = (int)maxId!;

_logger.LogInformation("Init row count: {MaxId}", _maxId);

var metricFactory = Metrics.WithLabels(new Dictionary<string, string>
{ { "jobName", JobName }, { "sdk", "dotnet" }, { "sdkVersion", Environment.Version.ToString() } });

Expand Down Expand Up @@ -149,12 +151,17 @@ Task ShootingTask(RateLimitPolicy rateLimitPolicy, string shootingName,
{
var tasks = new List<Task>();
long activeTasks = 0;
while (!cancellationTokenSource.Token.IsCancellationRequested)
{
try
{
tasks.Add(rateLimitPolicy.Execute(async () =>
{
// ReSharper disable once AccessToModifiedClosure
Interlocked.Increment(ref activeTasks);
var sw = Stopwatch.StartNew();
var (attempts, statusCode) = await action(client, runConfig, errorsGauge);
string label;
Expand All @@ -172,13 +179,14 @@ Task ShootingTask(RateLimitPolicy rateLimitPolicy, string shootingName,
label = "ok";
}
Interlocked.Decrement(ref activeTasks);
attemptsHistogram.WithLabels(label).Observe(attempts);
latencySummary.WithLabels(label).Observe(sw.ElapsedMilliseconds);
}));
}
catch (RateLimitRejectedException)
{
_logger.LogInformation("Waiting {ShootingName} tasks", shootingName);
_logger.LogInformation("Waiting {ShootingName} task, count active tasks: {}", shootingName, Interlocked.Read(ref activeTasks));
await Task.Delay(990, cancellationTokenSource.Token);
}
Expand Down

0 comments on commit 9ac96c4

Please sign in to comment.