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 Sep 25, 2024
1 parent d0f1905 commit c001a1d
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 c001a1d

Please sign in to comment.