diff --git a/go/cs/segreq/fetcher.go b/go/cs/segreq/fetcher.go index afe0f62a33..708baa0132 100644 --- a/go/cs/segreq/fetcher.go +++ b/go/cs/segreq/fetcher.go @@ -104,7 +104,8 @@ func newRouter(cfg FetcherConfig, fetcher *segfetcher.Fetcher) snet.Router { cfg.TopoProvider.Get().Core(), cfg.Inspector, cfg.PathDB), - Fetcher: fetcher, + Fetcher: fetcher, + HeaderV2: cfg.HeaderV2, }, } } diff --git a/go/lib/infra/modules/segfetcher/BUILD.bazel b/go/lib/infra/modules/segfetcher/BUILD.bazel index 36e12440c6..904ca97ad6 100644 --- a/go/lib/infra/modules/segfetcher/BUILD.bazel +++ b/go/lib/infra/modules/segfetcher/BUILD.bazel @@ -33,6 +33,7 @@ go_library( "//go/lib/topology:go_default_library", "//go/pkg/trust:go_default_library", "//go/proto:go_default_library", + "@com_github_opentracing_opentracing_go//:go_default_library", ], ) diff --git a/go/lib/infra/modules/segfetcher/requester.go b/go/lib/infra/modules/segfetcher/requester.go index 40a748e81f..e34dfb3186 100644 --- a/go/lib/infra/modules/segfetcher/requester.go +++ b/go/lib/infra/modules/segfetcher/requester.go @@ -19,6 +19,8 @@ import ( "net" "sync" + "github.com/opentracing/opentracing-go" + "github.com/scionproto/scion/go/lib/ctrl/path_mgmt" "github.com/scionproto/scion/go/lib/infra/messenger" "github.com/scionproto/scion/go/lib/log" @@ -65,15 +67,24 @@ func (r *DefaultRequester) Request(ctx context.Context, reqs Requests) <-chan Re var wg sync.WaitGroup for i := range reqs { req := reqs[i] - dst, err := r.DstProvider.Dst(ctx, req) - if err != nil { - replies <- ReplyOrErr{Req: req, Err: err} - continue - } + span, ctx := opentracing.StartSpanFromContext(ctx, "segfetcher.requester", + opentracing.Tags{ + "req.src": req.Src.String(), + "req.dst": req.Dst.String(), + "req.seg_type": req.SegType.String(), + }, + ) wg.Add(1) go func() { defer log.HandlePanic() defer wg.Done() + defer span.Finish() + + dst, err := r.DstProvider.Dst(ctx, req) + if err != nil { + replies <- ReplyOrErr{Req: req, Err: err} + return + } reply, err := r.API.GetSegs(ctx, req.ToSegReq(), dst, messenger.NextId()) replies <- ReplyOrErr{Req: req, Reply: reply, Peer: dst, Err: err} }()