stephenyeargin / hubot-grafana

📈🤖 Query Grafana dashboards
http://docs.grafana.org/tutorials/hubot_howto/
MIT License
154 stars 48 forks source link

Grafana 7: Full screen leads to localhost:3000 redirect #132

Closed KeesCBakker closed 2 years ago

KeesCBakker commented 4 years ago

Describe the bug When a dashboard is rendered, a link to the "fullscreen" dashboard is generated as well. This link looks like this:

https://my.dashboards.link/dashboard/db/team-tooling/?panelId=1&fullscreen&from=now-6h&to=now

But when I click it, it redirects to:

http://localhost:3000/d/lHzvLGpGk/team-tooling?from=now-6h&to=now&viewPanel=1

But when I change the link to this, it works:

https://my.dashboards.link/dashboard/db/team-tooling/?panelId=1&viewPanel=1&from=now-6h&to=now

Here I removed the fullscreen parameter. I added a viewPanel= parameter.

We're running Grafana v7.1.3 (5723d951af)

To Reproduce Steps to reproduce the behavior:

  1. Grafana 7
  2. Request panel through bot
  3. Click on link in the Slack message

Expected behavior I would expect the link to work. By changing the link it works.

Screenshots N/A

Work-a-round I've patched the msg.send method to intercept the message to Slack and changed the message:

            let item = payload.attachments[0];

            item.fallback = item.fallback.replace("&fullscreen", "");
            item.title_link = item.title_link.replace("&fullscreen", "");

            item.fallback = item.fallback.replace(/panelId=(\d+)/, "panelId=$1&viewPanel=$1");
            item.title_link = item.title_link.replace(/panelId=(\d+)/, "panelId=$1&viewPanel=$1");

Software:

Additional context N/A

KeesCBakker commented 4 years ago

I'm happy to create a PR that changes the link into a view-panel instead of the fullscreen based on a config value.

stephenyeargin commented 4 years ago

A little weird that Grafana would redirect back to an absolute link (including port) rather than a relative link, and even weirder that the fullscreen parameter changes this behavior. Can change the behavior regardless, but is there a chance this is a bug in Grafana?

KeesCBakker commented 4 years ago

I'm almost sure it has something to do with Grafana, at the office we're looking into it as well.

stephenyeargin commented 2 years ago

Closing this out for now. Can re-open if needed.