mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore: Fix how log bars in graph are stacking (#19015)
This commit is contained in:
@@ -24,6 +24,7 @@ import {
|
||||
} from '@grafana/data';
|
||||
import { getThemeColor } from 'app/core/utils/colors';
|
||||
import { hasAnsiCodes } from 'app/core/utils/text';
|
||||
import { sortInAscendingOrder } from 'app/core/utils/explore';
|
||||
import { getGraphSeriesModel } from 'app/plugins/panel/graph2/getGraphSeriesModel';
|
||||
|
||||
export const LogLevelColor = {
|
||||
@@ -106,7 +107,8 @@ export function makeSeriesForLogs(rows: LogRowModel[], intervalMs: number): Grap
|
||||
const bucketSize = intervalMs * 10;
|
||||
const seriesList: any[] = [];
|
||||
|
||||
for (const row of rows) {
|
||||
const sortedRows = rows.sort(sortInAscendingOrder);
|
||||
for (const row of sortedRows) {
|
||||
let series = seriesByLevel[row.logLevel];
|
||||
|
||||
if (!series) {
|
||||
@@ -120,8 +122,9 @@ export function makeSeriesForLogs(rows: LogRowModel[], intervalMs: number): Grap
|
||||
seriesList.push(series);
|
||||
}
|
||||
|
||||
// align time to bucket size
|
||||
const time = Math.round(row.timeEpochMs / bucketSize) * bucketSize;
|
||||
// align time to bucket size - used Math.floor for calculation as time of the bucket
|
||||
// must be in the past (before Date.now()) to be displayed on the graph
|
||||
const time = Math.floor(row.timeEpochMs / bucketSize) * bucketSize;
|
||||
|
||||
// Entry for time
|
||||
if (time === series.lastTs) {
|
||||
|
||||
Reference in New Issue
Block a user