Skip to content

Commit c0faa18

Browse files
dev SLO: fail job when throws any YDB exception. (All errors must be retried) (#548)
1 parent 46c63ba commit c0faa18

File tree

1 file changed

+6
-29
lines changed

1 file changed

+6
-29
lines changed

slo/src/Internal/SloTableContext.cs

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using NLog.Extensions.Logging;
66
using Prometheus;
77
using Ydb.Sdk;
8-
using Ydb.Sdk.Ado;
98

109
namespace Internal;
1110

@@ -151,11 +150,6 @@ async Task ShootingTask(RateLimiter rateLimitPolicy, string operationType, Func<
151150
"Total number of successful operations, categorized by type."
152151
);
153152

154-
var operationsFailureTotal = metricFactory.CreateCounter(
155-
"sdk_operations_failure_total",
156-
"Total number of failed operations, categorized by type."
157-
);
158-
159153
var operationLatencySeconds = metricFactory.CreateHistogram(
160154
"sdk_operation_latency_seconds",
161155
"Latency of operations performed by the SDK in seconds, categorized by type and status.",
@@ -186,12 +180,6 @@ async Task ShootingTask(RateLimiter rateLimitPolicy, string operationType, Func<
186180
"Current number of pending operations, categorized by type."
187181
);
188182

189-
var errorsTotal = metricFactory.CreateCounter(
190-
"sdk_errors_total",
191-
"Total number of errors encountered, categorized by error type.",
192-
["error_type"]
193-
);
194-
195183
var workJobs = new List<Task>();
196184

197185
for (var i = 0; i < 10; i++)
@@ -210,23 +198,12 @@ async Task ShootingTask(RateLimiter rateLimitPolicy, string operationType, Func<
210198

211199
pendingOperations.Inc();
212200
var sw = Stopwatch.StartNew();
213-
try
214-
{
215-
await action(client, runConfig);
216-
sw.Stop();
217-
operationsTotal.Inc();
218-
pendingOperations.Dec();
219-
operationsSuccessTotal.Inc();
220-
operationLatencySeconds.WithLabels("success").Observe(sw.Elapsed.TotalSeconds);
221-
}
222-
catch (YdbException e)
223-
{
224-
Logger.LogError(e, "Fail operation!");
225-
226-
errorsTotal.WithLabels(e.Code.StatusName()).Inc();
227-
operationsFailureTotal.Inc();
228-
operationLatencySeconds.WithLabels("err").Observe(sw.Elapsed.TotalSeconds);
229-
}
201+
await action(client, runConfig);
202+
sw.Stop();
203+
operationsTotal.Inc();
204+
pendingOperations.Dec();
205+
operationsSuccessTotal.Inc();
206+
operationLatencySeconds.WithLabels("success").Observe(sw.Elapsed.TotalSeconds);
230207
}
231208
}, cancellationTokenSource.Token));
232209
}

0 commit comments

Comments
 (0)