File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
src/NTorSpectator.Observer/Services Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ namespace NTorSpectator.Observer.Services;
9
9
public class SpectatorJob : IJob
10
10
{
11
11
private static readonly Gauge QueueLength = Metrics . CreateGauge ( "sites_queue_length" , "Length of the queue left to observe" ) ;
12
+ private static readonly Counter ObservationsCount = Metrics . CreateCounter ( "observations" , "counts all observations" ) ;
13
+ private static readonly Counter RetriesCount = Metrics . CreateCounter ( "enqueued_retries" , "counts retires" ) ;
14
+
12
15
private readonly ILogger < SpectatorJob > _logger ;
13
16
private readonly ISitesCatalogue _sitesCatalogue ;
14
17
private readonly TorControlManager _torControl ;
@@ -37,6 +40,7 @@ public async Task Execute(IJobExecutionContext context)
37
40
try
38
41
{
39
42
var observations = await ObserveSite ( queuedSite . Site . SiteUri ) ;
43
+ ObservationsCount . Inc ( ) ;
40
44
if ( ! observations . IsOk )
41
45
{
42
46
_logger . LogDebug ( "Site observed as not available" ) ;
@@ -45,6 +49,7 @@ public async Task Execute(IJobExecutionContext context)
45
49
{
46
50
_logger . LogDebug ( "Site has been observed {Count} times, returning it to queue" , siteObservationsCount ) ;
47
51
siteQueue . Enqueue ( queuedSite with { ObservationsCount = siteObservationsCount + 1 } ) ;
52
+ RetriesCount . Inc ( ) ;
48
53
continue ;
49
54
}
50
55
}
You can’t perform that action at this time.
0 commit comments