Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkge/receive: trace TSDB ingestion #2384

Merged
merged 1 commit into from
Apr 6, 2020
Merged
Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions pkg/receive/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,11 @@ func (h *Handler) parallelizeRequests(ctx context.Context, tenant string, replic
if h.writer == nil {
err = errors.New("storage is not ready")
} else {
err = h.writer.Write(wreqs[endpoint])
// Create a span to track writing the request into TSDB.
tracing.DoInSpan(ctx, "receive_tsdb_write", func(ctx context.Context) {

err = h.writer.Write(wreqs[endpoint])
})
// When a MultiError is added to another MultiError, the error slices are concatenated, not nested.
// To avoid breaking the counting logic, we need to flatten the error.
if errs, ok := err.(terrors.MultiError); ok {
Expand Down Expand Up @@ -402,7 +406,7 @@ func (h *Handler) parallelizeRequests(ctx context.Context, tenant string, replic
return
}
// Create a span to track the request made to another receive node.
tracing.DoInSpan(ctx, "thanos_receive_forward", func(ctx context.Context) {
tracing.DoInSpan(ctx, "receive_forward", func(ctx context.Context) {
// Actually make the request against the endpoint
// we determined should handle these time series.
_, err = cl.RemoteWrite(ctx, &storepb.WriteRequest{
Expand Down
1 change: 1 addition & 0 deletions pkg/receive/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/prometheus/prometheus/pkg/labels"
"github.com/prometheus/prometheus/storage"
terrors "github.com/prometheus/prometheus/tsdb/errors"

"github.com/thanos-io/thanos/pkg/store/storepb/prompb"
)

Expand Down