Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
loki/pkg/engine/internal/executor/translate_errors.go

44 lines
728 B

package executor
import (
"context"
"errors"
"io"
"github.com/apache/arrow-go/v18/arrow"
)
func TranslateEOF(pipeline Pipeline) Pipeline {
return translateEOFPipeline{pipeline}
}
type translateEOFPipeline struct {
pipeline Pipeline
}
func (p translateEOFPipeline) Close() {
p.pipeline.Close()
}
func (p translateEOFPipeline) Read(ctx context.Context) (arrow.RecordBatch, error) {
rec, err := p.pipeline.Read(ctx)
return rec, translateEOF(err, false)
}
func translateEOF(err error, toExecutor bool) error {
if toExecutor {
// io.EOF to executor.EOF
if errors.Is(err, io.EOF) {
err = EOF
}
}
if !toExecutor {
// executor.EOF to io.EOF
if errors.Is(err, EOF) {
err = io.EOF
}
}
return err
}