55package handler
66
77import (
8+ "context"
9+
810 "go.uber.org/zap"
911
1012 "github.com/jaegertracing/jaeger/cmd/collector/app/processor"
@@ -24,13 +26,13 @@ type SubmitBatchOptions struct {
2426// ZipkinSpansHandler consumes and handles zipkin spans
2527type ZipkinSpansHandler interface {
2628 // SubmitZipkinBatch records a batch of spans in Zipkin Thrift format
27- SubmitZipkinBatch (spans []* zipkincore.Span , options SubmitBatchOptions ) ([]* zipkincore.Response , error )
29+ SubmitZipkinBatch (ctx context. Context , spans []* zipkincore.Span , options SubmitBatchOptions ) ([]* zipkincore.Response , error )
2830}
2931
3032// JaegerBatchesHandler consumes and handles Jaeger batches
3133type JaegerBatchesHandler interface {
3234 // SubmitBatches records a batch of spans in Jaeger Thrift format
33- SubmitBatches (batches []* jaeger.Batch , options SubmitBatchOptions ) ([]* jaeger.BatchSubmitResponse , error )
35+ SubmitBatches (ctx context. Context , batches []* jaeger.Batch , options SubmitBatchOptions ) ([]* jaeger.BatchSubmitResponse , error )
3436}
3537
3638type jaegerBatchesHandler struct {
@@ -46,15 +48,15 @@ func NewJaegerSpanHandler(logger *zap.Logger, modelProcessor processor.SpanProce
4648 }
4749}
4850
49- func (jbh * jaegerBatchesHandler ) SubmitBatches (batches []* jaeger.Batch , options SubmitBatchOptions ) ([]* jaeger.BatchSubmitResponse , error ) {
51+ func (jbh * jaegerBatchesHandler ) SubmitBatches (ctx context. Context , batches []* jaeger.Batch , options SubmitBatchOptions ) ([]* jaeger.BatchSubmitResponse , error ) {
5052 responses := make ([]* jaeger.BatchSubmitResponse , 0 , len (batches ))
5153 for _ , batch := range batches {
5254 mSpans := make ([]* model.Span , 0 , len (batch .Spans ))
5355 for _ , span := range batch .Spans {
5456 mSpan := jConv .ToDomainSpan (span , batch .Process )
5557 mSpans = append (mSpans , mSpan )
5658 }
57- oks , err := jbh .modelProcessor .ProcessSpans (processor.SpansV1 {
59+ oks , err := jbh .modelProcessor .ProcessSpans (ctx , processor.SpansV1 {
5860 Spans : mSpans ,
5961 Details : processor.Details {
6062 InboundTransport : options .InboundTransport ,
@@ -98,7 +100,7 @@ func NewZipkinSpanHandler(logger *zap.Logger, modelHandler processor.SpanProcess
98100}
99101
100102// SubmitZipkinBatch records a batch of spans already in Zipkin Thrift format.
101- func (h * zipkinSpanHandler ) SubmitZipkinBatch (spans []* zipkincore.Span , options SubmitBatchOptions ) ([]* zipkincore.Response , error ) {
103+ func (h * zipkinSpanHandler ) SubmitZipkinBatch (ctx context. Context , spans []* zipkincore.Span , options SubmitBatchOptions ) ([]* zipkincore.Response , error ) {
102104 mSpans := make ([]* model.Span , 0 , len (spans ))
103105 convCount := make ([]int , len (spans ))
104106 for i , span := range spans {
@@ -108,7 +110,7 @@ func (h *zipkinSpanHandler) SubmitZipkinBatch(spans []*zipkincore.Span, options
108110 convCount [i ] = len (converted )
109111 mSpans = append (mSpans , converted ... )
110112 }
111- bools , err := h .modelProcessor .ProcessSpans (processor.SpansV1 {
113+ bools , err := h .modelProcessor .ProcessSpans (ctx , processor.SpansV1 {
112114 Spans : mSpans ,
113115 Details : processor.Details {
114116 InboundTransport : options .InboundTransport ,
0 commit comments