File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/NTorSpectator.Observer/Services Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,12 @@ 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
12
private static readonly Counter ObservationsCount = Metrics . CreateCounter ( "observations" , "counts all observations" ) ;
13
- private static readonly Counter RetriesCount = Metrics . CreateCounter ( "enqueued_retries" , "counts retires" ) ;
13
+ private static readonly Counter RetriesCount = Metrics . CreateCounter ( "enqueued_retries" , "counts retires" ) ;
14
+ private static readonly Histogram RequestDuration = Metrics . CreateHistogram ( "observation_duration" , "duration of site observation" ,
15
+ new HistogramConfiguration
16
+ {
17
+ Buckets = Histogram . LinearBuckets ( 0.5 , 0.5 , 20 )
18
+ } ) ;
14
19
15
20
private readonly ILogger < SpectatorJob > _logger ;
16
21
private readonly ISitesCatalogue _sitesCatalogue ;
@@ -69,6 +74,7 @@ private record QueuedSite(Site Site, int ObservationsCount);
69
74
70
75
private async Task < TorWatchResults > ObserveSite ( string site )
71
76
{
77
+ using var _ = RequestDuration . NewTimer ( ) ;
72
78
var torReply = await _torControl . HsFetch ( site ) ;
73
79
var positive = torReply . Count ( x => x . Action == HsDescAction . Received ) ;
74
80
var negative = torReply . Count ( x => x . Action == HsDescAction . Failed ) ;
You can’t perform that action at this time.
0 commit comments