Skip to content

Label filter autocomplete dropdown does not respect the current page time range — services with no recent logs are missing #1811

@Harish416

Description

@Harish416

Summary

The "Add label filter" combobox in Logs Drilldown fetches label values using a fixed
internal time window instead of the currently selected page time range. This causes
label values that haven't appeared in logs recently to be silently missing from the
autocomplete dropdown, even though they exist within the user's selected time range.

Steps to Reproduce

  1. Set the page time range to a wide window e.g. Last 7 days
  2. Click + Add label filter and select any label (e.g. service_name)
  3. Start typing a value in the combobox
  4. Observe that some values are missing from the dropdown

Expected Behavior

The label value autocomplete should use the same time range as the current page
when querying Loki's label values API, so any value visible in the current view is
also discoverable in the filter dropdown.

Actual Behavior

The dropdown uses a fixed short time window to fetch label values. Any label value
with no log activity within that window is silently omitted from the autocomplete —
with no indication to the user that values are missing.

The only workarounds are:

  • Type the full value manually and select "Use custom value: ..."
  • Switch to Grafana Explore, which respects the page time range for label autocomplete

Why This Matters

This is particularly confusing during incident investigation — a service that has
crashed and stopped logging is exactly when you need to filter for it, but it
disappears from the dropdown. It also affects low-volume or batch services that
log infrequently.

Proposed Fix

Use the current page timeRange when calling Loki's label values API for the filter
combobox. If performance is a concern for large time ranges, cap the autocomplete
window at the page time range so it never queries more than needed, while ensuring
it never queries less than what the user is currently viewing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions