[v10.0.x] Elasticsearch: Fix histogram colors in backend mode (#71447)
Elasticsearch: Fix histogram colors in backend mode (#71442)
elastic: backend-mode: fix histogram colors
(cherry picked from commit fdb8257007)
This commit is contained in:
@@ -32,6 +32,7 @@ import {
|
||||
Field,
|
||||
LogRowContextQueryDirection,
|
||||
LogRowContextOptions,
|
||||
FieldType,
|
||||
} from '@grafana/data';
|
||||
import { BackendSrvRequest, DataSourceWithBackend, getBackendSrv, getDataSourceSrv, config } from '@grafana/runtime';
|
||||
import { queryLogsVolume } from 'app/core/logsModel';
|
||||
@@ -683,7 +684,7 @@ export class ElasticDatasource
|
||||
{
|
||||
range: request.range,
|
||||
targets: request.targets,
|
||||
extractLevel: (dataFrame) => getLogLevelFromKey(dataFrame.name || ''),
|
||||
extractLevel,
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -1282,3 +1283,9 @@ function createContextTimeRange(rowTimeEpochMs: number, direction: string, inter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function extractLevel(dataFrame: DataFrame): LogLevel {
|
||||
const valueField = dataFrame.fields.find((f) => f.type === FieldType.number);
|
||||
const name = valueField?.labels?.['level'] ?? '';
|
||||
return getLogLevelFromKey(name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user