Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
6f061ab1
Unverified
Commit
6f061ab1
authored
Dec 10, 2018
by
Torkel Ödegaard
Committed by
GitHub
Dec 10, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14403 from grafana/logs-graph-stacking
Fixed issue with logs graph and stacking
parents
6433ff4b
14cf846e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
38 deletions
+32
-38
public/app/core/logs_model.ts
+32
-17
public/app/features/explore/Logs.tsx
+0
-21
No files found.
public/app/core/logs_model.ts
View file @
6f061ab1
...
...
@@ -249,32 +249,47 @@ export function makeSeriesForLogs(rows: LogRow[], intervalMs: number): TimeSerie
// Graph time series by log level
const
seriesByLevel
=
{};
const
bucketSize
=
intervalMs
*
10
;
const
seriesList
=
[];
for
(
const
row
of
rows
)
{
if
(
!
seriesByLevel
[
row
.
logLevel
])
{
seriesByLevel
[
row
.
logLevel
]
=
{
lastTs
:
null
,
datapoints
:
[],
alias
:
row
.
logLevel
};
}
let
series
=
seriesByLevel
[
row
.
logLevel
];
if
(
!
series
)
{
seriesByLevel
[
row
.
logLevel
]
=
series
=
{
lastTs
:
null
,
datapoints
:
[],
alias
:
row
.
logLevel
,
color
:
LogLevelColor
[
row
.
logLevel
],
};
const
levelSeries
=
seriesByLevel
[
row
.
logLevel
];
seriesList
.
push
(
series
);
}
//
Bucket to nearest minut
e
//
align time to bucket siz
e
const
time
=
Math
.
round
(
row
.
timeEpochMs
/
bucketSize
)
*
bucketSize
;
// Entry for time
if
(
time
===
levelS
eries
.
lastTs
)
{
levelSeries
.
datapoints
[
levelS
eries
.
datapoints
.
length
-
1
][
0
]
++
;
if
(
time
===
s
eries
.
lastTs
)
{
series
.
datapoints
[
s
eries
.
datapoints
.
length
-
1
][
0
]
++
;
}
else
{
levelS
eries
.
datapoints
.
push
([
1
,
time
]);
levelS
eries
.
lastTs
=
time
;
s
eries
.
datapoints
.
push
([
1
,
time
]);
s
eries
.
lastTs
=
time
;
}
}
return
Object
.
keys
(
seriesByLevel
).
reduce
((
acc
,
level
)
=>
{
if
(
seriesByLevel
[
level
])
{
const
gs
=
new
TimeSeries
(
seriesByLevel
[
level
]);
gs
.
setColor
(
LogLevelColor
[
level
]);
acc
.
push
(
gs
);
// add zero to other levels to aid stacking so each level series has same number of points
for
(
const
other
of
seriesList
)
{
if
(
other
!==
series
&&
other
.
lastTs
!==
time
)
{
other
.
datapoints
.
push
([
0
,
time
]);
other
.
lastTs
=
time
;
}
}
return
acc
;
},
[]);
}
return
seriesList
.
map
(
series
=>
{
series
.
datapoints
.
sort
((
a
,
b
)
=>
{
return
a
[
1
]
-
b
[
1
];
});
return
new
TimeSeries
(
series
);
});
}
public/app/features/explore/Logs.tsx
View file @
6f061ab1
...
...
@@ -395,27 +395,6 @@ export default class Logs extends PureComponent<LogsProps, LogsState> {
}
}
// Grid options
// const cssColumnSizes = [];
// if (showDuplicates) {
// cssColumnSizes.push('max-content');
// }
// // Log-level indicator line
// cssColumnSizes.push('3px');
// if (showUtc) {
// cssColumnSizes.push('minmax(220px, max-content)');
// }
// if (showLocalTime) {
// cssColumnSizes.push('minmax(140px, max-content)');
// }
// if (showLabels) {
// cssColumnSizes.push('fit-content(20%)');
// }
// cssColumnSizes.push('1fr');
// const logEntriesStyle = {
// gridTemplateColumns: cssColumnSizes.join(' '),
// };
const
scanText
=
scanRange
?
`Scanning
${
rangeUtil
.
describeTimeRange
(
scanRange
)}
`
:
'Scanning...'
;
// React profiler becomes unusable if we pass all rows to all rows and their labels, using getter instead
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment