@@ -66,9 +66,10 @@ private static void SubscribeItemDequeuedEvent(
66
66
events . ItemDequeued . Subscribe ( args =>
67
67
{
68
68
var method = accessor . GetMethod ( ) ;
69
+ var priority = args . Priority . FormatPriority ( ) ;
69
70
70
- queueItemsGauge . Set ( method , args . Priority . FormatPriority ( ) , args . QueueCount ) ;
71
- queueTimeHistogram . Observe ( method , args . Priority . FormatPriority ( ) , args . QueueTime . TotalSeconds ) ;
71
+ queueItemsGauge . Decrement ( method , priority ) ;
72
+ queueTimeHistogram . Observe ( method , priority , args . QueueTime . TotalSeconds ) ;
72
73
} ) ;
73
74
}
74
75
@@ -88,7 +89,7 @@ private static void SubscribeItemProcessedEvent(
88
89
var method = accessor . GetMethod ( ) ;
89
90
var priority = args . Priority . FormatPriority ( ) ;
90
91
91
- concurrencyItemsGauge . Set ( method , priority , args . ConcurrencyCount ) ;
92
+ concurrencyItemsGauge . Decrement ( method , priority ) ;
92
93
taskProcessingTimeHistogram . Observe ( method , priority , args . ProcessingTime . TotalSeconds ) ;
93
94
} ) ;
94
95
}
@@ -123,10 +124,10 @@ private static void SubscribeItemProcessingEvent(
123
124
124
125
events . ItemProcessing . Subscribe ( args =>
125
126
{
126
- concurrencyItemsGauge . Set (
127
- accessor . GetMethod ( ) ,
128
- args . Priority . FormatPriority ( ) ,
129
- args . ConcurrencyCount ) ;
127
+ var method = accessor . GetMethod ( ) ;
128
+ var priority = args . Priority . FormatPriority ( ) ;
129
+
130
+ concurrencyItemsGauge . Increment ( method , priority ) ;
130
131
} ) ;
131
132
}
132
133
@@ -139,10 +140,10 @@ private static void SubscribeItemEnqueuedEvent(this Events.ILoadSheddingEvents e
139
140
140
141
events . ItemEnqueued . Subscribe ( args =>
141
142
{
142
- queueItemsGauge . Set (
143
- accessor . GetMethod ( ) ,
144
- args . Priority . FormatPriority ( ) ,
145
- args . QueueCount ) ;
143
+ var method = accessor . GetMethod ( ) ;
144
+ var priority = args . Priority . FormatPriority ( ) ;
145
+
146
+ queueItemsGauge . Increment ( method , priority ) ;
146
147
} ) ;
147
148
}
148
149
@@ -155,8 +156,10 @@ private static void SubscribeRejectedEvent(this Events.ILoadSheddingEvents event
155
156
156
157
events . Rejected . Subscribe ( args =>
157
158
{
159
+ var method = accessor . GetMethod ( ) ;
160
+
158
161
rejectedCounter . Increment (
159
- accessor . GetMethod ( ) ,
162
+ method ,
160
163
args . Priority . FormatPriority ( ) ,
161
164
args . Reason ) ;
162
165
} ) ;
@@ -171,10 +174,5 @@ private static string GetMethod(this IHttpContextAccessor accessor)
171
174
172
175
return accessor . HttpContext . Request . Method . ToUpper ( ) ;
173
176
}
174
-
175
- private static string FormatPriority ( this Priority priority )
176
- {
177
- return priority . ToString ( ) . ToLower ( ) ;
178
- }
179
177
}
180
178
}
0 commit comments