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

OPG-488: Fix issue with Performance query variable interpolation #1038

Merged

Conversation

synqotik
Copy link
Contributor

If you add 2 variables to a Dashboard and they both have the same beginning of the variable name, then if you use the one with the longer name in a Performance query, the variable interpolation will end up doing a partial match on the shorter variable name and doing the interpolation, adding the rest of the longer variable name onto the value.

Example: user adds $node and $nodeId variables, both referencing nodeFilter(), maybe $node actually references nodeFilter(labelFormat=id:label,valueFormat=id).

User uses $nodeId in a Performance Attribute query for the Node. They then try to set the Resource part of the query but it fails. Say $node and $nodeId were both set to a node Id of 1. Interpolation finds $node, does a substitution on the string $nodeId and results in 1Id. This is sent to the query to get resources and fails (node[1Id] is not found).

Solution is to add a word boundary to the regex before doing a replacement, e.g. do a regex match on \$node\b will fail on a string $nodeId; \$nodeId\b will correctly match.

External References

@synqotik synqotik requested a review from cgorantla December 10, 2024 00:24
Copy link
Contributor

@christianpape christianpape left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@synqotik synqotik merged commit a6294dd into release-9.x Dec 12, 2024
10 of 11 checks passed
@synqotik synqotik deleted the jira/OPG-488-perf-query-variable-interpolation-issue branch December 12, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants