Commit Graph

327 Commits

Author SHA1 Message Date
David Kaltschmidt
91ea8dccf5 Explore: Fix JS error when switching between 2 prometheus datasources
- 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.
2018-11-26 13:43:22 +01:00
Torkel Ödegaard
efcbb92b3f
Merge pull request #14170 from grafana/davkal/explore-prometheus-range-sort
Sort Prometheus range suggestions by length
2018-11-23 19:22:24 +01:00
David Kaltschmidt
575d888472 Fix tests to account for sortText 2018-11-23 16:53:46 +01:00
David Kaltschmidt
f831836fa7 Explore: make query field suggestions more robust
- drop invalid history items
- make highlighter more robust by defaulting to empty string on text to highlight
2018-11-23 12:25:43 +01:00
David Kaltschmidt
ecaee88efe Sort Prometheus range suggestions by length
- add sortText property to range completion items
2018-11-23 11:43:21 +01:00
David Kaltschmidt
bbaa5b63c8 Fix history rendering for DataQuery 2018-11-22 11:02:53 +01:00
David Kaltschmidt
331d419d4f Combine query functions 2018-11-21 17:21:13 +01:00
David Kaltschmidt
22987ee75f Renamed targets to queries 2018-11-21 16:28:30 +01:00
David Kaltschmidt
b3161bea5a Explore: Introduce DataQuery interface for query handling
- 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
2018-11-21 14:45:57 +01:00
David
c20c787b62
Merge pull request #14104 from grafana/davkal/prometheus-rule-expansion
Prometheus: fix rules expansion
2018-11-19 15:11:09 +00:00
David
634d71a657
Merge pull request #14052 from grafana/davkal/explore-query-importer
Explore: POC for datasource query importers
2018-11-16 14:55:19 +00:00
David Kaltschmidt
e3e8be16b3 Prometheus: fix rules expansion
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
2018-11-16 14:38:20 +00:00
David Kaltschmidt
411719bc70 Explore: POC for datasource query importers
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
2018-11-16 13:52:58 +00:00
David Kaltschmidt
ce59acd141 Extracted language provider variables for readibility 2018-11-15 11:20:27 +00:00
David Kaltschmidt
ff0ed06441 Explore: Don't suggest term items when text follows
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.
2018-11-12 17:40:05 +00:00
Michael Huynh
22b8b04dbe
Preserve suffix text when applying function suggestion
Updates all PromQL function-like suggestions to omit parentheses
when inserted. Such insertions also preserve any suffix text.

Related: #13885
2018-11-09 20:43:20 +08:00
David
0df14f3fa8
Merge pull request #13927 from grafana/davkal/explore-start-task
Explore: fix metric selector for additional rows
2018-11-05 12:30:02 +01:00
Michael Huynh
f79b790ef6
Add tests covering alternate syntax for aggregation contexts
Related: #13690
2018-11-03 08:07:08 +08:00
Michael Huynh
5e748243af
Handle suggestions for alternate syntax aggregation contexts
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
2018-11-03 07:56:13 +08:00
David Kaltschmidt
edd575b552 Explore: fix metric selector for additional rows
- race condition in language provider leads to only one row getting
  selector options
- fixed by always returning the start task promise
2018-11-01 09:46:05 +01:00
David Kaltschmidt
4f959648a7 Explore: async starts of language provider
- 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
2018-10-31 17:53:28 +01:00
David Kaltschmidt
c92f5462fe Explore: repair logging after code restructuring
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
2018-10-30 16:35:49 +01:00
David
758ec4bc70
Merge pull request #13844 from grafana/davkal/explore-empty-page
Explore: Pluggable components from datasource plugins
2018-10-30 14:54:34 +01:00
David Kaltschmidt
cf19ecc8f5 Make Explore plugin exports explicit 2018-10-30 14:38:34 +01:00
David Kaltschmidt
d0776937b5 Pluggable components from datasource plugins
- 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
2018-10-29 15:14:36 +01:00
Sebastian
85aed0276e
Update grafana_stats.json
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").
2018-10-29 12:05:24 +01:00
David
121ac93d08
Merge pull request #13847 from miqh/fix/multi-line-aggregation
Fix label suggestions inside multi-line aggregation contexts
2018-10-28 18:05:31 +01:00
David Kaltschmidt
9245dad53e Fix query hint tests after refactor 2018-10-28 17:48:17 +01:00
Michael Huynh
d1d5e9f7d3
Add tests to cover PlaceholdersBuffer and sum hint
Related: #13615
2018-10-28 21:07:40 +08:00
Michael Huynh
c255b5da11
Add sum aggregation query suggestion
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
2018-10-28 21:03:39 +08:00
Michael Huynh
61843b58db
Add tests to cover aggregation context cases
This should cover use cases involving multi-line queries and range
vector syntax inside aggregation contexts.

Related: #12890
2018-10-27 17:02:03 +08:00
Michael Huynh
2a4a19388f
Fix label suggestions for multi-line aggregation queries
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
2018-10-27 16:54:12 +08:00
David Kaltschmidt
6f2315d5c5 Moved prom language features to datasource language provider 2018-10-25 12:24:24 +02:00
David Kaltschmidt
54a3e2d1d1 Added types to query rows 2018-10-24 14:55:56 +02:00
David Kaltschmidt
f19ffee5b4 Fix rebase, fix empty field still issuing query problem 2018-10-23 17:21:33 +02:00
David Kaltschmidt
fbed57ab43 Get query hints per query transaction 2018-10-23 16:10:52 +02:00
olshansky
91e201ffa8 fix: label values regex for single letter labels
Closes: #13641
2018-10-12 23:13:11 +03:00
praveensastry
61bbe280ed Remove duplicate labels in the datasource query 2018-10-09 15:34:58 +11:00
David Kaltschmidt
107bef2d6d Fix rate function hint for series with nulls 2018-10-04 16:32:32 +02:00
David
b0172427b1 Extract query hints 2018-10-04 16:27:18 +02:00
David Kaltschmidt
54c9beb146 Explore: jump to explore from panels with mixed datasources
- extends handlers for panel menu and keypress 'x'
- in a mixed-datasource panel finds first datasource that supports
  explore and collects its targets
- passes those targets to the found datasource to be serialized for
  explore state
- removed `supportMetrics` and `supportsExplore`
- use datasource metadata instead (set in plugin.json)
- Use angular timeout to wrap url change for explore jump
- Extract getExploreUrl into core/utils/explore
2018-10-01 12:03:57 +02:00
David Kaltschmidt
377bc44062 Explore: dont rate-hint on rate queries 2018-09-20 16:59:06 +02:00
David Kaltschmidt
6aac8610eb Explore: Fix click to filter for recording rule expressions
- recording rule names contain ':'
- include this in the pattern for metric names
2018-09-19 11:45:55 +02:00
Mitsuhiro Tanda
dc08093f6c minor fix 2018-09-13 20:15:33 +09:00
Mitsuhiro Tanda
3031c2e6fc fix test 2018-09-13 20:07:43 +09:00
Mitsuhiro Tanda
2926725bab add annotation option to treat series value as timestamp 2018-09-13 20:05:30 +09:00
David
e4496080ff
Merge pull request #12251 from mtanda/prometheus_use_matchers_for_completion
(prometheus) get label name/value from series API
2018-09-13 11:48:13 +02:00
David
a5bcd4b8e4 Adhoc-filtering for prometheus dashboards (#13212)
* Basic adhoc-filtering support for prometheus
2018-09-12 18:10:57 +02:00
David
d8a702cba3 Fix prometheus label filtering for comparison queries (#13213)
- Now supports click filtering for queries like `metric > 0.1`
2018-09-11 16:57:43 +02:00
Patrick O'Carroll
2b74b1c4d6 added radix rule and changed files to follow rule (#13153) 2018-09-05 16:51:31 +02:00