frostfs-node/pkg/services/object/search/search.go
Dmitrii Stepanov d62c6e4ce6 [#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>
2023-04-14 10:25:53 +00:00

50 lines
931 B
Go

package searchsvc
import (
"context"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
"go.uber.org/zap"
)
// Search serves a request to select the objects.
func (s *Service) Search(ctx context.Context, prm Prm) error {
exec := &execCtx{
svc: s,
prm: prm,
}
exec.prepare()
exec.setLogger(s.log)
exec.execute(ctx)
return exec.statusError.err
}
func (exec *execCtx) execute(ctx context.Context) {
exec.log.Debug(logs.ServingRequest)
// perform local operation
exec.executeLocal(ctx)
exec.analyzeStatus(ctx, true)
}
func (exec *execCtx) analyzeStatus(ctx context.Context, execCnr bool) {
// analyze local result
switch exec.status {
default:
exec.log.Debug(logs.OperationFinishedWithError,
zap.String("error", exec.err.Error()),
)
case statusOK:
exec.log.Debug(logs.OperationFinishedSuccessfully)
}
if execCnr {
exec.executeOnContainer(ctx)
exec.analyzeStatus(ctx, false)
}
}