mirror of
https://github.com/openfaas/faas.git
synced 2025-06-24 07:43:25 +00:00
Set content-type for mixed-in Prometheus results
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
@ -14,6 +14,10 @@ type PrometheusQuery struct {
|
||||
Client *http.Client
|
||||
}
|
||||
|
||||
type PrometheusQueryFetcher interface {
|
||||
Fetch(query string) (*VectorQueryResponse, error)
|
||||
}
|
||||
|
||||
// NewPrometheusQuery create a NewPrometheusQuery
|
||||
func NewPrometheusQuery(host string, port int, client *http.Client) PrometheusQuery {
|
||||
return PrometheusQuery{
|
||||
@ -24,7 +28,7 @@ func NewPrometheusQuery(host string, port int, client *http.Client) PrometheusQu
|
||||
}
|
||||
|
||||
// Fetch queries aggregated stats
|
||||
func (q *PrometheusQuery) Fetch(query string) (*VectorQueryResponse, error) {
|
||||
func (q PrometheusQuery) Fetch(query string) (*VectorQueryResponse, error) {
|
||||
|
||||
req, reqErr := http.NewRequest("GET", fmt.Sprintf("http://%s:%d/api/v1/query/?query=%s", q.Host, q.Port, query), nil)
|
||||
if reqErr != nil {
|
||||
|
Reference in New Issue
Block a user