Skip to content
This repository was archived by the owner on Jan 15, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ func (ds *DataSource) MarshalJSON() ([]byte, error) {
dataSource.JSONData.httpHeaderNames = append(dataSource.JSONData.httpHeaderNames, name)
dataSource.SecureJSONData.httpHeaderValues = append(dataSource.SecureJSONData.httpHeaderValues, value)
}

// Sentry provider expects this value in the JSON data payload,
// ignoring the url attribute. This hack allows passing the URL as
// an attribute but then sends it in the payload.
if ds.Type == "grafana-sentry-datasource" {
dataSource.JSONData.URL = ds.URL
}

return json.Marshal(dataSource)
}

Expand Down Expand Up @@ -152,6 +160,7 @@ type JSONData struct {

// Used by Sentry
OrgSlug string `json:"orgSlug,omitempty"`
URL string `json:"url,omitempty"` // Sentry is not using the datasource URL attribute
}

// Required to avoid recursion during (un)marshal
Expand Down