@@ -33,24 +33,19 @@ const (
33
33
)
34
34
35
35
type metrics struct {
36
- tenantExceedsLimits * prometheus.CounterVec
37
- tenantActiveStreams * prometheus.GaugeVec
38
- tenantRejectedStreams * prometheus.CounterVec
36
+ activeStreams * prometheus.GaugeVec
37
+ rejectedStreams * prometheus.CounterVec
39
38
}
40
39
41
40
func newMetrics (reg prometheus.Registerer ) * metrics {
42
41
return & metrics {
43
- tenantExceedsLimits : promauto .With (reg ).NewCounterVec (prometheus.CounterOpts {
44
- Name : "loki_ingest_limits_frontend_exceeds_limits_total" ,
45
- Help : "The total number of requests that exceeded limits per tenant." ,
46
- }, []string {"tenant" }),
47
- tenantActiveStreams : promauto .With (reg ).NewGaugeVec (prometheus.GaugeOpts {
42
+ activeStreams : promauto .With (reg ).NewGaugeVec (prometheus.GaugeOpts {
48
43
Name : "loki_ingest_limits_frontend_streams_active" ,
49
44
Help : "The current number of active streams (seen within the window) per tenant." ,
50
45
}, []string {"tenant" }),
51
- tenantRejectedStreams : promauto .With (reg ).NewCounterVec (prometheus.CounterOpts {
46
+ rejectedStreams : promauto .With (reg ).NewCounterVec (prometheus.CounterOpts {
52
47
Name : "loki_ingest_limits_frontend_streams_rejected_total" ,
53
- Help : "The total number of rejected streams per tenant when the global limit is exceeded ." ,
48
+ Help : "The total number of rejected streams per tenant." ,
54
49
}, []string {"tenant" , "reason" }),
55
50
}
56
51
}
@@ -181,7 +176,7 @@ func (f *Frontend) ExceedsLimits(ctx context.Context, req *logproto.ExceedsLimit
181
176
activeStreamsTotal += resp .Response .ActiveStreams
182
177
rateTotal += float64 (resp .Response .Rate )
183
178
}
184
- f .metrics .tenantActiveStreams .WithLabelValues (req .Tenant ).Set (float64 (activeStreamsTotal ))
179
+ f .metrics .activeStreams .WithLabelValues (req .Tenant ).Set (float64 (activeStreamsTotal ))
185
180
186
181
// A slice containing the rejected streams returned to the caller.
187
182
// If len(rejectedStreams) == 0 then the request does not exceed limits.
@@ -212,7 +207,7 @@ func (f *Frontend) ExceedsLimits(ctx context.Context, req *logproto.ExceedsLimit
212
207
}
213
208
}
214
209
}
215
- f .metrics .tenantRejectedStreams .WithLabelValues (
210
+ f .metrics .rejectedStreams .WithLabelValues (
216
211
req .Tenant ,
217
212
ReasonExceedsMaxStreams ,
218
213
).Add (float64 (len (rejectedStreams )))
@@ -227,16 +222,12 @@ func (f *Frontend) ExceedsLimits(ctx context.Context, req *logproto.ExceedsLimit
227
222
Reason : ReasonExceedsRateLimit ,
228
223
})
229
224
}
230
- f .metrics .tenantRejectedStreams .WithLabelValues (
225
+ f .metrics .rejectedStreams .WithLabelValues (
231
226
req .Tenant ,
232
227
ReasonExceedsRateLimit ,
233
228
).Add (float64 (len (streamHashes )))
234
229
}
235
230
236
- if len (rejectedStreams ) > 0 {
237
- f .metrics .tenantExceedsLimits .WithLabelValues (req .Tenant ).Inc ()
238
- }
239
-
240
231
return & logproto.ExceedsLimitsResponse {
241
232
Tenant : req .Tenant ,
242
233
RejectedStreams : rejectedStreams ,
0 commit comments