stackdriver: remove hardcoding of test project name

This commit is contained in:
Daniel Lee
2018-09-18 16:02:38 +02:00
parent 7b8ea5fc54
commit e05b86375b
6 changed files with 20 additions and 21 deletions
+2 -11
View File
@@ -138,7 +138,6 @@ func (e *StackdriverExecutor) buildQueries(tsdbQuery *tsdb.TsdbQuery) ([]*Stackd
func setAggParams(params *url.Values, query *tsdb.Query) {
primaryAggregation := query.Model.Get("primaryAggregation").MustString()
secondaryAggregation := query.Model.Get("secondaryAggregation").MustString()
perSeriesAligner := query.Model.Get("perSeriesAligner").MustString()
alignmentPeriod := query.Model.Get("alignmentPeriod").MustString()
@@ -146,18 +145,10 @@ func setAggParams(params *url.Values, query *tsdb.Query) {
primaryAggregation = "REDUCE_NONE"
}
if secondaryAggregation == "" {
secondaryAggregation = "REDUCE_NONE"
}
if perSeriesAligner == "" {
perSeriesAligner = "ALIGN_MEAN"
}
if secondaryAggregation == "" {
secondaryAggregation = "REDUCE_NONE"
}
if alignmentPeriod == "auto" || alignmentPeriod == "" {
alignmentPeriodValue := int(math.Max(float64(query.IntervalMs), 60.0))
alignmentPeriod = "+" + strconv.Itoa(alignmentPeriodValue) + "s"
@@ -172,7 +163,6 @@ func setAggParams(params *url.Values, query *tsdb.Query) {
params.Add("aggregation.crossSeriesReducer", primaryAggregation)
params.Add("aggregation.perSeriesAligner", perSeriesAligner)
params.Add("aggregation.alignmentPeriod", alignmentPeriod)
// params.Add("aggregation.secondaryAggregation.crossSeriesReducer", secondaryAggregation)
groupBys := query.Model.Get("groupBys").MustArray()
if len(groupBys) > 0 {
@@ -317,7 +307,8 @@ func (e *StackdriverExecutor) createRequest(ctx context.Context, dsInfo *models.
if !ok {
return nil, errors.New("Unable to find datasource plugin Stackdriver")
}
proxyPass := fmt.Sprintf("stackdriver%s", "v3/projects/raintank-production/timeSeries")
projectName := dsInfo.JsonData.Get("defaultProject").MustString()
proxyPass := fmt.Sprintf("stackdriver%s", "v3/projects/"+projectName+"/timeSeries")
var stackdriverRoute *plugins.AppPluginRoute
for _, route := range plugin.Routes {