all: remove unnecessary type conversions (#3992)

excep promql due to not to create conflict with #3966.
This commit is contained in:
ferhat elmas 2018-03-21 10:25:22 +01:00 committed by Brian Brazil
parent 83325c8d82
commit ec8e4d8a7c
3 changed files with 6 additions and 6 deletions

View file

@ -207,7 +207,7 @@ func (r *AlertingRule) Eval(ctx context.Context, ts time.Time, query QueryFunc,
expand := func(text string) string {
tmpl := template.NewTemplateExpander(
ctx,
defs+string(text),
defs+text,
"__alert_"+r.Name(),
tmplData,
model.Time(timestamp.FromTime(ts)),

View file

@ -135,16 +135,16 @@ func (t *Target) URL() *url.URL {
ks := l.Name[len(model.ParamLabelPrefix):]
if len(params[ks]) > 0 {
params[ks][0] = string(l.Value)
params[ks][0] = l.Value
} else {
params[ks] = []string{l.Value}
}
}
return &url.URL{
Scheme: string(t.labels.Get(model.SchemeLabel)),
Host: string(t.labels.Get(model.AddressLabel)),
Path: string(t.labels.Get(model.MetricsPathLabel)),
Scheme: t.labels.Get(model.SchemeLabel),
Host: t.labels.Get(model.AddressLabel),
Path: t.labels.Get(model.MetricsPathLabel),
RawQuery: params.Encode(),
}
}

View file

@ -159,7 +159,7 @@ func (a adapter) StartTime() (int64, error) {
if len(a.db.Blocks()) > 0 {
startTime = a.db.Blocks()[0].Meta().MinTime
} else {
startTime = int64(time.Now().Unix() * 1000)
startTime = time.Now().Unix() * 1000
}
// Add a safety margin as it may take a few minutes for everything to spin up.