fix(runner/loki): send basic auth on the compat query path - #524
Open
mayankpande88 wants to merge 2 commits into
Open
fix(runner/loki): send basic auth on the compat query path#524mayankpande88 wants to merge 2 commits into
mayankpande88 wants to merge 2 commits into
Conversation
The compat handlers (query_loki / query_loki_labels / query_grafana_loki_label_values / query_grafana_loki_series) build their request in rawGet, which copied only ExtraHeaders and ignored the LOKI_USERNAME / LOKI_PASSWORD basic-auth credentials set on the client. Any basic-auth-protected Loki returned 401 for these actions, even though the primitive loki_* handlers authenticated correctly. Apply SetBasicAuth in rawGet when both username and password are set, mirroring the primitive loki.Client.get path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L2HAXQH1gEtX7h4sUJsi9j
There was a problem hiding this comment.
Code Review
This pull request adds support for Basic Authentication in the Loki compatibility layer (LokiCompat.rawGet) by setting the credentials on the outgoing HTTP request when both username and password are provided. It also introduces comprehensive unit tests to verify that basic auth headers are correctly applied when credentials are set, and omitted when they are incomplete. No review comments were provided, and I have no additional feedback.
RamanKharchee
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The compat handlers (query_loki / query_loki_labels /
query_grafana_loki_label_values / query_grafana_loki_series) build
their request in rawGet, which copied only ExtraHeaders and ignored the
LOKI_USERNAME / LOKI_PASSWORD basic-auth credentials set on the client.
Any basic-auth-protected Loki returned 401 for these actions, even
though the primitive loki_* handlers authenticated correctly.
Apply SetBasicAuth in rawGet when both username and password are set,
mirroring the primitive loki.Client.get path.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01L2HAXQH1gEtX7h4sUJsi9j