mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
all: remove unnecessary type conversions (#3992)
excep promql due to not to create conflict with #3966.
This commit is contained in:
parent
83325c8d82
commit
ec8e4d8a7c
|
@ -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)),
|
||||
|
|
|
@ -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(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue