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
4752d788
Unverified
Commit
4752d788
authored
May 25, 2018
by
Marcus Efraimsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
elasticsearch: adds some more/better debug logging to client
parent
16c3566a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
7 deletions
+23
-7
pkg/tsdb/elasticsearch/client/client.go
+23
-7
No files found.
pkg/tsdb/elasticsearch/client/client.go
View file @
4752d788
...
...
@@ -119,6 +119,9 @@ type multiRequest struct {
}
func
(
c
*
baseClientImpl
)
executeBatchRequest
(
uriPath
string
,
requests
[]
*
multiRequest
)
(
*
http
.
Response
,
error
)
{
clientLog
.
Debug
(
"Encoding batch requests to json"
,
"batch requests"
,
len
(
requests
))
start
:=
time
.
Now
()
payload
:=
bytes
.
Buffer
{}
for
_
,
r
:=
range
requests
{
reqHeader
,
err
:=
json
.
Marshal
(
r
.
header
)
...
...
@@ -134,6 +137,9 @@ func (c *baseClientImpl) executeBatchRequest(uriPath string, requests []*multiRe
payload
.
WriteString
(
string
(
reqBody
)
+
"
\n
"
)
}
elapsed
:=
time
.
Now
()
.
Sub
(
start
)
clientLog
.
Debug
(
"Encoded batch requests to json"
,
"took"
,
elapsed
)
return
c
.
executeRequest
(
http
.
MethodPost
,
uriPath
,
payload
.
Bytes
())
}
...
...
@@ -151,6 +157,9 @@ func (c *baseClientImpl) executeRequest(method, uriPath string, body []byte) (*h
if
err
!=
nil
{
return
nil
,
err
}
clientLog
.
Debug
(
"Executing request"
,
"url"
,
req
.
URL
.
String
(),
"method"
,
method
)
req
.
Header
.
Set
(
"User-Agent"
,
"Grafana"
)
req
.
Header
.
Set
(
"Content-Type"
,
"application/json"
)
...
...
@@ -169,22 +178,28 @@ func (c *baseClientImpl) executeRequest(method, uriPath string, body []byte) (*h
return
nil
,
err
}
if
method
==
http
.
MethodPost
{
clientLog
.
Debug
(
"Executing request"
,
"url"
,
req
.
URL
.
String
(),
"method"
,
method
)
}
else
{
clientLog
.
Debug
(
"Executing request"
,
"url"
,
req
.
URL
.
String
(),
"method"
,
method
)
}
start
:=
time
.
Now
()
defer
func
()
{
elapsed
:=
time
.
Now
()
.
Sub
(
start
)
clientLog
.
Debug
(
"Executed request"
,
"took"
,
elapsed
)
}()
return
ctxhttp
.
Do
(
c
.
ctx
,
httpClient
,
req
)
}
func
(
c
*
baseClientImpl
)
ExecuteMultisearch
(
r
*
MultiSearchRequest
)
(
*
MultiSearchResponse
,
error
)
{
clientLog
.
Debug
(
"Executing multisearch"
,
"search requests"
,
len
(
r
.
Requests
))
multiRequests
:=
c
.
createMultiSearchRequests
(
r
.
Requests
)
res
,
err
:=
c
.
executeBatchRequest
(
"_msearch"
,
multiRequests
)
if
err
!=
nil
{
return
nil
,
err
}
clientLog
.
Debug
(
"Received multisearch response"
,
"code"
,
res
.
StatusCode
,
"status"
,
res
.
Status
,
"content-length"
,
res
.
ContentLength
)
start
:=
time
.
Now
()
clientLog
.
Debug
(
"Decoding multisearch json response"
)
var
msr
MultiSearchResponse
defer
res
.
Body
.
Close
()
dec
:=
json
.
NewDecoder
(
res
.
Body
)
...
...
@@ -193,7 +208,8 @@ func (c *baseClientImpl) ExecuteMultisearch(r *MultiSearchRequest) (*MultiSearch
return
nil
,
err
}
clientLog
.
Debug
(
"Received multisearch response"
,
"code"
,
res
.
StatusCode
,
"status"
,
res
.
Status
,
"content-length"
,
res
.
ContentLength
)
elapsed
:=
time
.
Now
()
.
Sub
(
start
)
clientLog
.
Debug
(
"Decoded multisearch json response"
,
"took"
,
elapsed
)
msr
.
status
=
res
.
StatusCode
...
...
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