[#1473] policer: Add tracing span
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 1m26s
DCO action / DCO (pull_request) Successful in 1m40s
Vulncheck / Vulncheck (pull_request) Successful in 2m27s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m52s
Tests and linters / Staticcheck (pull_request) Successful in 2m55s
Build / Build Components (pull_request) Successful in 3m16s
Tests and linters / gopls check (pull_request) Successful in 3m24s
Tests and linters / Lint (pull_request) Successful in 3m50s
Tests and linters / Tests (pull_request) Successful in 5m5s
Tests and linters / Tests with -race (pull_request) Successful in 6m14s

To filter HEAD requests from policer.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2024-11-06 10:57:01 +03:00
parent 17ec84151b
commit 69b6b2b321
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0

View file

@ -9,14 +9,25 @@ import (
objectcore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object" objectcore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
policycore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/policy" policycore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/policy"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/replicator" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/replicator"
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
"go.uber.org/zap" "go.uber.org/zap"
) )
func (p *Policer) processObject(ctx context.Context, objInfo objectcore.Info) error { func (p *Policer) processObject(ctx context.Context, objInfo objectcore.Info) error {
ctx, span := tracing.StartSpanFromContext(ctx, "Policer.ProcessObject", trace.WithAttributes(
attribute.String("address", objInfo.Address.String()),
attribute.Bool("is_linking_object", objInfo.IsLinkingObject),
attribute.Bool("is_ec_part", objInfo.ECInfo != nil),
attribute.String("type", objInfo.Type.String()),
))
defer span.End()
cnr, err := p.cnrSrc.Get(objInfo.Address.Container()) cnr, err := p.cnrSrc.Get(objInfo.Address.Container())
if err != nil { if err != nil {
if client.IsErrContainerNotFound(err) { if client.IsErrContainerNotFound(err) {