forked from TrueCloudLab/frostfs-node
[#242] node: Add tracing spans
Add tracing spans for PUT requests. Add tracing spans for DELETE requests. Add tracing spans for SELECT requests. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
200fc8b882
commit
d62c6e4ce6
122 changed files with 863 additions and 417 deletions
|
@ -1,7 +1,12 @@
|
|||
package shard
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/pkg/tracing"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
// FlushWriteCachePrm represents parameters of a `FlushWriteCache` operation.
|
||||
|
@ -19,7 +24,14 @@ func (p *FlushWriteCachePrm) SetIgnoreErrors(ignore bool) {
|
|||
var errWriteCacheDisabled = errors.New("write-cache is disabled")
|
||||
|
||||
// FlushWriteCache flushes all data from the write-cache.
|
||||
func (s *Shard) FlushWriteCache(p FlushWriteCachePrm) error {
|
||||
func (s *Shard) FlushWriteCache(ctx context.Context, p FlushWriteCachePrm) error {
|
||||
ctx, span := tracing.StartSpanFromContext(ctx, "Shard.FlushWriteCache",
|
||||
trace.WithAttributes(
|
||||
attribute.String("shard_id", s.ID().String()),
|
||||
attribute.Bool("ignore_errors", p.ignoreErrors),
|
||||
))
|
||||
defer span.End()
|
||||
|
||||
if !s.hasWriteCache() {
|
||||
return errWriteCacheDisabled
|
||||
}
|
||||
|
@ -35,5 +47,5 @@ func (s *Shard) FlushWriteCache(p FlushWriteCachePrm) error {
|
|||
return ErrDegradedMode
|
||||
}
|
||||
|
||||
return s.writeCache.Flush(p.ignoreErrors)
|
||||
return s.writeCache.Flush(ctx, p.ignoreErrors)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue