gRPC migration
Change-Id: I3129ae27d7ee12a23c7046f0d877e8064f2fd7f4
diff --git a/vendor/github.com/uber/jaeger-client-go/transport_udp.go b/vendor/github.com/uber/jaeger-client-go/transport_udp.go
index 7370d80..0000412 100644
--- a/vendor/github.com/uber/jaeger-client-go/transport_udp.go
+++ b/vendor/github.com/uber/jaeger-client-go/transport_udp.go
@@ -15,10 +15,12 @@
package jaeger
import (
+ "context"
"errors"
"fmt"
"github.com/uber/jaeger-client-go/internal/reporterstats"
+ "github.com/uber/jaeger-client-go/log"
"github.com/uber/jaeger-client-go/thrift"
j "github.com/uber/jaeger-client-go/thrift-gen/jaeger"
"github.com/uber/jaeger-client-go/utils"
@@ -57,35 +59,57 @@
failedToEmitSpans int64
}
-// NewUDPTransport creates a reporter that submits spans to jaeger-agent.
+// UDPTransportParams allows specifying options for initializing a UDPTransport. An instance of this struct should
+// be passed to NewUDPTransportWithParams.
+type UDPTransportParams struct {
+ utils.AgentClientUDPParams
+}
+
+// NewUDPTransportWithParams creates a reporter that submits spans to jaeger-agent.
// TODO: (breaking change) move to transport/ package.
-func NewUDPTransport(hostPort string, maxPacketSize int) (Transport, error) {
- if len(hostPort) == 0 {
- hostPort = fmt.Sprintf("%s:%d", DefaultUDPSpanServerHost, DefaultUDPSpanServerPort)
+func NewUDPTransportWithParams(params UDPTransportParams) (Transport, error) {
+ if len(params.HostPort) == 0 {
+ params.HostPort = fmt.Sprintf("%s:%d", DefaultUDPSpanServerHost, DefaultUDPSpanServerPort)
}
- if maxPacketSize == 0 {
- maxPacketSize = utils.UDPPacketMaxLength
+
+ if params.Logger == nil {
+ params.Logger = log.StdLogger
+ }
+
+ if params.MaxPacketSize == 0 {
+ params.MaxPacketSize = utils.UDPPacketMaxLength
}
protocolFactory := thrift.NewTCompactProtocolFactory()
// Each span is first written to thriftBuffer to determine its size in bytes.
- thriftBuffer := thrift.NewTMemoryBufferLen(maxPacketSize)
+ thriftBuffer := thrift.NewTMemoryBufferLen(params.MaxPacketSize)
thriftProtocol := protocolFactory.GetProtocol(thriftBuffer)
- client, err := utils.NewAgentClientUDP(hostPort, maxPacketSize)
+ client, err := utils.NewAgentClientUDPWithParams(params.AgentClientUDPParams)
if err != nil {
return nil, err
}
return &udpSender{
client: client,
- maxSpanBytes: maxPacketSize - emitBatchOverhead,
+ maxSpanBytes: params.MaxPacketSize - emitBatchOverhead,
thriftBuffer: thriftBuffer,
thriftProtocol: thriftProtocol,
}, nil
}
+// NewUDPTransport creates a reporter that submits spans to jaeger-agent.
+// TODO: (breaking change) move to transport/ package.
+func NewUDPTransport(hostPort string, maxPacketSize int) (Transport, error) {
+ return NewUDPTransportWithParams(UDPTransportParams{
+ AgentClientUDPParams: utils.AgentClientUDPParams{
+ HostPort: hostPort,
+ MaxPacketSize: maxPacketSize,
+ },
+ })
+}
+
// SetReporterStats implements reporterstats.Receiver.
func (s *udpSender) SetReporterStats(rs reporterstats.ReporterStats) {
s.reporterStats = rs
@@ -93,7 +117,7 @@
func (s *udpSender) calcSizeOfSerializedThrift(thriftStruct thrift.TStruct) int {
s.thriftBuffer.Reset()
- _ = thriftStruct.Write(s.thriftProtocol)
+ _ = thriftStruct.Write(context.Background(), s.thriftProtocol)
return s.thriftBuffer.Len()
}
@@ -132,7 +156,7 @@
}
s.batchSeqNo++
batchSeqNo := int64(s.batchSeqNo)
- err := s.client.EmitBatch(&j.Batch{
+ err := s.client.EmitBatch(context.Background(), &j.Batch{
Process: s.process,
Spans: s.spanBuffer,
SeqNo: &batchSeqNo,