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
c980f375
Unverified
Commit
c980f375
authored
Jul 15, 2020
by
Kyle Brandt
Committed by
GitHub
Jul 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Azure: Insights Analytics, fix possible panics and return error body (#26361)
missing return statements can result in panic
parent
21971a4d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
pkg/tsdb/azuremonitor/insights-analytics-datasource.go
+6
-6
No files found.
pkg/tsdb/azuremonitor/insights-analytics-datasource.go
View file @
c980f375
...
...
@@ -104,7 +104,7 @@ func (e *InsightsAnalyticsDatasource) executeQuery(ctx context.Context, query *I
req
,
err
:=
e
.
createRequest
(
ctx
,
e
.
dsInfo
)
if
err
!=
nil
{
queryResultError
(
err
)
return
queryResultError
(
err
)
}
req
.
URL
.
Path
=
path
.
Join
(
req
.
URL
.
Path
,
"query"
)
req
.
URL
.
RawQuery
=
query
.
Params
.
Encode
()
...
...
@@ -128,30 +128,30 @@ func (e *InsightsAnalyticsDatasource) executeQuery(ctx context.Context, query *I
azlog
.
Debug
(
"ApplicationInsights"
,
"Request URL"
,
req
.
URL
.
String
())
res
,
err
:=
ctxhttp
.
Do
(
ctx
,
e
.
httpClient
,
req
)
if
err
!=
nil
{
queryResultError
(
err
)
return
queryResultError
(
err
)
}
body
,
err
:=
ioutil
.
ReadAll
(
res
.
Body
)
defer
res
.
Body
.
Close
()
if
err
!=
nil
{
queryResultError
(
err
)
return
queryResultError
(
err
)
}
if
res
.
StatusCode
/
100
!=
2
{
azlog
.
Debug
(
"Request failed"
,
"status"
,
res
.
Status
,
"body"
,
string
(
body
))
queryResultError
(
fmt
.
Errorf
(
"Request failed status: %v"
,
res
.
Status
))
return
queryResultError
(
fmt
.
Errorf
(
"Request failed status: %v %w"
,
res
.
Status
,
fmt
.
Errorf
(
string
(
body
))
))
}
var
logResponse
AzureLogAnalyticsResponse
d
:=
json
.
NewDecoder
(
bytes
.
NewReader
(
body
))
d
.
UseNumber
()
err
=
d
.
Decode
(
&
logResponse
)
if
err
!=
nil
{
queryResultError
(
err
)
return
queryResultError
(
err
)
}
t
,
err
:=
logResponse
.
GetPrimaryResultTable
()
if
err
!=
nil
{
queryResultError
(
err
)
return
queryResultError
(
err
)
}
frame
,
err
:=
LogTableToFrame
(
t
)
...
...
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