Fix unkeyed field errors.

This commit is contained in:
Fabian Reinartz 2015-09-18 16:51:53 +02:00
parent 36ec8ba460
commit 171f50706a
4 changed files with 7 additions and 5 deletions

View file

@ -1084,7 +1084,7 @@ func TestNaNExpression(t *testing.T) {
if !math.IsNaN(float64(nl.Val)) { if !math.IsNaN(float64(nl.Val)) {
t.Errorf("error on input 'NaN'") t.Errorf("error on input 'NaN'")
t.Fatalf("expected 'NaN' in number literal but got %d", nl.Val) t.Fatalf("expected 'NaN' in number literal but got %v", nl.Val)
} }
} }

View file

@ -37,7 +37,7 @@ func TestRuleEval(t *testing.T) {
}{ }{
{ {
name: "nolabels", name: "nolabels",
expr: &promql.NumberLiteral{1}, expr: &promql.NumberLiteral{Val: 1},
labels: model.LabelSet{}, labels: model.LabelSet{},
result: model.Vector{&model.Sample{ result: model.Vector{&model.Sample{
Value: 1, Value: 1,
@ -47,7 +47,7 @@ func TestRuleEval(t *testing.T) {
}, },
{ {
name: "labels", name: "labels",
expr: &promql.NumberLiteral{1}, expr: &promql.NumberLiteral{Val: 1},
labels: model.LabelSet{"foo": "bar"}, labels: model.LabelSet{"foo": "bar"},
result: model.Vector{&model.Sample{ result: model.Vector{&model.Sample{
Value: 1, Value: 1,

View file

@ -88,7 +88,9 @@ func (api *API) Register(r *route.Router) {
respond(w, data) respond(w, data)
} }
}) })
return prometheus.InstrumentHandler(name, httputil.CompressionHandler{hf}) return prometheus.InstrumentHandler(name, httputil.CompressionHandler{
Handler: hf,
})
} }
r.Get("/query", instr("query", api.query)) r.Get("/query", instr("query", api.query))

View file

@ -173,7 +173,7 @@ func New(st local.Storage, qe *promql.Engine, rm *rules.Manager, status *Prometh
router.Get(o.MetricsPath, prometheus.Handler().ServeHTTP) router.Get(o.MetricsPath, prometheus.Handler().ServeHTTP)
router.Get("/federate", instrh("federate", httputil.CompressionHandler{ router.Get("/federate", instrh("federate", httputil.CompressionHandler{
http.HandlerFunc(h.federation), Handler: http.HandlerFunc(h.federation),
})) }))
h.apiLegacy.Register(router.WithPrefix("/api")) h.apiLegacy.Register(router.WithPrefix("/api"))