Skip to content

Conversation

@ire4ever1190
Copy link
Contributor

Implements #256

Supports connecting via basic auth if the instance supports it.
Configured via either

  • Environment variables
    • GRAFANA_USERNAME
    • GRAFANA_PASSWORD
  • HTTP Headers using standard HTTP basic auth

Works locally when connecting to grafana instance that has basic auth
image

@ire4ever1190 ire4ever1190 requested a review from a team as a code owner August 24, 2025 00:40
@CLAassistant
Copy link

CLAassistant commented Aug 24, 2025

CLA assistant check
All committers have signed the CLA.

…cally

Thought they passed, turns out nothing ran (I am new to go sorry)
Copy link
Collaborator

@sd2k sd2k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thank you! The one thing I'd love to see is an end-to-end test. I think it should be possible to:

  • set GF_AUTH_ANONYMOUS_ENABLED: "false" in our docker-compose file
  • modify the code that creates a new test context to set the basic auth (admin/admin) on the client used by integration tests
  • update the e2e.yml GitHub workflow to set the env vars for the Start MCP server in background step

I know it's a bit annoying to run these e2e tests since they require OpenAI/Anthropic usage so I can add this in a separate PR if you like, just let me know.

(Also, the e2e tests are failing right now, they're a bit flaky depending on how the LLMs are feeling on the day, so don't worry about those failures)

@ire4ever1190
Copy link
Contributor Author

Thanks for explaining! Will add it in this PR

Luckily I did, turns out the alerting client uses a different auth system
Set the env globally so that
 - When it gets started as a process by the tests it is picked up
 - When it gets started as a background process it is picked up
@ire4ever1190
Copy link
Contributor Author

I was able to get integration running locally, e2e just wasn't happy though (Got litellm to the local qwen model that I use but did not work well...)

@sd2k
Copy link
Collaborator

sd2k commented Aug 28, 2025

Nice, this looks and works great. Thank you @ire4ever1190!

One request, could you update the test-python-e2e target in the Makefile so that it runs something like:

	cd tests && uv sync --all-groups
	cd tests && GRAFANA_USERNAME=admin GRAFANA_PASSWORD=admin uv run pytest

@ire4ever1190
Copy link
Contributor Author

Nice, this looks and works great. Thank you @ire4ever1190!

One request, could you update the test-python-e2e target in the Makefile so that it runs something like:

	cd tests && uv sync --all-groups
	cd tests && GRAFANA_USERNAME=admin GRAFANA_PASSWORD=admin uv run pytest

Thanks! Completed in latest commit

@sd2k sd2k enabled auto-merge (squash) August 28, 2025 10:26
@sd2k sd2k merged commit d0cbad8 into grafana:main Aug 28, 2025
11 checks passed
@sd2k sd2k mentioned this pull request Sep 3, 2025
@ire4ever1190 ire4ever1190 deleted the feature/auth branch September 6, 2025 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants