Commit b7744b49 by utkarshcmu

Added tags and filters params to alerting

parent 35f93f41
...@@ -14,7 +14,6 @@ import ( ...@@ -14,7 +14,6 @@ import (
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/url" "net/url"
"net/http/httputil"
"encoding/json" "encoding/json"
"gopkg.in/guregu/null.v3" "gopkg.in/guregu/null.v3"
...@@ -103,6 +102,18 @@ func (e *OpenTsdbExecutor) Execute(ctx context.Context, queries tsdb.QuerySlice, ...@@ -103,6 +102,18 @@ func (e *OpenTsdbExecutor) Execute(ctx context.Context, queries tsdb.QuerySlice,
metric["rateOptions"] = rateOptions metric["rateOptions"] = rateOptions
} }
// Setting tags
tags, tagsCheck := queries[i].Model.CheckGet("tags")
if tagsCheck && len(tags.MustMap()) > 0 {
metric["tags"] = tags.MustMap()
}
// Setting filters
filters, filtersCheck := queries[i].Model.CheckGet("filters")
if filtersCheck && len(filters.MustArray()) > 0 {
metric["filters"] = filters.MustArray()
}
tsdbQuery.Queries[i] = metric tsdbQuery.Queries[i] = metric
} }
...@@ -147,13 +158,6 @@ func (e *OpenTsdbExecutor) createRequest(data OpenTsdbQuery) (*http.Request, err ...@@ -147,13 +158,6 @@ func (e *OpenTsdbExecutor) createRequest(data OpenTsdbQuery) (*http.Request, err
if e.BasicAuth { if e.BasicAuth {
req.SetBasicAuth(e.BasicAuthUser, e.BasicAuthPassword) req.SetBasicAuth(e.BasicAuthUser, e.BasicAuthPassword)
} }
requestDump, err := httputil.DumpRequest(req, true)
if err != nil {
fmt.Println(err)
}
fmt.Println(string(requestDump))
return req, err return req, err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment