-
Notifications
You must be signed in to change notification settings - Fork 98
[BUGFIX] Fix tree view broken when using prometheus built-in vars #2405
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
Conversation
const queryExpr = useReplaceVariablesInString(rest.value); | ||
let queryExpr = useReplaceVariablesInString(rest.value); | ||
if (queryExpr) { | ||
queryExpr = replacePromBuiltinVariables(queryExpr, 12345, 12345); // TODO placeholder values to replace |
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.
Looks like providing proper values for the step parameters here involves some refactoring: currently I'd need to rely on the timeseries query context, but actually these step values are computed independently / before the queries are getting fired, so maybe we should extract them to independant hooks to be reused here? Need to think about it...
Signed-off-by: Antoine THEBAUD <antoine.thebaud@yahoo.fr>
Signed-off-by: Antoine THEBAUD <antoine.thebaud@yahoo.fr>
66cc498
to
1183060
Compare
… issue.. Signed-off-by: Antoine THEBAUD <antoine.thebaud@yahoo.fr>
1183060
to
26e3b29
Compare
@@ -11,8 +11,6 @@ | |||
// See the License for the specific language governing permissions and | |||
// limitations under the License. | |||
|
|||
import { replaceVariable } from '@perses-dev/plugin-system'; |
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.
This import was causing an issue with Jest:
FAIL src/utils/utils.test.ts
● Test suite failed to run
TypeError: Cannot read properties of undefined (reading 'install')
24 | import { getFormattedAxis } from '../utils';
25 |
> 26 | use([EChartsBarChart, GridComponent, DatasetComponent, TitleComponent, TooltipComponent, CanvasRenderer]);
| ^
27 |
28 | const BAR_WIN_WIDTH = 14;
29 | const BAR_GAP = 6;
at use (../node_modules/echarts/lib/extension.js:109:7)
at ../node_modules/echarts/lib/extension.js:96:7
at Array.forEach (<anonymous>)
at each (../node_modules/echarts/node_modules/zrender/lib/core/util.js:205:13)
at use (../node_modules/echarts/lib/extension.js:95:5)
at Object.<anonymous> (../components/src/BarChart/BarChart.tsx:26:4)
at Object.<anonymous> (../components/src/BarChart/index.ts:17:14)
at Object.<anonymous> (../components/src/index.ts:18:14)
at Object.<anonymous> (../plugin-system/src/components/CalculationSelector/CalculationSelector.tsx:24:21)
at Object.<anonymous> (../plugin-system/src/components/CalculationSelector/index.ts:17:14)
at Object.<anonymous> (../plugin-system/src/components/index.ts:17:14)
at Object.<anonymous> (../plugin-system/src/index.ts:17:14)
at Object.<anonymous> (src/utils/utils.ts:37:23)
at Object.<anonymous> (src/utils/utils.test.ts:17:16)
This was due to the fact that Jest doesn't support tree shaking, about that see
- can jest support tree-shaking jestjs/jest#11230
- https://dev.to/fogel/potential-issues-with-barrel-files-in-jest-1nkl
The location change here is just a way to work around the issue, it's actually surprising that we didnt face it earlier already..
Description
With #2344 I missed the fact that prometheus-specific builtin variables (
$__interval
,$__rate_interval
..) aren't getting replaced by proper values with the current logic.. Thus any query containing such variable is producing an error (prometheus cannot parse this perses-specific syntax). This PR aims to fix that.Checklist
[<catalog_entry>] <commit message>
naming convention using one of thefollowing
catalog_entry
values:FEATURE
,ENHANCEMENT
,BUGFIX
,BREAKINGCHANGE
,DOC
,IGNORE
.UI Changes
See Storybook
and e2e docs for more details. Common issues
include: