You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Grafana's "Show context" modal, every log line timestamped within 1 second after the selected (anchor) line appears twice. Since logs of one request usually cluster within milliseconds, in practice the whole visible context is duplicated. Querying any of those lines directly returns a single copy — storage is fine, this is a fetch/display artifact.
What we found reading the source (plugin v0.29.0 + Grafana 13.0.1):
The plugin's context time ranges overlap by 1 second:
// src/logContext/LogContextProvider.tsx (createContextTimeRange)constoverlap=1000;// Backward: [t - 2h, t + overlap]// Forward: [t, t + 2h]
On the Grafana side, the context modal's duplicate filter doesn't catch this: LogRowContextModal fires its above/below initial loads concurrently, and each load dedupes (containsRow: entry + timeEpochNs) against a stale snapshot containing only the anchor row — so lines fetched by both direction queries pass both filters and are appended twice.
Since the overlap lives in the plugin and the duplicate filtering lives in Grafana core, this probably needs to be looked at together — happy to provide more details or file a linked issue on the Grafana side if that helps.
To Reproduce
Any VictoriaLogs datasource, query logs where several lines share the same second (e.g. one HTTP request's log lines).
Click Show context on one of them.
Lines just after the anchor are listed twice; lines further than 1s away appear once.
Versions of VictoriaLogs datasource and VictoriaLogs backend
Plugin version: v0.29.0
VictoriaLogs version: v1.50.0 (single-node)
Grafana version: v13.0.1+security-01
Vmauth: not used (Grafana talks directly to the victoria-logs-single service)
Open the link (Explore, * over the last 5m on the playground's VictoriaLogs datasource), pick a log line that has neighbors in the same second (the demo data logs land a few ms apart), click Show context → the lines within 1s of the anchor are listed twice (screenshot attached).
Note when double-checking storage on the playground: some demo pods (e.g. the kafka pod) are ingested into two different streams, so a global search for a line can legitimately return 2 copies with different _stream_ids. That's unrelated — the context modal scopes its query to the anchor's _stream_id, and within that single stream each line has exactly one copy (_stream_id:<id> "<line>" | stats count() → 1), yet is displayed twice in the modal.
Describe the bug
In Grafana's "Show context" modal, every log line timestamped within 1 second after the selected (anchor) line appears twice. Since logs of one request usually cluster within milliseconds, in practice the whole visible context is duplicated. Querying any of those lines directly returns a single copy — storage is fine, this is a fetch/display artifact.
What we found reading the source (plugin v0.29.0 + Grafana 13.0.1):
The plugin's context time ranges overlap by 1 second:
So both direction queries return every line in
[t, t+1s]. (The overlap presumably exists because the context request'srange.from/tois millisecond-precision, and ending the backward range exactly attwould drop lines in the same millisecond — Loki's provider does that and same-instant lines get lost, see "Show Context" doesn't show surrounding lines when multiple lines have the same timestamp grafana/grafana#64966.)On the Grafana side, the context modal's duplicate filter doesn't catch this:
LogRowContextModalfires its above/below initial loads concurrently, and each load dedupes (containsRow: entry +timeEpochNs) against a stale snapshot containing only the anchor row — so lines fetched by both direction queries pass both filters and are appended twice.Since the overlap lives in the plugin and the duplicate filtering lives in Grafana core, this probably needs to be looked at together — happy to provide more details or file a linked issue on the Grafana side if that helps.
To Reproduce
Versions of VictoriaLogs datasource and VictoriaLogs backend
Link to dashboard in Victoria Metrics
https://play-grafana.victoriametrics.com/explore?schemaVersion=1&orgId=1&panes=%7B%22vls%22%3A%7B%22datasource%22%3A%22PD775F2863313E6C7%22%2C%22queries%22%3A%5B%7B%22refId%22%3A%22A%22%2C%22expr%22%3A%22%2A%22%2C%22datasource%22%3A%7B%22type%22%3A%22victoriametrics-logs-datasource%22%2C%22uid%22%3A%22PD775F2863313E6C7%22%7D%7D%5D%2C%22range%22%3A%7B%22from%22%3A%22now-5m%22%2C%22to%22%3A%22now%22%7D%7D%7D
Open the link (Explore,
*over the last 5m on the playground's VictoriaLogs datasource), pick a log line that has neighbors in the same second (the demo data logs land a few ms apart), click Show context → the lines within 1s of the anchor are listed twice (screenshot attached).Note when double-checking storage on the playground: some demo pods (e.g. the kafka pod) are ingested into two different streams, so a global search for a line can legitimately return 2 copies with different
_stream_ids. That's unrelated — the context modal scopes its query to the anchor's_stream_id, and within that single stream each line has exactly one copy (_stream_id:<id> "<line>" | stats count()→ 1), yet is displayed twice in the modal.Please provide dashboard JSON if it is possible
No response
Additional information
No response