Commit Graph

339 Commits

Author SHA1 Message Date
Torkel Ödegaard
705cbb4095 Minor cleanup now that angular panel edit is no longer 2018-12-17 21:29:25 +01:00
Torkel Ödegaard
8497c854f6 Adding mixed query 2018-12-12 08:54:12 +01:00
Torkel Ödegaard
eb6d0e9f51 Merge branch 'master' into develop 2018-12-07 14:59:38 +01:00
David Kaltschmidt
c0c06e4dd8 Prometheus: Make result transformer more robust for empty responses
- some prometheus-compatible backends may return `null` instead of empty lists
- test for lists before iterating
- added tests for empty responses
2018-12-07 11:22:55 +01:00
Torkel Ödegaard
180ca021b5 Merge branch 'master' into develop 2018-12-05 10:17:22 +01:00
Torkel Ödegaard
401b470ebb added max-widths to explore start pages boxes 2018-12-04 15:06:30 +01:00
Torkel Ödegaard
1fddb6144d fixed promql and loggging syntax so all punctuation chars are treated the same, remove hover move 2018-12-04 14:57:01 +01:00
Torkel Ödegaard
47523f80dd fixed logging start page 2018-12-04 12:59:24 +01:00
Torkel Ödegaard
1283a3292d fixed grabage in markup 2018-12-04 10:16:51 +01:00
Torkel Ödegaard
44414c4346 Misc styling fixes to explore: start page, slate code editor colors, text highlight in auto completeter suggestion 2018-12-03 17:20:02 +01:00
Erik Sundell
d9236c1081 add table support flag for prometheus 2018-11-29 10:39:24 +01:00
David Kaltschmidt
c3b67f3a13 Explore: Logging label filtering
- 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
2018-11-28 14:20:10 +01:00
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