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
36f3accf
Unverified
Commit
36f3accf
authored
Mar 06, 2019
by
Marcus Efraimsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log phantomjs output even if it timeout and include orgId when render alert
parent
63e7330f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
7 deletions
+25
-7
pkg/log/log.go
+9
-2
pkg/services/alerting/notifier.go
+1
-1
pkg/services/rendering/phantomjs.go
+15
-4
No files found.
pkg/log/log.go
View file @
36f3accf
...
...
@@ -25,6 +25,7 @@ var filters map[string]log15.Lvl
func
init
()
{
loggersToClose
=
make
([]
DisposableHandler
,
0
)
loggersToReload
=
make
([]
ReloadableHandler
,
0
)
filters
=
map
[
string
]
log15
.
Lvl
{}
Root
=
log15
.
Root
()
Root
.
SetHandler
(
log15
.
DiscardHandler
())
}
...
...
@@ -197,7 +198,7 @@ func ReadLoggingConfig(modes []string, logsPath string, cfg *ini.File) {
// Log level.
_
,
level
:=
getLogLevelFromConfig
(
"log."
+
mode
,
defaultLevelName
,
cfg
)
f
ilters
:=
getFilters
(
util
.
SplitString
(
sec
.
Key
(
"filters"
)
.
String
()))
modeF
ilters
:=
getFilters
(
util
.
SplitString
(
sec
.
Key
(
"filters"
)
.
String
()))
format
:=
getLogFormat
(
sec
.
Key
(
"format"
)
.
MustString
(
""
))
var
handler
log15
.
Handler
...
...
@@ -230,12 +231,18 @@ func ReadLoggingConfig(modes []string, logsPath string, cfg *ini.File) {
}
for
key
,
value
:=
range
defaultFilters
{
if
_
,
exist
:=
modeFilters
[
key
];
!
exist
{
modeFilters
[
key
]
=
value
}
}
for
key
,
value
:=
range
modeFilters
{
if
_
,
exist
:=
filters
[
key
];
!
exist
{
filters
[
key
]
=
value
}
}
handler
=
LogFilterHandler
(
level
,
f
ilters
,
handler
)
handler
=
LogFilterHandler
(
level
,
modeF
ilters
,
handler
)
handlers
=
append
(
handlers
,
handler
)
}
...
...
pkg/services/alerting/notifier.go
View file @
36f3accf
...
...
@@ -138,7 +138,7 @@ func (n *notificationService) uploadImage(context *EvalContext) (err error) {
return
err
}
renderOpts
.
Path
=
fmt
.
Sprintf
(
"d-solo/%s/%s?
panelId=%d"
,
ref
.
Uid
,
ref
.
Slug
,
context
.
Rule
.
PanelId
)
renderOpts
.
Path
=
fmt
.
Sprintf
(
"d-solo/%s/%s?
orgId=%d&panelId=%d"
,
ref
.
Uid
,
ref
.
Slug
,
context
.
Rule
.
OrgId
,
context
.
Rule
.
PanelId
)
result
,
err
:=
n
.
renderService
.
Render
(
context
.
Ctx
,
renderOpts
)
if
err
!=
nil
{
...
...
pkg/services/rendering/phantomjs.go
View file @
36f3accf
...
...
@@ -36,7 +36,7 @@ func (rs *RenderingService) renderViaPhantomJS(ctx context.Context, opts Opts) (
defer
middleware
.
RemoveRenderAuthKey
(
renderKey
)
phantomDebugArg
:=
"--debug=false"
if
log
.
GetLogLevelFor
(
"render
er
"
)
>=
log
.
LvlDebug
{
if
log
.
GetLogLevelFor
(
"render
ing
"
)
>=
log
.
LvlDebug
{
phantomDebugArg
=
"--debug=true"
}
...
...
@@ -64,13 +64,26 @@ func (rs *RenderingService) renderViaPhantomJS(ctx context.Context, opts Opts) (
cmd
:=
exec
.
CommandContext
(
commandCtx
,
binPath
,
cmdArgs
...
)
cmd
.
Stderr
=
cmd
.
Stdout
timezone
:=
""
if
opts
.
Timezone
!=
""
{
timezone
=
isoTimeOffsetToPosixTz
(
opts
.
Timezone
)
baseEnviron
:=
os
.
Environ
()
cmd
.
Env
=
appendEnviron
(
baseEnviron
,
"TZ"
,
isoTimeOffsetToPosixTz
(
opts
.
Timezone
)
)
cmd
.
Env
=
appendEnviron
(
baseEnviron
,
"TZ"
,
timezone
)
}
rs
.
log
.
Debug
(
"executing Phantomjs"
,
"binPath"
,
binPath
,
"cmdArgs"
,
cmdArgs
,
"timezone"
,
timezone
)
out
,
err
:=
cmd
.
Output
()
if
out
!=
nil
{
rs
.
log
.
Debug
(
"Phantomjs output"
,
"out"
,
string
(
out
))
}
if
err
!=
nil
{
rs
.
log
.
Debug
(
"Phantomjs error"
,
"error"
,
err
)
}
// check for timeout first
if
commandCtx
.
Err
()
==
context
.
DeadlineExceeded
{
rs
.
log
.
Info
(
"Rendering timed out"
)
...
...
@@ -82,8 +95,6 @@ func (rs *RenderingService) renderViaPhantomJS(ctx context.Context, opts Opts) (
return
nil
,
err
}
rs
.
log
.
Debug
(
"Phantomjs output"
,
"out"
,
string
(
out
))
rs
.
log
.
Debug
(
"Image rendered"
,
"path"
,
pngPath
)
return
&
RenderResult
{
FilePath
:
pngPath
},
nil
}
...
...
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