policer: Add tracing span #1473

Merged
dstepanov-yadro merged 1 commit from dstepanov-yadro/frostfs-node:feat/policer_tracing into master 2024-11-06 08:15:12 +00:00

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(

Do we have any spans in replicator? It should also be useful.

Do we have any spans in replicator? It should also be useful.

Yes, we do:

ctx, span := tracing.StartSpanFromContext(ctx, "Replicator.HandleReplicateTask",

Yes, we do: https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/17ec84151b4f9f3d2ff593ecdad41b8c0c860e02/pkg/services/replicator/process.go#L35
attribute.String("address", objInfo.Address.String()),
attribute.Bool("is_linking_object", objInfo.IsLinkingObject),
attribute.Bool("is_ec_part", objInfo.ECInfo != nil),
https://opentelemetry.io/docs/specs/semconv/general/attribute-naming/ >Names SHOULD be lowercase.

fixed

fixed
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) {