Skip to content

Commit

Permalink
count time spent filtering bad messages
Browse files Browse the repository at this point in the history
Signed-off-by: John Seekins <[email protected]>
  • Loading branch information
John Seekins committed Nov 24, 2021
1 parent da61363 commit 73973c1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,14 @@ func filterMsg(thread int, msg InfluxMetric, normalize bool) (InfluxMetric, erro
if !allowedFirstChar.MatchString(msg.Name) {
DroppedMsgs.Inc()
log.WithFields(log.Fields{"threadNum": thread, "name": msg.Name, "metric": msg, "section": "filter"}).Warning("Dropped! Bad first character in name")
FilterTime.Add(float64(time.Now().Sub(FilterTimeStart)) / TimeSegmentDivisor)
return InfluxMetric{}, fmt.Errorf("Dropped metric with bad name")
}
// Also check for metrics with no fields (this occasionally happens with histograms from prometheus data sources)
if len(msg.Fields) < 1 {
DroppedMsgs.Inc()
log.WithFields(log.Fields{"threadNum": thread, "name": msg.Name, "metric": msg, "section": "filter"}).Warning("Dropped! No fields in incoming metric")
FilterTime.Add(float64(time.Now().Sub(FilterTimeStart)) / TimeSegmentDivisor)
return InfluxMetric{}, fmt.Errorf("Dropped metric with bad name")
}
if normalize {
Expand Down

0 comments on commit 73973c1

Please sign in to comment.