Skip to content

Commit

Permalink
fix query builder for alerting rules (#137)
Browse files Browse the repository at this point in the history
* properly process requests from Grafana's unified alerting tab
* avoid cyclic calls to `/api/v1/eval`
  • Loading branch information
dmitryk-dk authored Jan 30, 2024
1 parent ef5cfe6 commit 6fae1df
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
## tip

* BUGFIX: fix the default link to vmui. See [this issue](https://github.com/VictoriaMetrics/grafana-datasource/issues/132)
* BUGFIX: fix the parsing logic in `renderLegendFormat` to correctly replace legend label names. See [this issue](https://github.com/VictoriaMetrics/grafana-datasource/issues/133)
* BUGFIX: fix query editor which produce a lot of requests for alerting rule evaluation. See [this issue](https://github.com/VictoriaMetrics/grafana-datasource/issues/134)

## [v0.5.1](https://github.com/VictoriaMetrics/grafana-datasource/releases/tag/v0.5.1)

* BUGFIX: fix query builder logic to correctly parse metric names with dots. See [this issue](https://github.com/VictoriaMetrics/grafana-datasource/issues/128)
* BUGFIX: fix the parsing logic in `renderLegendFormat` to correctly replace legend label names. See [this issue](https://github.com/VictoriaMetrics/grafana-datasource/issues/133)

## [v0.5.0](https://github.com/VictoriaMetrics/grafana-datasource/releases/tag/v0.5.0)

Expand Down
2 changes: 1 addition & 1 deletion packages/lezer-metricsql/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lezer-metricsql",
"version": "0.1.0",
"version": "0.1.1",
"main": "index.cjs",
"type": "module",
"exports": {
Expand Down
4 changes: 2 additions & 2 deletions src/components/PromQueryField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import React, { ReactNode } from 'react';
import { Plugin } from 'slate';
import { Editor } from 'slate-react';

import { CoreApp, isDataFrame, QueryEditorProps, QueryHint, TimeRange, toLegacyResponseData } from '@grafana/data';
import { isDataFrame, QueryEditorProps, QueryHint, TimeRange, toLegacyResponseData } from '@grafana/data';
import {
BracesPlugin,
Icon,
Expand Down Expand Up @@ -263,7 +263,7 @@ class PromQueryField extends React.PureComponent<PromQueryFieldProps, PromQueryF

<div className="gf-form gf-form--grow flex-shrink-1 min-width-15">
<MonacoQueryFieldWrapper
runQueryOnBlur={this.props.app !== CoreApp.Explore}
runQueryOnBlur={false}
languageProvider={datasource.languageProvider}
history={history}
onChange={this.onChangeQuery}
Expand Down
6 changes: 4 additions & 2 deletions src/querybuilder/components/PromQueryEditorSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ export const PromQueryEditorSelector = React.memo<Props>((props) => {
const withTemplates = getArrayFromTemplate(templateByDashboard)
datasource.languageProvider = new PrometheusLanguageProvider(datasource, { withTemplates })
datasource.languageProvider.start()
onRunQuery()
}, [onRunQuery, datasource, templateByDashboard])
if (app !== CoreApp.UnifiedAlerting){
onRunQuery();
}
}, [onRunQuery, datasource, templateByDashboard, app])

return (
<>
Expand Down

0 comments on commit 6fae1df

Please sign in to comment.