mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Loki: Visually distinguish error logs for LogQL2 (#28359)
* Loki: Add errored logs and update UI * Update messaging * Add icon and tooltip for errored logs * Update name of variable for more semantic meaning * Add tests * Update test * Refactor, remove unnecessary state * Update packages/grafana-data/src/types/logs.ts * Update packages/grafana-ui/src/components/Logs/LogDetails.tsx Co-authored-by: Giordano Ricci <gio.ricci@grafana.com> Co-authored-by: Giordano Ricci <gio.ricci@grafana.com>
This commit is contained in:
@@ -419,11 +419,22 @@ export function logSeriesToLogsModel(logSeries: DataFrame[]): LogsModel | undefi
|
||||
// Hack to print loki stats in Explore. Should be using proper stats display via drawer in Explore (rework in 7.1)
|
||||
let totalBytes = 0;
|
||||
const queriesVisited: { [refId: string]: boolean } = {};
|
||||
// To add just 1 error message
|
||||
let errorMetaAdded = false;
|
||||
|
||||
for (const series of logSeries) {
|
||||
const totalBytesKey = series.meta?.custom?.lokiQueryStatKey;
|
||||
const { refId } = series; // Stats are per query, keeping track by refId
|
||||
|
||||
if (!errorMetaAdded && series.meta?.custom?.error) {
|
||||
meta.push({
|
||||
label: '',
|
||||
value: series.meta?.custom.error,
|
||||
kind: LogsMetaKind.Error,
|
||||
});
|
||||
errorMetaAdded = true;
|
||||
}
|
||||
|
||||
if (refId && !queriesVisited[refId]) {
|
||||
if (totalBytesKey && series.meta?.stats) {
|
||||
const byteStat = series.meta.stats.find(stat => stat.displayName === totalBytesKey);
|
||||
|
||||
Reference in New Issue
Block a user