feat: add trace info about source seed client in the client SDK - #4906
Open
Samyra312007 wants to merge 1 commit into
Open
feat: add trace info about source seed client in the client SDK#4906Samyra312007 wants to merge 1 commit into
Samyra312007 wants to merge 1 commit into
Conversation
Samyra312007
requested review from
BruceAko,
CooooolFrog,
chlins,
gaius-qi,
hyy0322 and
xujihui1985
July 28, 2026 17:56
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4906 +/- ##
==========================================
- Coverage 28.45% 28.40% -0.05%
==========================================
Files 235 235
Lines 23228 23271 +43
==========================================
+ Hits 6609 6610 +1
- Misses 16169 16209 +40
- Partials 450 452 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Contributor
|
Hi Samyra312007, we should add the trace info in the client sdk instead of scheduler. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add OpenTelemetry span attributes and structured log fields to trace which seed peer is selected and used during peer downloads. This gives operators end-to-end visibility into seed client selection, enabling diagnosis of load balancing issues.
Changes
internal/dflog/logger.go: AddedWithSeedPeer(hostID, hostname, ip, port)structured logging helperpkg/types/types.go: Added OTel attribute key constants for seed peer identity (d7y.scheduler.seed_peer.*)pkg/rpc/dfdaemon/client/client_v2.go: AddedsetPeerTargetAttributes()which setsd7y.dfdaemon.targetspan attribute on all download RPCs (DownloadTask,SyncPieces,DownloadPersistentTask,DownloadPersistentCacheTask)scheduler/resource/standard/seed_peer.go: Added OTel span attributes andWithSeedPeerlogging inTriggerDownloadTask,TriggerTask, andSelectscheduler/service/service_v2.go: Added priority span attribute indownloadTaskBySeedPeer; replacedcontext.Background()withcontext.WithoutCancel(ctx)to preserve trace context in fire-and-forget goroutinesscheduler/service/service_v1.go: Same pattern — priority span attribute andcontext.WithoutCancel(ctx)intriggerTaskandtriggerSeedPeerTaskRelated Issue
Closes #4841
Motivation and Context
Without this change, there is no way to identify which seed peer a peer is downloading from. This makes it impossible to detect load imbalances across seed peers (e.g., all peers hitting the same seed peer while others are idle). The new trace info flows through OpenTelemetry spans and structured logs, giving operators full visibility into seed peer selection and utilization.
Screenshots (if appropriate)
N/A
Types of changes
Checklist