Skip to content

Conversation

@hweawer
Copy link
Collaborator

@hweawer hweawer commented Jan 28, 2026

This PR adds distributed tracing support for the metainfo retrieval path from agent through tracker to origin, enabling end-to-end observability of blob metadata requests.

Changes:

  • Added context parameter to GetMetaInfo and Download methods throughout the codebase to enable trace context propagation
  • Implemented OpenTelemetry tracing spans in origin cluster client, origin client, and agent storage components
  • Added trace header propagation in tracker nginx configuration

@hweawer hweawer self-assigned this Jan 28, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds distributed tracing support for the metainfo retrieval path from agent through tracker to origin, enabling end-to-end observability of blob metadata requests.

Changes:

  • Added context parameter to GetMetaInfo and Download methods throughout the codebase to enable trace context propagation
  • Implemented OpenTelemetry tracing spans in origin cluster client, origin client, and agent storage components
  • Added trace header propagation in tracker nginx configuration

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tracker/trackerserver/server.go Minor formatting improvement to function signature
tracker/trackerserver/metainfo_test.go Updated test to pass context and use gomock.Any() for context parameter matching
tracker/trackerserver/metainfo.go Modified to pass request context to origin cluster GetMetaInfo call
tracker/metainfoclient/testing.go Updated TestClient interface to accept context parameter
tracker/metainfoclient/client.go Added context parameter to Download method and implemented trace context propagation
proxy/proxyserver/server_test.go Updated mock expectations to include context parameter
proxy/proxyserver/preheat.go Added context.Background() to GetMetaInfo calls
origin/blobserver/server_test.go Updated test calls to include context.Background()
origin/blobserver/cluster_client_test.go Updated test calls and mock expectations for context parameter
origin/blobclient/cluster_client.go Added OpenTelemetry tracing implementation with span creation, error recording, and status tracking
origin/blobclient/client.go Added OpenTelemetry tracing implementation for GetMetaInfo method
nginx/config/tracker.go Added proxy headers for trace context propagation (traceparent, tracestate, jaeger-debug-id)
mocks/tracker/metainfoclient/client.go Updated mock to reflect new interface signature with context
mocks/origin/blobclient/clusterclient.go Updated mock to reflect new interface signature with context
mocks/origin/blobclient/client.go Updated mock to reflect new interface signature with context
lib/torrent/storage/agentstorage/torrent_archive_test.go Updated test expectations to include gomock.Any() for context
lib/torrent/storage/agentstorage/torrent_archive.go Added tracing implementation and context propagation from agent storage
lib/torrent/scheduler/scheduler_test.go Updated all test expectations to include gomock.Any() for context
lib/torrent/scheduler/events_test.go Updated test expectation to include gomock.Any() for context

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ctx, span := otel.Tracer("kraken-origin-cluster").Start(ctx, "cluster.get_metainfo",
trace.WithSpanKind(trace.SpanKindClient),
trace.WithAttributes(
attribute.String("component", "origin-cluster-client"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we extract the component string to the top of the file in a constant to ensure we are always consistent when using it? Asking for the single origin client too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants