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
b05e7aae
Unverified
Commit
b05e7aae
authored
Dec 22, 2018
by
David
Committed by
GitHub
Dec 22, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14636 from grafana/davkal/fix-14635
Loki: fix timestamp field
parents
b2401e37
d1dec8bd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
9 deletions
+12
-9
public/app/core/logs_model.ts
+3
-1
public/app/plugins/datasource/loki/result_transformer.test.ts
+4
-4
public/app/plugins/datasource/loki/result_transformer.ts
+5
-4
No files found.
public/app/core/logs_model.ts
View file @
b05e7aae
...
...
@@ -81,7 +81,9 @@ export interface LogsStream {
export
interface
LogsStreamEntry
{
line
:
string
;
timestamp
:
string
;
ts
:
string
;
// Legacy, was renamed to ts
timestamp
?:
string
;
}
export
interface
LogsStreamLabels
{
...
...
public/app/plugins/datasource/loki/result_transformer.test.ts
View file @
b05e7aae
...
...
@@ -99,7 +99,7 @@ describe('mergeStreamsToLogs()', () => {
entries
:
[
{
line
:
'WARN boooo'
,
t
imestamp
:
'1970-01-01T00:00:00Z'
,
t
s
:
'1970-01-01T00:00:00Z'
,
},
],
};
...
...
@@ -120,7 +120,7 @@ describe('mergeStreamsToLogs()', () => {
entries
:
[
{
line
:
'WARN boooo'
,
t
imestamp
:
'1970-01-01T00:00:01Z'
,
t
s
:
'1970-01-01T00:00:01Z'
,
},
],
};
...
...
@@ -129,11 +129,11 @@ describe('mergeStreamsToLogs()', () => {
entries
:
[
{
line
:
'INFO 1'
,
t
imestamp
:
'1970-01-01T00:00:00Z'
,
t
s
:
'1970-01-01T00:00:00Z'
,
},
{
line
:
'INFO 2'
,
t
imestamp
:
'1970-01-01T00:00:02Z'
,
t
s
:
'1970-01-01T00:00:02Z'
,
},
],
};
...
...
public/app/plugins/datasource/loki/result_transformer.ts
View file @
b05e7aae
...
...
@@ -116,10 +116,11 @@ export function processEntry(
uniqueLabels
:
LogsStreamLabels
,
search
:
string
):
LogRow
{
const
{
line
,
timestamp
}
=
entry
;
const
{
line
}
=
entry
;
const
ts
=
entry
.
ts
||
entry
.
timestamp
;
// Assumes unique-ness, needs nanosec precision for timestamp
const
key
=
`EK
${
t
imestamp
}${
labels
}
`
;
const
time
=
moment
(
t
imestamp
);
const
key
=
`EK
${
t
s
}${
labels
}
`
;
const
time
=
moment
(
t
s
);
const
timeEpochMs
=
time
.
valueOf
();
const
timeFromNow
=
time
.
fromNow
();
const
timeLocal
=
time
.
format
(
'YYYY-MM-DD HH:mm:ss'
);
...
...
@@ -135,7 +136,7 @@ export function processEntry(
entry
:
line
,
labels
:
parsedLabels
,
searchWords
:
search
?
[
search
]
:
[],
timestamp
:
t
imestamp
,
timestamp
:
t
s
,
};
}
...
...
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