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
27dcd0ed
Commit
27dcd0ed
authored
Apr 30, 2019
by
Ryan McKinley
Committed by
Torkel Ödegaard
Apr 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TestData: add log level in dummy message (#16815)
parent
4beed358
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
6 deletions
+31
-6
public/app/plugins/datasource/testdata/StreamHandler.ts
+29
-4
public/app/plugins/datasource/testdata/partials/query.editor.html
+2
-2
No files found.
public/app/plugins/datasource/testdata/StreamHandler.ts
View file @
27dcd0ed
...
@@ -8,6 +8,7 @@ import {
...
@@ -8,6 +8,7 @@ import {
DataStreamObserver
,
DataStreamObserver
,
DataStreamState
,
DataStreamState
,
LoadingState
,
LoadingState
,
LogLevel
,
}
from
'@grafana/ui'
;
}
from
'@grafana/ui'
;
import
{
TestDataQuery
,
StreamingQuery
}
from
'./types'
;
import
{
TestDataQuery
,
StreamingQuery
}
from
'./types'
;
...
@@ -218,21 +219,44 @@ export class LogsWorker extends StreamWorker {
...
@@ -218,21 +219,44 @@ export class LogsWorker extends StreamWorker {
},
10
);
},
10
);
}
}
getRandomLogLevel
():
LogLevel
{
const
v
=
Math
.
random
();
if
(
v
>
0.9
)
{
return
LogLevel
.
critical
;
}
if
(
v
>
0.8
)
{
return
LogLevel
.
error
;
}
if
(
v
>
0.7
)
{
return
LogLevel
.
warning
;
}
if
(
v
>
0.4
)
{
return
LogLevel
.
info
;
}
if
(
v
>
0.3
)
{
return
LogLevel
.
debug
;
}
if
(
v
>
0.1
)
{
return
LogLevel
.
trace
;
}
return
LogLevel
.
unknown
;
}
getNextWord
()
{
getNextWord
()
{
this
.
index
=
(
this
.
index
+
Math
.
floor
(
Math
.
random
()
*
5
))
%
words
.
length
;
this
.
index
=
(
this
.
index
+
Math
.
floor
(
Math
.
random
()
*
5
))
%
words
.
length
;
return
words
[
this
.
index
];
return
words
[
this
.
index
];
}
}
getRandomLine
()
{
getRandomLine
(
length
=
60
)
{
let
line
=
this
.
getNextWord
();
let
line
=
this
.
getNextWord
();
while
(
line
.
length
<
80
)
{
while
(
line
.
length
<
length
)
{
line
+=
' '
+
this
.
getNextWord
();
line
+=
' '
+
this
.
getNextWord
();
}
}
return
line
;
return
line
;
}
}
nextRow
=
(
time
:
number
)
=>
{
nextRow
=
(
time
:
number
)
=>
{
return
[
time
,
this
.
getRandomLine
()];
return
[
time
,
'['
+
this
.
getRandomLogLevel
()
+
'] '
+
this
.
getRandomLine
()];
};
};
initBuffer
(
refId
:
string
):
SeriesData
{
initBuffer
(
refId
:
string
):
SeriesData
{
...
@@ -270,9 +294,10 @@ export class LogsWorker extends StreamWorker {
...
@@ -270,9 +294,10 @@ export class LogsWorker extends StreamWorker {
if
(
query
.
speed
<
5
)
{
if
(
query
.
speed
<
5
)
{
query
.
speed
=
5
;
query
.
speed
=
5
;
}
}
const
variance
=
query
.
speed
*
0.2
*
(
Math
.
random
()
-
0.5
);
// +-10%
this
.
appendRows
([
this
.
nextRow
(
Date
.
now
())]);
this
.
appendRows
([
this
.
nextRow
(
Date
.
now
())]);
this
.
timeoutId
=
window
.
setTimeout
(
this
.
looper
,
query
.
speed
);
this
.
timeoutId
=
window
.
setTimeout
(
this
.
looper
,
query
.
speed
+
variance
);
};
};
}
}
...
...
public/app/plugins/datasource/testdata/partials/query.editor.html
View file @
27dcd0ed
...
@@ -58,7 +58,7 @@
...
@@ -58,7 +58,7 @@
step=
"10"
step=
"10"
ng-change=
"ctrl.streamChanged()"
/>
ng-change=
"ctrl.streamChanged()"
/>
</div>
</div>
<div
class=
"gf-form"
>
<div
class=
"gf-form"
ng-if=
"ctrl.target.stream.type === 'signal'"
>
<label
class=
"gf-form-label query-keyword"
>
Spread
</label>
<label
class=
"gf-form-label query-keyword"
>
Spread
</label>
<input
type=
"number"
<input
type=
"number"
class=
"gf-form-input width-5"
class=
"gf-form-input width-5"
...
@@ -68,7 +68,7 @@
...
@@ -68,7 +68,7 @@
step=
"0.1"
step=
"0.1"
ng-change=
"ctrl.streamChanged()"
/>
ng-change=
"ctrl.streamChanged()"
/>
</div>
</div>
<div
class=
"gf-form"
>
<div
class=
"gf-form"
ng-if=
"ctrl.target.stream.type === 'signal'"
>
<label
class=
"gf-form-label query-keyword"
>
Noise
</label>
<label
class=
"gf-form-label query-keyword"
>
Noise
</label>
<input
type=
"number"
<input
type=
"number"
class=
"gf-form-input width-5"
class=
"gf-form-input width-5"
...
...
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