mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -06:00
Logs: Let level
label take precedence over detected_level
(#96678)
This commit is contained in:
parent
bf74b9c9c0
commit
f44bc2bfd8
@ -45,7 +45,7 @@ export function parseLegacyLogsFrame(frame: DataFrame): LogsFrame | null {
|
||||
}
|
||||
|
||||
const timeNanosecondField = cache.getFieldByName('tsNs') ?? null;
|
||||
const severityField = cache.getFieldByName('detected_level') ?? cache.getFieldByName('level') ?? null;
|
||||
const severityField = cache.getFieldByName('level') ?? cache.getFieldByName('detected_level') ?? null;
|
||||
const idField = cache.getFieldByName('id') ?? null;
|
||||
|
||||
// extracting the labels is done very differently for old-loki-style and simple-style
|
||||
|
@ -426,7 +426,7 @@ export function logSeriesToLogsModel(
|
||||
}
|
||||
|
||||
let logLevel = LogLevel.unknown;
|
||||
const logLevelKey = (logLevelField && logLevelField.values[j]) || (labels?.detected_level ?? labels?.level);
|
||||
const logLevelKey = (logLevelField && logLevelField.values[j]) || (labels?.level ?? labels?.detected_level);
|
||||
if (typeof logLevelKey === 'number' || typeof logLevelKey === 'string') {
|
||||
logLevel = getLogLevelFromKey(logLevelKey);
|
||||
} else {
|
||||
@ -643,7 +643,7 @@ function defaultExtractLevel(dataFrame: DataFrame): LogLevel {
|
||||
}
|
||||
|
||||
function getLogLevelFromLabels(labels: Labels): LogLevel {
|
||||
const level = labels['detected_level'] ?? labels['level'] ?? labels['lvl'] ?? labels['loglevel'] ?? '';
|
||||
const level = labels['level'] ?? labels['detected_level'] ?? labels['lvl'] ?? labels['loglevel'] ?? '';
|
||||
return level ? getLogLevelFromKey(level) : LogLevel.unknown;
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ export function extractLevelLikeLabelFromDataFrame(frame: DataFrame): string | n
|
||||
// Find first level-like label
|
||||
for (let labels of labelsArray) {
|
||||
const label = Object.keys(labels).find(
|
||||
(label) => label === 'detected_level' || label === 'level' || label === 'lvl' || label.includes('level')
|
||||
(label) => label === 'level' || label === 'detected_level' || label === 'lvl' || label.includes('level')
|
||||
);
|
||||
if (label) {
|
||||
levelLikeLabel = label;
|
||||
|
Loading…
Reference in New Issue
Block a user