mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Elastic: Fix displaying of correct log message (#26020)
* Fix default field, remove redundant line field check * Add comments
This commit is contained in:
parent
b7792de16d
commit
8b46655361
@ -319,10 +319,7 @@ export function logSeriesToLogsModel(logSeries: DataFrame[]): LogsModel | undefi
|
||||
// Find the fields we care about and collect all labels
|
||||
const allSeries: LogFields[] = logSeries.map(series => {
|
||||
const fieldCache = new FieldCache(series);
|
||||
|
||||
const stringField = fieldCache.hasFieldNamed('line')
|
||||
? fieldCache.getFieldByName('line')
|
||||
: fieldCache.getFirstFieldOfType(FieldType.string);
|
||||
const stringField = fieldCache.getFirstFieldOfType(FieldType.string);
|
||||
if (stringField?.labels) {
|
||||
allLabels.push(stringField.labels);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ function constructDataFrame(
|
||||
refId,
|
||||
fields: [
|
||||
{ name: 'ts', type: FieldType.time, config: { displayName: 'Time' }, values: times }, // Time
|
||||
{ name: 'line', type: FieldType.string, config: {}, values: lines, labels }, // Line
|
||||
{ name: 'line', type: FieldType.string, config: {}, values: lines, labels }, // Line - needs to be the first field with string type
|
||||
{ name: 'id', type: FieldType.string, config: {}, values: uids },
|
||||
{ name: 'tsNs', type: FieldType.time, config: { displayName: 'Time ns' }, values: timesNs }, // Time
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user