Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion expr/expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package expr
import (
"context"
"errors"
"net/http"
"strings"

"github.com/ansel1/merry"
pb "github.com/go-graphite/protocol/carbonapi_v3_pb"
Expand All @@ -17,6 +19,7 @@ import (
"github.com/go-graphite/carbonapi/pkg/parser"
utilctx "github.com/go-graphite/carbonapi/util/ctx"
zipper "github.com/go-graphite/carbonapi/zipper/interfaces"
zipperTypes "github.com/go-graphite/carbonapi/zipper/types"
)

var ErrZipperNotInit = errors.New("zipper not initialized")
Expand Down Expand Up @@ -95,7 +98,13 @@ func (eval Evaluator) Fetch(ctx context.Context, exprs []parser.Expr, from, unti

if len(multiFetchRequest.Metrics) > 0 {
metrics, _, err := eval.zipper.Render(ctx, multiFetchRequest)
// If we had only partial result, we want to do our best to actually do our job
// If we had only partial result, we want to do our best to actually do our job. Ignore 404 ErrNotFound errors
// if there are some metrics cached from previous targets as we actually have the data - if we included all
// metrics in batch we would get no error and proceed normally. Without this queries with multiple targets like
// target=group(existing,notexisting)&target=group(existing,othernotexisting) would miss some results.
if merry.HTTPCode(err) == http.StatusNotFound && strings.Contains(err.Error(), zipperTypes.ErrNotFound.Error()) && len(targetValues) > 0 {
err = nil
}
if err != nil && merry.HTTPCode(err) >= 400 && !haveFallbackSeries {
return nil, err
}
Expand Down