* init: feature work
* chore: i18n
* feat: add run query + keyboard shortcuts
* chore: i18n
* chore: initial query formatted
* chore: resolve some issues
* chore: a bit of refactor to clean it up
---------
Co-authored-by: Kristina Durivage <kristina.durivage@grafana.com>
* First draft autocomplete
* Better naming
* Change suggestion to table/column population
* Remove all suggestions, just use table/column population but trigger on space
* Gate feature flag behind a feature flag
* Reorganize and add function list
* Add blurb about autocomplete to docs
* Update public/app/features/expressions/utils/metaSqlExpr.ts
Co-authored-by: Alex Spencer <52186778+alexjonspencer1@users.noreply.github.com>
* Add try catch, remove promise resolve
---------
Co-authored-by: Alex Spencer <52186778+alexjonspencer1@users.noreply.github.com>
* feat: reconfigure expression button for improved UX
* chore: fix broken test
* chore: refactor to use improved UX + combine another UI PR.
* chore: i18n
* chore: memoize options + add data test ids for tracking
* chore: common component for expression dropdown
* chore: streamline common component
* chore: add event tracking
* chore: put event tracking in its own PR
Initial support for alerting with SQL expressions
- When `format` is set to `alerting`, SQL expressions output in a format suitable for alerting evaluation.
- Outstanding TODOs:
- Deduplicate output rows
- Add more tests
- Fix broken alerting UI rendering (likely due to shape change to undocumented full-long format)
- Basic usage:
- SQL must return one numeric column and one or more string columns.
- Each row may become an alert.
- The alert fires if the numeric value is non-zero.
- String columns are treated as labels.
---------
Co-authored-by: Konrad Lalik <konradlalik@gmail.com>
Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
Co-authored-by: Sam Jewell <sam.jewell@grafana.com>
* SQL Expressions: Add syntax highlighting and autocomplete
Here we add syntax highlighting and autocomplete for MySQL dialect of
SQL. We don't yet have the full functionality that other SQL monaco
editors have, namely
- No autocomplete of table or column names
- No autoformatting yet (meaning no formatting of template variables)
But this is a vast improvement already. The above improvements can come
later - they are slightly harder to do.
* Improvements, based on review from LLM
* Resizeable SQL expressions text-area
Generated by an LLM for me - we'll see. It expands quite large on first
page-load
* Switch to useLayoutEffect to avoid visual flashing
* Get the LLM to rewrite the approach, inspired by InfluxDB
The Influx DB text-area is also resizable vertically, but that one isn't
a Monaco editor (we need to tell Monaco to update its own size when the
outer div is resized), so this is necessarily a little more complex than
Influx. But still this approach looks simpler: The Javascript here is
shorter
* Start at 240px, to match the current default size
Question: Is there a better approach to achieve this?
* Don't clip the bottom border of the Monaco editor
* Fix linting errors
* update eslint, tsconfig + esbuild to handle new jsx transform
* remove thing that breaks the new jsx transform
* remove react imports
* adjust grafana-icons build
* is this the correct syntax?
* try this
* well this was much easier than expected...
* change grafana-plugin-configs webpack config
* fixes
* fix lockfile
* fix 2 more violations
* use path.resolve instead of require.resolve
* remove react import
* fix react imports
* more fixes
* remove React import
* remove import React from docs
* remove another react import
Backend:
* Update the Grafana Alerting engine to provide feedback to HysteresisCommand. The feedback information is stored in state.Manager as a fingerprint of each state. The fingerprint is persisted to the database. Only fingerprints that belong to Pending and Alerting states are considered as "loaded" and provided back to the command.
- add ResultFingerprint to state.State. It's different from other fingerprints we store in the state because it is calculated from the result labels.
- add rule_fingerprint column to alert_instance
- update alerting evaluator to accept AlertingResultsReader via context, and update scheduler to provide it.
- add AlertingResultsFromRuleState that implements the new interface in eval package
- update getExprRequest to patch the hysteresis command.
* Only one "Recovery Threshold" query is allowed to be used in the alert rule and it must be the Condition.
Frontend:
* Add hysteresis option to Threshold in UI. It's called "Recovery Threshold"
* Add test for getUnloadEvaluatorTypeFromCondition
* Hide hysteresis in panel expressions
* Refactor isInvalid and add test for it
* Remove unnecesary React.memo
* Add tests for updateEvaluatorConditions
---------
Co-authored-by: Sonia Aguilar <soniaaguilarpeiron@gmail.com>
* grafana/ui: Move Stack out of unstable
* grafana/ui: Replace imports
* Replace the import from experimental
* Cleanup
* Remove invalid prop
* Add flexGrow
* Remove Stack used in Field
* Remove import
* Show description for each expression type in the body and change widht depending on the type
* Move condition indicator to the header
* Make order of fields in expressions to be consistent for each expression type
* Add tooltip for expression type menu
* Update styles depending on the expression type
* Update styles and move add query button under queries
* Add NeedHelpInfo component
* Adress PR review comments
* Apply description updates from #70540
* Rename gelTypes to expressionTypes
* Update layout for expressions according to the real usecases
* Update footer to include series count in all expressions
---------
Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
* Revert: QueryEditor components from grafana-ui
* Use local version of experimental
* Use experimental for query editor components
* Fix type issues in MSSQL
* point to actual version of experimental package
* point to latest version of experimental
Co-authored-by: Erik Sundell <erik.sundell87@gmail.com>
* implement filterQuery to support query.hide
* Fixed - expression ds name in mixed mode
* Execute expression query on blur
* show actual error message when ds return Query data error