Table data link URL is always encoded and not usable

  • What Grafana version and what operating system are you using?
    9.1.6

  • What are you trying to achieve?
    create a url in a table cell

  • How are you trying to achieve it?
    using table data link

  • What happened?
    link got encoded

  • What did you expect to happen?
    regular url

  • Can you copy/paste the configuration(s) that you are having problems with?
    https://${__data.fields[14]:raw}/query/defects.htm?project=${__data.fields[“data.project”]:raw}&cid=${__data.fields.CID}

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

  • Did you follow any online instructions? If so, what is the URL?

What are the values of the fields?

https://sjc-xxx-coxx.domain.com:8443/query/defects.htm?project=%EF%BB%BF%EF%BB%BF%EF%BB%BFbranch_dev-xxx-family%EF%BB%BF%EF%BB%BF%EF%BB%BF&cid=%EF%BB%BF2xxxxx7

The expected URL should not be encoded.

please provide the data samples not the encoded url

__data.fields[14]=sjc-xxx-coxx.domain.com:8443
__data.fields[“data.project”]=branch_dev-xxx-family
__data.fields.CID=2xxxxx7

1 Like

wonder if percentencode would work better than :

This one doesn’t make the link clickable: https://${__data.fields[14]:percentencode}/query/defects.htm?project=${__data.fields[“data.project”]:percentencode}&cid=${__data.fields.CID:percentencode}

and this one always got encoded https://${__data.fields[14]}/query/defects.htm?project=${__data.fields[“data.project”]}&cid=${__data.fields.CID}

what do you get when you right click on one of the data links and copy paste it to your browser ?

https://sjc-xxx-coxx.domain.com:8443/query/defects.htm?project=branch_dev-xxx-family&cid=2xxxxx7

This is what I get when right click and copy based on data you provided

Also the fact that it encodes it might mean you have data with spaces

This is the URL that I copy from the table cell

https://sjc-xxx-coxx.domain.com:8443/query/defects.htm?project=%EF%BB%BF%EF%BB%BF%EF%BB%BFbranch_dev-xxx-family%EF%BB%BF%EF%BB%BF%EF%BB%BF&cid=%EF%BB%BF2xxxxx7

where is your data coming from? what is your data source
I think there might be spaces in the source data

Open the source data in notepad++ and check

The data source is Elastic Search. I checked with various tools (Explore, export CVS …) There is no space around the actual values.

checkout the data using notepad++

I downloaded and also use these tools to confirm that no space around the values. Is there a way to avoid this or is it a bug in Grafana Data Link?

EF BB BF is byte order mark for UTF-8 encoding. It may indicates a problem with site encoding, maybe user forces different encoding on the browser level, maybe ES didn’t correct encoding, … Remember that you may see sjc-xxx-coxx.domain.com:8443, but there can be non printable characters around.

1 Like

Do we have a workaround for Data Link to use the values without trying to encode (the chars that we don’t know if existed and see) ?

in notepad++

image

image

When you click on
image

I would submit this as a possible bug but imho not sure it is the responsibility of grafana to account for every possible data variations but worth asking

I wouldn’t say that is a Grafana bug unless you can prove it. Reproducible example is not provided. There can be millions things, which can be misconfigured, e. g. reverse proxy for Grafana, Es, which provides incorrect encoding and then Grafana just doing correct UTF and url encoding.

1 Like

Same problem to me .

my link definition

  • environment=“PRE”
  • arq=“X86”

What grafana opens is this link:

https://mygrafana.server.in.my.corporation.com/d/tablespace_ocupation_history/tablespace-ocupation-history?orgId=1&var-environment=PRE%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF&var-arq=%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BFX86%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF%EF%BB%BF&var-db=MYDBNAME

IT seems that it is only happening with dashboards variables. the "&var-db=${__data.fields[“DB Name”]}" is passing it well. It seems something related only to generic dashboards variables.

2 Likes

I had exactly the same problem while adding a link to another grafana dashboard. And the problem seems to be in encoding - but I could not nail it down.
not working ling (adding %BB%BF)
https://testresults.qt.io/grafana/d/3dhio4K7k/fastcheck-ci-test-info?var-testCase=${__data.fields.testCase}&var-testFunction=${__data.fields.testFunction}

working link:
https://testresults.qt.io/grafana/d/3dhio4K7k/fastcheck-ci-test-info?var-testCase=${__data.fields.testCase}&var-testFunction=${__data.fields.testFunction}

link do dashboard demonstrating behavior
https://testresults.qt.io/grafana/d/8ZVtdPf4k/grafana-adding-extra-characters-to-links?orgId=1&from=now-30d&to=now

ps that’s one of many examples of issues with working on grafana - a small issue, taking 2 hours roughly, that makes configuring and making the dashboard ‘client quality’ a frustrating experience