grafana / loki

Like Prometheus, but for logs.
https://grafana.com/loki
GNU Affero General Public License v3.0
23.97k stars 3.46k forks source link

loki_querier_tail_active and loki_querier_tail_active_streams metrics become negative #15031

Open umezawatakeshi opened 1 day ago

umezawatakeshi commented 1 day ago

Describe the bug loki_querier_tail_active and loki_querier_tail_active_streams are positive or zero soon after boot but become negative some time after.

To Reproduce Steps to reproduce the behavior:

  1. Started Loki v3.2.1
  2. Started many loki-canary
  3. Query: loki_querier_tail_active or loki_querier_tail_active_streams

Expected behavior These metrics shows the number of tail connections and streams, which are always positive or zero.

Environment:

Screenshots, Promtail config, or terminal output

Image

Image

--

These metrics are incremented at https://github.com/grafana/loki/blob/v3.2.1/pkg/querier/tail.go#L344 and https://github.com/grafana/loki/blob/v3.2.1/pkg/querier/tail.go#L303 , and decremented at https://github.com/grafana/loki/blob/v3.2.1/pkg/querier/tail.go#L272-L273 and no other code modify them. Is Tailer.close() called multiple times?