grafana / sentry-datasource

Grafana data source plugin for Sentry.
https://grafana.com/grafana/plugins/grafana-sentry-datasource/
Apache License 2.0
21 stars 13 forks source link

Sentry datasource querying wrong Sentry URL #258

Open skygrammas opened 1 month ago

skygrammas commented 1 month ago

What happened: Sentry data source is attempting to fetch data from an invalid host/URL.

What you expected to happen: Sentry data source to attempt to fetch data from the URL that is explicitly listed in the data source configuration.

How to reproduce it (as minimally and precisely as possible):

  1. Deploy Grafana using the Grafana Operator v5.8.1 on Kubernetes.
  2. Configure the Sentry data source in the Grafana Kubernetes custom resource (see snippet below for exact configuration).
  3. In the Grafana UI, visit Home > Connections > Data sources.
  4. Click the Sentry data source, then click Explore data in the top-right corner

Screenshots, Recordings, and Configuration

https://github.com/grafana/sentry-datasource/assets/23141825/e90a44fe-4f2b-494e-b568-f2e81aaccb6a

It is expected that the data source fetches data from https://cruise.sentry.io/api/0/organizations/cruise/projects instead of https://cruise.sentry.iohttps//sentry.io/api/0/organizations/cruise/projects/ (which is not a valid host).

Screenshot 2024-05-23 at 10 45 15 AM

The URL in the configuration of the data source is shown in the screen recording above. I will also share the codified configuration below:

- name: sentry 
  type: grafana-sentry-datasource
  access: proxy
  isDefault: false
  basicAuth: false
  jsonData:
    url: "https://cruise.sentry.io"
    orgSlug: "cruise"
  secureJsonData:
    authToken: "${SENTRY_TOKEN}"
  secrets:
    - name: sentry-token
      env: SENTRY_TOKEN
      targetPath: secureJsonData.authToken
      value: [redacted]
  plugins:
    - name: grafana-sentry-datasource
      version: 1.7.0
skygrammas commented 1 month ago

This also happens even when the data source is configured via Grafana UI instead of code.

adamyeats commented 1 month ago

I have been unable to reproduce this issue locally, with either a provisioning file or through the UI. In the code, there doesn't actually seem to be any concatenation of URL strings happening at all, making this doubly strange. This leads me to think there may be an issue in the K8S Operator that is causing this. I will continue to investigate. 🔍

skygrammas commented 1 month ago

I have been unable to reproduce this issue locally, with either a provisioning file or through the UI. In the code, there doesn't actually seem to be any concatenation of URL strings happening at all, making this doubly strange. This leads me to think there may be an issue in the K8S Operator that is causing this. I will continue to investigate. 🔍

thank you @adamyeats! that is a reasonable suspicion, i tried looking around the code for this data source to see where this might be happening and i couldn't find it. fair callout that the Grafana Operator may be the offender in this case. please do circle back after your investigation; it may be in my best interest to migrate this issue to the operator's repo.