Skip to content

Commit

Permalink
fix: allow any level for aggregated metrics (grafana#14255)
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorwhitney authored and jeschkies committed Oct 1, 2024
1 parent 9007c4b commit 9d7f4db
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions pkg/pattern/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"sync"

"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/grafana/dskit/httpgrpc"
"github.com/grafana/dskit/multierror"
"github.com/grafana/dskit/ring"
Expand Down Expand Up @@ -264,20 +263,11 @@ func (i *instance) Observe(stream string, entries []logproto.Entry) {
streamMetrics, ok := i.aggMetricsByStreamAndLevel[stream]

if !ok {
streamMetrics = make(map[string]*aggregatedMetrics, len(constants.LogLevels))
for _, l := range constants.LogLevels {
streamMetrics[l] = &aggregatedMetrics{}
}
streamMetrics = map[string]*aggregatedMetrics{}
}

if _, ok := streamMetrics[lvl]; !ok {
level.Warn(i.logger).Log(
"msg", "unknown log level while observing stream",
"level", lvl,
"stream", stream,
)

lvl = constants.LogLevelUnknown
streamMetrics[lvl] = &aggregatedMetrics{}
}

streamMetrics[lvl].bytes += uint64(len(entry.Line))
Expand Down

0 comments on commit 9d7f4db

Please sign in to comment.