Explore: query transactions

Existing querying was grouped together before handed over to the
datasource. This slowed down result display to however long the slowest
query took.

- create one query transaction per result viewer (graph, table, etc.)
  and query row
- track latencies for each transaction
- show results as soon as they are being received
- loading indicator on graph and query button to indicate that queries
  are still running and that results are incomplete
- properly discard transactions when removing or changing queries
This commit is contained in:
David Kaltschmidt
2018-10-22 17:51:42 +02:00
parent e761fb1936
commit 2e02a8c855
10 changed files with 484 additions and 211 deletions

View File

@@ -3,6 +3,11 @@ interface ExploreDatasource {
label: string;
}
export interface HistoryItem {
ts: number;
query: string;
}
export interface Range {
from: string;
to: string;
@@ -13,6 +18,18 @@ export interface Query {
key?: string;
}
export interface QueryTransaction {
id: string;
done: boolean;
error?: string;
latency: number;
options: any;
query: string;
result?: any; // Table / Timeseries / Logs
resultType: string;
rowIndex: number;
}
export interface TextMatch {
text: string;
start: number;
@@ -27,34 +44,26 @@ export interface ExploreState {
datasourceMissing: boolean;
datasourceName?: string;
exploreDatasources: ExploreDatasource[];
graphResult: any;
history: any[];
latency: number;
loading: any;
logsResult: any;
graphRange: Range;
history: HistoryItem[];
/**
* Initial rows of queries to push down the tree.
* Modifications do not end up here, but in `this.queryExpressions`.
* The only way to reset a query is to change its `key`.
*/
queries: Query[];
/**
* Errors caused by the running the query row.
*/
queryErrors: any[];
/**
* Hints gathered for the query row.
*/
queryHints: any[];
queryTransactions: QueryTransaction[];
range: Range;
requestOptions: any;
showingGraph: boolean;
showingLogs: boolean;
showingTable: boolean;
supportsGraph: boolean | null;
supportsLogs: boolean | null;
supportsTable: boolean | null;
tableResult: any;
}
export interface ExploreUrlState {