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
3d3365f2
Commit
3d3365f2
authored
Sep 01, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tech(graphite): add more logging
parent
94389a3a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
pkg/tsdb/graphite/graphite.go
+15
-4
No files found.
pkg/tsdb/graphite/graphite.go
View file @
3d3365f2
...
...
@@ -13,6 +13,10 @@ import (
"github.com/grafana/grafana/pkg/tsdb"
)
var
(
HttpClient
=
http
.
Client
{
Timeout
:
time
.
Duration
(
10
*
time
.
Second
)}
)
type
GraphiteExecutor
struct
{
*
tsdb
.
DataSourceInfo
}
...
...
@@ -43,20 +47,27 @@ func (e *GraphiteExecutor) Execute(queries tsdb.QuerySlice, context *tsdb.QueryC
glog
.
Debug
(
"Graphite request"
,
"query"
,
query
.
Query
)
}
client
:=
http
.
Client
{
Timeout
:
time
.
Duration
(
10
*
time
.
Second
)}
req
,
_
:=
http
.
NewRequest
(
http
.
MethodPost
,
e
.
Url
+
"/render?"
,
strings
.
NewReader
(
params
.
Encode
()))
formData
:=
params
.
Encode
()
glog
.
Info
(
"Graphite request body"
,
"formdata"
,
formData
)
req
,
err
:=
http
.
NewRequest
(
http
.
MethodPost
,
e
.
Url
+
"/render"
,
strings
.
NewReader
(
formData
))
if
err
!=
nil
{
glog
.
Info
(
"Failed to create request"
,
"error"
,
err
)
result
.
Error
=
fmt
.
Errorf
(
"Failed to create request. error: %v"
,
err
)
return
result
}
if
e
.
BasicAuth
{
req
.
SetBasicAuth
(
e
.
BasicAuthUser
,
e
.
BasicAuthPassword
)
}
res
,
err
:=
c
lient
.
Do
(
req
)
res
,
err
:=
HttpC
lient
.
Do
(
req
)
if
err
!=
nil
{
result
.
Error
=
err
return
result
}
defer
res
.
Body
.
Close
()
body
,
err
:=
ioutil
.
ReadAll
(
res
.
Body
)
defer
res
.
Body
.
Close
()
if
err
!=
nil
{
result
.
Error
=
err
return
result
...
...
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