diff --git a/pkg/ccl/backupccl/backup_processor.go b/pkg/ccl/backupccl/backup_processor.go index 60fbf49bd00b..9c69d726e56e 100644 --- a/pkg/ccl/backupccl/backup_processor.go +++ b/pkg/ccl/backupccl/backup_processor.go @@ -249,6 +249,12 @@ type exportedSpan struct { atKeyBoundary bool } +func fetchExportRequestTrace(ctx context.Context) string { + sp := tracing.SpanFromContext(ctx) + rec := sp.GetConfiguredRecording() + return rec.String() +} + func runBackupProcessor( ctx context.Context, flowCtx *execinfra.FlowCtx, @@ -440,7 +446,12 @@ func runBackupProcessor( } return nil }) + + // Fetch the trace for the ExportRequest even if it failed with an + // error. + exportReqTrace := fetchExportRequestTrace(ctx) if exportRequestErr != nil { + log.Infof(ctx, "ExportRequest for span %s trace:\n%s", span.span.String(), exportReqTrace) if intentErr, ok := pErr.GetDetail().(*roachpb.WriteIntentError); ok { span.lastTried = timeutil.Now() span.attempts++ @@ -471,6 +482,7 @@ func runBackupProcessor( return errors.Wrapf(exportRequestErr, "exporting %s", span.span) } + log.VEventf(ctx, 2, "ExportRequest for span %s trace:\n%s", span.span.String(), exportReqTrace) resp := rawResp.(*roachpb.ExportResponse) // If the reply has a resume span, we process it immediately. diff --git a/pkg/util/bulk/tracing_aggregator.go b/pkg/util/bulk/tracing_aggregator.go index 3bb29c7af489..fb0511914151 100644 --- a/pkg/util/bulk/tracing_aggregator.go +++ b/pkg/util/bulk/tracing_aggregator.go @@ -89,8 +89,10 @@ func MakeTracingAggregatorWithSpan( ctx context.Context, aggregatorName string, tracer *tracing.Tracer, ) (context.Context, *TracingAggregator) { agg := &TracingAggregator{} + + sp := tracing.SpanFromContext(ctx) aggCtx, aggSpan := tracing.EnsureChildSpan(ctx, tracer, aggregatorName, - tracing.WithEventListeners(agg)) + tracing.WithEventListeners(agg), tracing.WithRecording(sp.RecordingType())) agg.mu.Lock() defer agg.mu.Unlock()