Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set default grafana_url if GRAFANA_API_URL set #4702

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

juriku
Copy link

@juriku juriku commented Jul 18, 2024

Issue Oncall backend calling grafana api when grafana is self hosted and under certain path

fixes errors like:

source=engine:app google_trace_id=none logger=apps.grafana_plugin.helpers.client Error connecting to api instance 404 Client Error: Not Found for url: https://test.com/api/access-control/users/permissions/search?actionPrefix=grafana-oncall-app

while GRAFANA_API_URL=https://test.com/grafana

relevant for when external self-hosted grafana has same URL, but under different path, like /grafana

Also fixes issue when self.api_url has path, but no '/' in the end

if urlparse(self.api_url).path and not self.api_url.endswith('/'):
            self.api_url += '/'

because in case of urljoin(self.api_url, endpoint)
Example:
https://test.com/path, api/v1 -> will become https://test.com/api/v1
https://test.com/path/, api/v1 -> will become https://test.com/path/api/v1

@juriku juriku requested a review from a team as a code owner July 18, 2024 09:59
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions bot added the pr:stale Added to a PR that has been deemed "stale". Managed by the actions/stale GitHub Action label Aug 18, 2024
@juriku juriku force-pushed the external_grafana_url_prefix_client branch 2 times, most recently from 6a08693 to 792240a Compare August 28, 2024 10:25
@CLAassistant
Copy link

CLAassistant commented Aug 28, 2024

CLA assistant check
All committers have signed the CLA.

override GrafanaAPIClient url if GRAFANA_API_URL set

override GrafanaAPIClient url if GRAFANA_API_URL set

override GrafanaAPIClient url if GRAFANA_API_URL set

set default grafana_url if GRAFANA_API_URL set

set default grafana_url if GRAFANA_API_URL set
@juriku juriku force-pushed the external_grafana_url_prefix_client branch from eb6f214 to 44c2f0a Compare August 28, 2024 10:26
@github-actions github-actions bot removed the pr:stale Added to a PR that has been deemed "stale". Managed by the actions/stale GitHub Action label Aug 29, 2024
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions bot added the pr:stale Added to a PR that has been deemed "stale". Managed by the actions/stale GitHub Action label Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:stale Added to a PR that has been deemed "stale". Managed by the actions/stale GitHub Action
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants