-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
DataLinks: Fix bug where links which used built in variables could be hidden #71372
Conversation
Backend code coverage report for PR #71372 |
Frontend code coverage report for PR #71372
|
Are there instructions on how to get this set up with devenv tempo? |
@gelicia
But also I assume you can just add $__rate_interval to some correlation that targets Prometheus and that should have similar effect. |
Ah okay, so after taking a look at this and chatting with Andrej, the issue is interpolation can happen in two places (thank you for breaking it down for me!)
When building correlations, we added in logic under the assumption we would never want to show a query with an uninterpolated variable in it, so we hide all queries that still have variable values in them after that first interpolation. However, queries can pass through with an uninterpolated variable, and then be interpolated later by the datasource code. Those datasources have a set list of expected variables they'd interpolate, so this PR adds them so the correlations code doesn't stop them from showing. I'm super torn about this, I agreed having the uninterpolated variables displaying didn't look right, but having to maintain this list and having exceptions is also not great. If we do go this route we should have the list of exceptions in the correlations documentation. |
Good spot! As it's a regression, it should be okay for a short-term quick fix but it seems we need a better solution.
Two more things about this PR:
|
testVal: { text: '', value: 'val1' }, | ||
}; | ||
const dataLinkRtnVal = getVariableUsageInfo(dataLink, scopedVars).allVariablesDefined; | ||
it('ignores global variables', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only new test, others were just refactored to remove duplicated lines
In general, I agree this should be a temporary fix but a proper one seems like it will be more complex so just wanted to get this out quickly while still in somewhat reasonable shape. |
Fixes: #70809
Relates to #64328
At some point we added check to see if variables get interpolated in the link, mainly to not show link which would end up being broken because of missing values, this check though didn't consider built in variables.
This adds a static list of variables which we just ignore.
This is not 100% perfect, variables can be added later (for example in query time) and this needs to be synchronized if some variable gets added but should be good enough for now.
You can test it for example with Tempo service map, which when clicking on node should show multiple metrics links to Prometheus but all of them use
$__rate_interval
variable.