fix(push): fix guard clauses to prevent error spam in logs (#17372)

pull/17440/head
matthewhudsonedb 1 year ago committed by GitHub
parent 3f1fb469a8
commit d70b20e37f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      pkg/loghttp/push/push.go

@ -160,7 +160,7 @@ func ParseRequest(logger log.Logger, userID string, maxRecvMsgSize int, r *http.
for retentionPeriod, size := range retentionToSizeMapping {
retentionHours := RetentionPeriodToString(retentionPeriod)
// Add guard clause to prevent negative values from being passed to Prometheus counters
if size > 0 {
if size >= 0 {
bytesIngested.WithLabelValues(userID, retentionHours, isAggregatedMetric, policyName).Add(float64(size))
bytesReceivedStats.Inc(size)
} else {
@ -181,7 +181,7 @@ func ParseRequest(logger log.Logger, userID string, maxRecvMsgSize int, r *http.
retentionHours := RetentionPeriodToString(retentionPeriod)
// Add guard clause to prevent negative values from being passed to Prometheus counters
if size > 0 {
if size >= 0 {
structuredMetadataBytesIngested.WithLabelValues(userID, retentionHours, isAggregatedMetric, policyName).Add(float64(size))
bytesIngested.WithLabelValues(userID, retentionHours, isAggregatedMetric, policyName).Add(float64(size))
bytesReceivedStats.Inc(size)

Loading…
Cancel
Save