- adds a custom label renderer to Logs viewer in Explore
- labels are no longer treated as strings, they are passed as parsed objects to the log row
- label renderer supports onClick handler for an action
- renamed Explore's `onClickTableCell` to `onClickLabel` and wired up log label renderers
- reuse Prometheus `addLabelToSelector` to modify Logging queries via click on label
- added tests to `addLabelToSelector`, changed to include the surrounding `{}`
- use label render also for common labels in the controls panel
- logging meta data section has now a custom renderer that can render numbers, strings, and labels
- style adjustments
- since the DataQuery rewrite, Explore starts by submitting its queries (Explore cant know if the queries are emtpty)
- The datasource intercepts an empty query and returns an empty list of time series, and also no table for the table query.
- The query hinter then received no series to analyse and was not guarding against this.
- This PR adds this guard.
- Queries in Explore have been string based
- This PR introduces the use of the DataQuery type to denote all queries handled in Explore
- Within Explore all handling of DataQueries is transparent
- Modifying DataQueries is left to the datasource
- Using `target` as variable names for DataQueries to be consistent with the rest of Grafana
Rules expansion (available via query hints in explore) was broken for expressions that contained selectors.
- fix replacing regexp to recognize `{` and `[` as the end of a rule name
- moved logic to language utils
- added tests
Explore is about keeping context between datasources if possible. When
changing from metrics to logging, some of the filtering can be kept to
narrow down logging streams relevant to the metrics.
- adds `importQueries` function in language providers
- query import dependent on origin datasource
- implemented prometheus-to-logging import: keeping label selectors
that are common to both datasources
- added types
Tab completion gets in the way when constructing a query from the inside
out:
```
up| => |up => sum(|up)
```
At that point the language provider will not suggest anything.
In aggregation contexts using the alternate syntax form, labels will
precede metrics. A cursor at the label position cannot provide
meaningful suggestions unless a metric is specified. In the latter case,
no suggestions are presented at all.
Related: #13690
- changed `start()` to return promise on main language feature task
- promise resolves to list of secondary tasks
- speeds up time to interaction of metric selector
- lazy loading of certain metric selector and log label selector items
- loading indication of metric and log label selectors
this is a fix-up PR that cleans up Explore Logging after the recent
restructuring.
- log results need to be merged since query transactions have been
introduced
- logging DS has its own language provider, query field, and start page
(some of them based on prometheus components)
- added loader animation to log viewer
- removed logging logic from prometheus components
- when instantiating a datasource, the datasource service checks if the
plugin module exports Explore components, and if so, attaches them to
the datasource
- Explore component makes all major internal pluggable from a datasource
`exploreComponents` property
- Moved Prometheus query field to promehteus datasource and registered
it as an exported Explore component
- Added new Start page for Explore, also exported from the datasource
The grafana_stats.json used the following prometheus query: "increase(grafana_alerting_result_total[1m])" But a metric called "grafana_alerting_result_total" is currently not there anymore. So i changed the query to "increase(grafana_alerting_active_alerts[1m])" and updated the title as well (Before: "Grafana alert results", Now: "Grafana active alerts").
Implements rudimentary support for placeholder values inside a string
with the `PlaceholdersBuffer` class. The latter helps the newly added
sum aggregation query suggestion to automatically focus on the label
so users can easily choose from the available typeahead options.
Related: #13615
No label suggestions were being returned for multi-line aggregation
contexts because the parsed selector string does not see the full
context before a `by` or `without` clause.
This solution stitches together all text nodes that comprise the query
editor to ensure the selector has sufficient context to generate
suggestions.
Also, an additional workaround has been included to ensure range vector
syntax does not disrupt label suggestions in aggregation contexts.
Related: #12890