Elasticsearch: Support rendering in logs panel (#20229)

* Elasticsearch: Support rendering in logs panel

- add "Logs" metric query type so panels can inform the datasource that
the query is a logs query
- datasource modifies target when metric query type `logs` is detected
- then existing log result processeing paths are followed

* Fix failing test, number of agg types changed
This commit is contained in:
David
2019-11-07 12:13:24 +00:00
committed by GitHub
parent 4d7d13175c
commit a499586f15
3 changed files with 12 additions and 5 deletions

View File

@@ -332,9 +332,11 @@ export class ElasticDatasource extends DataSourceApi<ElasticsearchQuery, Elastic
}
let queryObj;
if (target.isLogsQuery) {
if (target.isLogsQuery || queryDef.hasMetricOfType(target, 'logs')) {
target.bucketAggs = [queryDef.defaultBucketAgg()];
target.metrics = [queryDef.defaultMetricAgg()];
// Setting this for metrics queries that are typed as logs
target.isLogsQuery = true;
queryObj = this.queryBuilder.getLogsQuery(target, queryString);
} else {
if (target.alias) {