mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 00:25:46 -06:00
Elasticsearch: Make it compatible with the new log context functionality (#70697)
* elastic: make it work with the new logs-context * add remaining fields * lint fix
This commit is contained in:
parent
2738a3a6da
commit
8e9ec9dcef
@ -7,6 +7,7 @@ import {
|
|||||||
DataQueryRequest,
|
DataQueryRequest,
|
||||||
DataQueryResponse,
|
DataQueryResponse,
|
||||||
dateTime,
|
dateTime,
|
||||||
|
ensureTimeField,
|
||||||
Field,
|
Field,
|
||||||
LogRowContextOptions,
|
LogRowContextOptions,
|
||||||
LogRowContextQueryDirection,
|
LogRowContextQueryDirection,
|
||||||
@ -134,12 +135,13 @@ export class LegacyQueryRunner {
|
|||||||
*/
|
*/
|
||||||
const timestampField = dataFrame.fields.find((f: Field) => f.name === this.datasource.timeField);
|
const timestampField = dataFrame.fields.find((f: Field) => f.name === this.datasource.timeField);
|
||||||
const lineField = dataFrame.fields.find((f: Field) => f.name === this.datasource.logMessageField);
|
const lineField = dataFrame.fields.find((f: Field) => f.name === this.datasource.logMessageField);
|
||||||
|
const otherFields = dataFrame.fields.filter((f: Field) => f !== timestampField && f !== lineField);
|
||||||
if (timestampField && lineField) {
|
if (timestampField && lineField) {
|
||||||
return {
|
return {
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
...dataFrame,
|
...dataFrame,
|
||||||
fields: [...dataFrame.fields, { ...timestampField, name: 'ts' }, { ...lineField, name: 'line' }],
|
fields: [ensureTimeField(timestampField), lineField, ...otherFields],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user