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
58cefe73
Unverified
Commit
58cefe73
authored
Jun 22, 2020
by
Marcus Efraimsson
Committed by
GitHub
Jun 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Datasources: Handle URL parsing error (#25742)
Adds handling of error returned from URL parsing. Fixes #25714
parent
c16890c2
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
8 deletions
+28
-8
pkg/tsdb/azuremonitor/applicationinsights-datasource.go
+4
-1
pkg/tsdb/azuremonitor/azure-log-analytics-datasource.go
+4
-1
pkg/tsdb/azuremonitor/azuremonitor-datasource.go
+4
-1
pkg/tsdb/elasticsearch/client/client.go
+4
-2
pkg/tsdb/graphite/graphite.go
+4
-1
pkg/tsdb/opentsdb/opentsdb.go
+4
-1
pkg/tsdb/stackdriver/stackdriver.go
+4
-1
No files found.
pkg/tsdb/azuremonitor/applicationinsights-datasource.go
View file @
58cefe73
...
...
@@ -242,7 +242,10 @@ func (e *ApplicationInsightsDatasource) createRequest(ctx context.Context, dsInf
appInsightsAppID
:=
dsInfo
.
JsonData
.
Get
(
"appInsightsAppId"
)
.
MustString
()
proxyPass
:=
fmt
.
Sprintf
(
"%s/v1/apps/%s"
,
pluginRouteName
,
appInsightsAppID
)
u
,
_
:=
url
.
Parse
(
dsInfo
.
Url
)
u
,
err
:=
url
.
Parse
(
dsInfo
.
Url
)
if
err
!=
nil
{
return
nil
,
err
}
u
.
Path
=
path
.
Join
(
u
.
Path
,
fmt
.
Sprintf
(
"/v1/apps/%s"
,
appInsightsAppID
))
req
,
err
:=
http
.
NewRequest
(
http
.
MethodGet
,
u
.
String
(),
nil
)
...
...
pkg/tsdb/azuremonitor/azure-log-analytics-datasource.go
View file @
58cefe73
...
...
@@ -184,7 +184,10 @@ func (e *AzureLogAnalyticsDatasource) executeQuery(ctx context.Context, query *A
}
func
(
e
*
AzureLogAnalyticsDatasource
)
createRequest
(
ctx
context
.
Context
,
dsInfo
*
models
.
DataSource
)
(
*
http
.
Request
,
error
)
{
u
,
_
:=
url
.
Parse
(
dsInfo
.
Url
)
u
,
err
:=
url
.
Parse
(
dsInfo
.
Url
)
if
err
!=
nil
{
return
nil
,
err
}
u
.
Path
=
path
.
Join
(
u
.
Path
,
"render"
)
req
,
err
:=
http
.
NewRequest
(
http
.
MethodGet
,
u
.
String
(),
nil
)
...
...
pkg/tsdb/azuremonitor/azuremonitor-datasource.go
View file @
58cefe73
...
...
@@ -221,7 +221,10 @@ func (e *AzureMonitorDatasource) createRequest(ctx context.Context, dsInfo *mode
cloudName
:=
dsInfo
.
JsonData
.
Get
(
"cloudName"
)
.
MustString
(
"azuremonitor"
)
proxyPass
:=
fmt
.
Sprintf
(
"%s/subscriptions"
,
cloudName
)
u
,
_
:=
url
.
Parse
(
dsInfo
.
Url
)
u
,
err
:=
url
.
Parse
(
dsInfo
.
Url
)
if
err
!=
nil
{
return
nil
,
err
}
u
.
Path
=
path
.
Join
(
u
.
Path
,
"render"
)
req
,
err
:=
http
.
NewRequest
(
http
.
MethodGet
,
u
.
String
(),
nil
)
...
...
pkg/tsdb/elasticsearch/client/client.go
View file @
58cefe73
...
...
@@ -154,12 +154,14 @@ func (c *baseClientImpl) encodeBatchRequests(requests []*multiRequest) ([]byte,
}
func
(
c
*
baseClientImpl
)
executeRequest
(
method
,
uriPath
,
uriQuery
string
,
body
[]
byte
)
(
*
response
,
error
)
{
u
,
_
:=
url
.
Parse
(
c
.
ds
.
Url
)
u
,
err
:=
url
.
Parse
(
c
.
ds
.
Url
)
if
err
!=
nil
{
return
nil
,
err
}
u
.
Path
=
path
.
Join
(
u
.
Path
,
uriPath
)
u
.
RawQuery
=
uriQuery
var
req
*
http
.
Request
var
err
error
if
method
==
http
.
MethodPost
{
req
,
err
=
http
.
NewRequest
(
http
.
MethodPost
,
u
.
String
(),
bytes
.
NewBuffer
(
body
))
}
else
{
...
...
pkg/tsdb/graphite/graphite.go
View file @
58cefe73
...
...
@@ -154,7 +154,10 @@ func (e *GraphiteExecutor) parseResponse(res *http.Response) ([]TargetResponseDT
}
func
(
e
*
GraphiteExecutor
)
createRequest
(
dsInfo
*
models
.
DataSource
,
data
url
.
Values
)
(
*
http
.
Request
,
error
)
{
u
,
_
:=
url
.
Parse
(
dsInfo
.
Url
)
u
,
err
:=
url
.
Parse
(
dsInfo
.
Url
)
if
err
!=
nil
{
return
nil
,
err
}
u
.
Path
=
path
.
Join
(
u
.
Path
,
"render"
)
req
,
err
:=
http
.
NewRequest
(
http
.
MethodPost
,
u
.
String
(),
strings
.
NewReader
(
data
.
Encode
()))
...
...
pkg/tsdb/opentsdb/opentsdb.go
View file @
58cefe73
...
...
@@ -79,7 +79,10 @@ func (e *OpenTsdbExecutor) Query(ctx context.Context, dsInfo *models.DataSource,
}
func
(
e
*
OpenTsdbExecutor
)
createRequest
(
dsInfo
*
models
.
DataSource
,
data
OpenTsdbQuery
)
(
*
http
.
Request
,
error
)
{
u
,
_
:=
url
.
Parse
(
dsInfo
.
Url
)
u
,
err
:=
url
.
Parse
(
dsInfo
.
Url
)
if
err
!=
nil
{
return
nil
,
err
}
u
.
Path
=
path
.
Join
(
u
.
Path
,
"api/query"
)
postData
,
err
:=
json
.
Marshal
(
data
)
...
...
pkg/tsdb/stackdriver/stackdriver.go
View file @
58cefe73
...
...
@@ -656,7 +656,10 @@ func calcBucketBound(bucketOptions stackdriverBucketOptions, n int) string {
}
func
(
e
*
StackdriverExecutor
)
createRequest
(
ctx
context
.
Context
,
dsInfo
*
models
.
DataSource
,
query
*
stackdriverQuery
,
proxyPass
string
)
(
*
http
.
Request
,
error
)
{
u
,
_
:=
url
.
Parse
(
dsInfo
.
Url
)
u
,
err
:=
url
.
Parse
(
dsInfo
.
Url
)
if
err
!=
nil
{
return
nil
,
err
}
u
.
Path
=
path
.
Join
(
u
.
Path
,
"render"
)
req
,
err
:=
http
.
NewRequest
(
http
.
MethodGet
,
"https://monitoring.googleapis.com/"
,
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