diff --git a/Makefile b/Makefile index 34376633c82..251440ebd6a 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ BUILD_INFO_IMPORT_PATH=$(JAEGER_IMPORT_PATH)/pkg/version BUILD_INFO=-ldflags "-X $(BUILD_INFO_IMPORT_PATH).commitSHA=$(GIT_SHA) -X $(BUILD_INFO_IMPORT_PATH).latestVersion=$(GIT_CLOSEST_TAG) -X $(BUILD_INFO_IMPORT_PATH).date=$(DATE)" SED=sed -THRIFT_VER=0.13 +THRIFT_VER=0.14 THRIFT_IMG=jaegertracing/thrift:$(THRIFT_VER) THRIFT=docker run --rm -u ${shell id -u} -v "${PWD}:/data" $(THRIFT_IMG) thrift THRIFT_GO_ARGS=thrift_import="github.com/apache/thrift/lib/go/thrift" diff --git a/cmd/agent/app/builder.go b/cmd/agent/app/builder.go index c77d5c6165f..91f3c2823a9 100644 --- a/cmd/agent/app/builder.go +++ b/cmd/agent/app/builder.go @@ -57,8 +57,8 @@ type Protocol string var ( protocolFactoryMap = map[Protocol]thrift.TProtocolFactory{ - compactProtocol: thrift.NewTCompactProtocolFactory(), - binaryProtocol: thrift.NewTBinaryProtocolFactoryDefault(), + compactProtocol: thrift.NewTCompactProtocolFactoryConf(&thrift.TConfiguration{}), + binaryProtocol: thrift.NewTBinaryProtocolFactoryConf(&thrift.TConfiguration{}), } ) diff --git a/cmd/agent/app/processors/thrift_processor_test.go b/cmd/agent/app/processors/thrift_processor_test.go index 5ed5dcad738..d0b3248df9a 100644 --- a/cmd/agent/app/processors/thrift_processor_test.go +++ b/cmd/agent/app/processors/thrift_processor_test.go @@ -42,8 +42,8 @@ import ( // TODO make these tests faster, they take almost 4 seconds var ( - compactFactory = thrift.NewTCompactProtocolFactory() - binaryFactory = thrift.NewTBinaryProtocolFactoryDefault() + compactFactory = thrift.NewTCompactProtocolFactoryConf(&thrift.TConfiguration{}) + binaryFactory = thrift.NewTBinaryProtocolFactoryConf(&thrift.TConfiguration{}) testSpanName = "span1" diff --git a/cmd/agent/app/servers/tbuffered_server_test.go b/cmd/agent/app/servers/tbuffered_server_test.go index e77cc164cf4..e1d5459ea1b 100644 --- a/cmd/agent/app/servers/tbuffered_server_test.go +++ b/cmd/agent/app/servers/tbuffered_server_test.go @@ -22,7 +22,7 @@ import ( "testing" "time" - athrift "github.com/apache/thrift/lib/go/thrift" + "github.com/apache/thrift/lib/go/thrift" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/uber/jaeger-lib/metrics/metricstest" @@ -64,7 +64,7 @@ func TestTBufferedServer_SendReceive(t *testing.T) { assert.NotEqual(t, 0, len(readBuf.GetBytes())) inMemReporter := testutils.NewInMemoryReporter() - protoFact := athrift.NewTCompactProtocolFactory() + protoFact := thrift.NewTCompactProtocolFactoryConf(&thrift.TConfiguration{}) trans := &customtransport.TBufferedReadTransport{} protocol := protoFact.GetProtocol(trans) diff --git a/cmd/agent/app/testutils/thriftudp_client.go b/cmd/agent/app/testutils/thriftudp_client.go index 9fa4f33eb5b..e04312b2cc9 100644 --- a/cmd/agent/app/testutils/thriftudp_client.go +++ b/cmd/agent/app/testutils/thriftudp_client.go @@ -31,7 +31,7 @@ func NewZipkinThriftUDPClient(hostPort string) (*agent.AgentClient, io.Closer, e return nil, nil, err } - protocolFactory := thrift.NewTCompactProtocolFactory() + protocolFactory := thrift.NewTCompactProtocolFactoryConf(&thrift.TConfiguration{}) client := agent.NewAgentClientFactory(clientTransport, protocolFactory) return client, clientTransport, nil } diff --git a/cmd/agent/app/testutils/thriftudp_client_test.go b/cmd/agent/app/testutils/thriftudp_client_test.go index 27d431f3b2c..12c9668febc 100644 --- a/cmd/agent/app/testutils/thriftudp_client_test.go +++ b/cmd/agent/app/testutils/thriftudp_client_test.go @@ -33,7 +33,7 @@ func TestNewZipkinThriftUDPClient(t *testing.T) { } func TestNewJaegerThriftUDPClient(t *testing.T) { - compactFactory := thrift.NewTCompactProtocolFactory() + compactFactory := thrift.NewTCompactProtocolFactoryConf(&thrift.TConfiguration{}) _, _, err := NewJaegerThriftUDPClient("256.2.3:0", compactFactory) assert.Error(t, err) diff --git a/cmd/collector/app/handler/http_handler.go b/cmd/collector/app/handler/http_handler.go index 0124a29172b..6b93f6cc6d2 100644 --- a/cmd/collector/app/handler/http_handler.go +++ b/cmd/collector/app/handler/http_handler.go @@ -83,7 +83,7 @@ func (aH *APIHandler) SaveSpan(w http.ResponseWriter, r *http.Request) { tdes := thrift.NewTDeserializer() batch := &tJaeger.Batch{} - if err = tdes.Read(batch, bodyBytes); err != nil { + if err = tdes.Read(r.Context(), batch, bodyBytes); err != nil { http.Error(w, fmt.Sprintf(UnableToReadBodyErrFormat, err), http.StatusBadRequest) return } diff --git a/go.mod b/go.mod index e8d6e6510c5..bf6821dbbc9 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/DataDog/zstd v1.4.4 // indirect github.com/HdrHistogram/hdrhistogram-go v0.9.0 // indirect github.com/Shopify/sarama v1.22.2-0.20190604114437-cd910a683f9f - github.com/apache/thrift v0.13.0 + github.com/apache/thrift v0.14.1 github.com/bsm/sarama-cluster v2.1.13+incompatible github.com/crossdock/crossdock-go v0.0.0-20160816171116-049aabb0122b github.com/dgraph-io/badger v1.6.2 @@ -81,7 +81,4 @@ require ( honnef.co/go/tools v0.1.2 ) -replace ( - github.com/apache/thrift => github.com/jaegertracing/thrift v1.13.0-patch1 - github.com/gogo/protobuf => github.com/gogo/protobuf v1.3.2 -) +replace github.com/gogo/protobuf => github.com/gogo/protobuf v1.3.2 diff --git a/go.sum b/go.sum index da62c1eb4ab..92a7fd342ac 100644 --- a/go.sum +++ b/go.sum @@ -44,6 +44,12 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.14.0 h1:vqZ2DP42i8th2OsgCcYZkirtbzvpZEFx53LiWDJXIAs= +github.com/apache/thrift v0.14.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.14.1 h1:Yh8v0hpCj63p5edXOLaqTJW0IJ1p+eMW6+YSOqw1d6s= +github.com/apache/thrift v0.14.1/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= diff --git a/model/converter/thrift/zipkin/deserialize.go b/model/converter/thrift/zipkin/deserialize.go index 9236c9c34af..32b5e791047 100644 --- a/model/converter/thrift/zipkin/deserialize.go +++ b/model/converter/thrift/zipkin/deserialize.go @@ -16,6 +16,8 @@ package zipkin import ( + "context" + "github.com/apache/thrift/lib/go/thrift" "github.com/jaegertracing/jaeger/thrift-gen/zipkincore" @@ -23,23 +25,25 @@ import ( // SerializeThrift is only used in tests. func SerializeThrift(spans []*zipkincore.Span) []byte { + ctx := context.Background() t := thrift.NewTMemoryBuffer() - p := thrift.NewTBinaryProtocolTransport(t) - p.WriteListBegin(thrift.STRUCT, len(spans)) + p := thrift.NewTBinaryProtocolConf(t, &thrift.TConfiguration{}) + p.WriteListBegin(ctx, thrift.STRUCT, len(spans)) for _, s := range spans { - s.Write(p) + s.Write(ctx, p) } - p.WriteListEnd() + p.WriteListEnd(ctx) return t.Buffer.Bytes() } // DeserializeThrift decodes Thrift bytes to a list of spans. func DeserializeThrift(b []byte) ([]*zipkincore.Span, error) { + ctx := context.Background() buffer := thrift.NewTMemoryBuffer() buffer.Write(b) - transport := thrift.NewTBinaryProtocolTransport(buffer) - _, size, err := transport.ReadListBegin() // Ignore the returned element type + transport := thrift.NewTBinaryProtocolConf(buffer, &thrift.TConfiguration{}) + _, size, err := transport.ReadListBegin(ctx) // Ignore the returned element type if err != nil { return nil, err } @@ -49,7 +53,7 @@ func DeserializeThrift(b []byte) ([]*zipkincore.Span, error) { var spans []*zipkincore.Span for i := 0; i < size; i++ { zs := &zipkincore.Span{} - if err = zs.Read(transport); err != nil { + if err = zs.Read(ctx, transport); err != nil { return nil, err } spans = append(spans, zs) diff --git a/pkg/clientcfg/clientcfghttp/thrift-0.9.2/ttypes.go b/pkg/clientcfg/clientcfghttp/thrift-0.9.2/ttypes.go index e415878aac3..530ac478d9e 100644 --- a/pkg/clientcfg/clientcfghttp/thrift-0.9.2/ttypes.go +++ b/pkg/clientcfg/clientcfghttp/thrift-0.9.2/ttypes.go @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Autogenerated by Thrift Compiler (0.9.2) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Autogenerated by Thrift Compiler (0.9.2) but manually adapted to 0.14.x package sampling import ( "bytes" + "context" "fmt" "github.com/apache/thrift/lib/go/thrift" @@ -73,11 +73,12 @@ func (p *ProbabilisticSamplingStrategy) GetSamplingRate() float64 { return p.SamplingRate } func (p *ProbabilisticSamplingStrategy) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { + ctx := context.Background() + if _, err := iprot.ReadStructBegin(ctx); err != nil { return fmt.Errorf("%T read error: %s", p, err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) } @@ -90,22 +91,22 @@ func (p *ProbabilisticSamplingStrategy) Read(iprot thrift.TProtocol) error { return err } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return fmt.Errorf("%T read struct end error: %s", p, err) } return nil } func (p *ProbabilisticSamplingStrategy) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(); err != nil { + if v, err := iprot.ReadDouble(context.Background()); err != nil { return fmt.Errorf("error reading field 1: %s", err) } else { p.SamplingRate = v @@ -114,29 +115,31 @@ func (p *ProbabilisticSamplingStrategy) ReadField1(iprot thrift.TProtocol) error } func (p *ProbabilisticSamplingStrategy) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ProbabilisticSamplingStrategy"); err != nil { + ctx := context.Background() + if err := oprot.WriteStructBegin(ctx, "ProbabilisticSamplingStrategy"); err != nil { return fmt.Errorf("%T write struct begin error: %s", p, err) } if err := p.writeField1(oprot); err != nil { return err } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return fmt.Errorf("write field stop error: %s", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return fmt.Errorf("write struct stop error: %s", err) } return nil } func (p *ProbabilisticSamplingStrategy) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("samplingRate", thrift.DOUBLE, 1); err != nil { + ctx := context.Background() + if err := oprot.WriteFieldBegin(ctx, "samplingRate", thrift.DOUBLE, 1); err != nil { return fmt.Errorf("%T write field begin error 1:samplingRate: %s", p, err) } - if err := oprot.WriteDouble(float64(p.SamplingRate)); err != nil { + if err := oprot.WriteDouble(ctx, float64(p.SamplingRate)); err != nil { return fmt.Errorf("%T.samplingRate (1) field write error: %s", p, err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return fmt.Errorf("%T write field end error 1:samplingRate: %s", p, err) } return err @@ -161,11 +164,12 @@ func (p *RateLimitingSamplingStrategy) GetMaxTracesPerSecond() int16 { return p.MaxTracesPerSecond } func (p *RateLimitingSamplingStrategy) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { + ctx := context.Background() + if _, err := iprot.ReadStructBegin(ctx); err != nil { return fmt.Errorf("%T read error: %s", p, err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) } @@ -178,22 +182,22 @@ func (p *RateLimitingSamplingStrategy) Read(iprot thrift.TProtocol) error { return err } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return fmt.Errorf("%T read struct end error: %s", p, err) } return nil } func (p *RateLimitingSamplingStrategy) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI16(); err != nil { + if v, err := iprot.ReadI16(context.Background()); err != nil { return fmt.Errorf("error reading field 1: %s", err) } else { p.MaxTracesPerSecond = v @@ -202,29 +206,31 @@ func (p *RateLimitingSamplingStrategy) ReadField1(iprot thrift.TProtocol) error } func (p *RateLimitingSamplingStrategy) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("RateLimitingSamplingStrategy"); err != nil { + ctx := context.Background() + if err := oprot.WriteStructBegin(ctx, "RateLimitingSamplingStrategy"); err != nil { return fmt.Errorf("%T write struct begin error: %s", p, err) } if err := p.writeField1(oprot); err != nil { return err } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return fmt.Errorf("write field stop error: %s", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return fmt.Errorf("write struct stop error: %s", err) } return nil } func (p *RateLimitingSamplingStrategy) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("maxTracesPerSecond", thrift.I16, 1); err != nil { + ctx := context.Background() + if err := oprot.WriteFieldBegin(ctx, "maxTracesPerSecond", thrift.I16, 1); err != nil { return fmt.Errorf("%T write field begin error 1:maxTracesPerSecond: %s", p, err) } - if err := oprot.WriteI16(int16(p.MaxTracesPerSecond)); err != nil { + if err := oprot.WriteI16(ctx, int16(p.MaxTracesPerSecond)); err != nil { return fmt.Errorf("%T.maxTracesPerSecond (1) field write error: %s", p, err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return fmt.Errorf("%T write field end error 1:maxTracesPerSecond: %s", p, err) } return err @@ -263,11 +269,12 @@ func (p *OperationSamplingStrategy) IsSetProbabilisticSampling() bool { } func (p *OperationSamplingStrategy) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { + ctx := context.Background() + if _, err := iprot.ReadStructBegin(ctx); err != nil { return fmt.Errorf("%T read error: %s", p, err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) } @@ -284,22 +291,22 @@ func (p *OperationSamplingStrategy) Read(iprot thrift.TProtocol) error { return err } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return fmt.Errorf("%T read struct end error: %s", p, err) } return nil } func (p *OperationSamplingStrategy) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { + if v, err := iprot.ReadString(context.Background()); err != nil { return fmt.Errorf("error reading field 1: %s", err) } else { p.Operation = v @@ -316,7 +323,8 @@ func (p *OperationSamplingStrategy) ReadField2(iprot thrift.TProtocol) error { } func (p *OperationSamplingStrategy) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("OperationSamplingStrategy"); err != nil { + ctx := context.Background() + if err := oprot.WriteStructBegin(ctx, "OperationSamplingStrategy"); err != nil { return fmt.Errorf("%T write struct begin error: %s", p, err) } if err := p.writeField1(oprot); err != nil { @@ -325,36 +333,38 @@ func (p *OperationSamplingStrategy) Write(oprot thrift.TProtocol) error { if err := p.writeField2(oprot); err != nil { return err } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return fmt.Errorf("write field stop error: %s", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return fmt.Errorf("write struct stop error: %s", err) } return nil } func (p *OperationSamplingStrategy) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("operation", thrift.STRING, 1); err != nil { + ctx := context.Background() + if err := oprot.WriteFieldBegin(ctx, "operation", thrift.STRING, 1); err != nil { return fmt.Errorf("%T write field begin error 1:operation: %s", p, err) } - if err := oprot.WriteString(string(p.Operation)); err != nil { + if err := oprot.WriteString(ctx, string(p.Operation)); err != nil { return fmt.Errorf("%T.operation (1) field write error: %s", p, err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return fmt.Errorf("%T write field end error 1:operation: %s", p, err) } return err } func (p *OperationSamplingStrategy) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("probabilisticSampling", thrift.STRUCT, 2); err != nil { + ctx := context.Background() + if err := oprot.WriteFieldBegin(ctx, "probabilisticSampling", thrift.STRUCT, 2); err != nil { return fmt.Errorf("%T write field begin error 2:probabilisticSampling: %s", p, err) } if err := p.ProbabilisticSampling.Write(oprot); err != nil { return fmt.Errorf("%T error writing struct: %s", p.ProbabilisticSampling, err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return fmt.Errorf("%T write field end error 2:probabilisticSampling: %s", p, err) } return err @@ -389,11 +399,12 @@ func (p *PerOperationSamplingStrategies) GetPerOperationStrategies() []*Operatio return p.PerOperationStrategies } func (p *PerOperationSamplingStrategies) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { + ctx := context.Background() + if _, err := iprot.ReadStructBegin(ctx); err != nil { return fmt.Errorf("%T read error: %s", p, err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) } @@ -414,22 +425,22 @@ func (p *PerOperationSamplingStrategies) Read(iprot thrift.TProtocol) error { return err } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return fmt.Errorf("%T read struct end error: %s", p, err) } return nil } func (p *PerOperationSamplingStrategies) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(); err != nil { + if v, err := iprot.ReadDouble(context.Background()); err != nil { return fmt.Errorf("error reading field 1: %s", err) } else { p.DefaultSamplingProbability = v @@ -438,7 +449,7 @@ func (p *PerOperationSamplingStrategies) ReadField1(iprot thrift.TProtocol) erro } func (p *PerOperationSamplingStrategies) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(); err != nil { + if v, err := iprot.ReadDouble(context.Background()); err != nil { return fmt.Errorf("error reading field 2: %s", err) } else { p.DefaultLowerBoundTracesPerSecond = v @@ -447,7 +458,8 @@ func (p *PerOperationSamplingStrategies) ReadField2(iprot thrift.TProtocol) erro } func (p *PerOperationSamplingStrategies) ReadField3(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() + ctx := context.Background() + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return fmt.Errorf("error reading list begin: %s", err) } @@ -460,14 +472,15 @@ func (p *PerOperationSamplingStrategies) ReadField3(iprot thrift.TProtocol) erro } p.PerOperationStrategies = append(p.PerOperationStrategies, _elem0) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return fmt.Errorf("error reading list end: %s", err) } return nil } func (p *PerOperationSamplingStrategies) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("PerOperationSamplingStrategies"); err != nil { + ctx := context.Background() + if err := oprot.WriteStructBegin(ctx, "PerOperationSamplingStrategies"); err != nil { return fmt.Errorf("%T write struct begin error: %s", p, err) } if err := p.writeField1(oprot); err != nil { @@ -479,46 +492,49 @@ func (p *PerOperationSamplingStrategies) Write(oprot thrift.TProtocol) error { if err := p.writeField3(oprot); err != nil { return err } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return fmt.Errorf("write field stop error: %s", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return fmt.Errorf("write struct stop error: %s", err) } return nil } func (p *PerOperationSamplingStrategies) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("defaultSamplingProbability", thrift.DOUBLE, 1); err != nil { + ctx := context.Background() + if err := oprot.WriteFieldBegin(ctx, "defaultSamplingProbability", thrift.DOUBLE, 1); err != nil { return fmt.Errorf("%T write field begin error 1:defaultSamplingProbability: %s", p, err) } - if err := oprot.WriteDouble(float64(p.DefaultSamplingProbability)); err != nil { + if err := oprot.WriteDouble(ctx, float64(p.DefaultSamplingProbability)); err != nil { return fmt.Errorf("%T.defaultSamplingProbability (1) field write error: %s", p, err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return fmt.Errorf("%T write field end error 1:defaultSamplingProbability: %s", p, err) } return err } func (p *PerOperationSamplingStrategies) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("defaultLowerBoundTracesPerSecond", thrift.DOUBLE, 2); err != nil { + ctx := context.Background() + if err := oprot.WriteFieldBegin(ctx, "defaultLowerBoundTracesPerSecond", thrift.DOUBLE, 2); err != nil { return fmt.Errorf("%T write field begin error 2:defaultLowerBoundTracesPerSecond: %s", p, err) } - if err := oprot.WriteDouble(float64(p.DefaultLowerBoundTracesPerSecond)); err != nil { + if err := oprot.WriteDouble(ctx, float64(p.DefaultLowerBoundTracesPerSecond)); err != nil { return fmt.Errorf("%T.defaultLowerBoundTracesPerSecond (2) field write error: %s", p, err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return fmt.Errorf("%T write field end error 2:defaultLowerBoundTracesPerSecond: %s", p, err) } return err } func (p *PerOperationSamplingStrategies) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("perOperationStrategies", thrift.LIST, 3); err != nil { + ctx := context.Background() + if err := oprot.WriteFieldBegin(ctx, "perOperationStrategies", thrift.LIST, 3); err != nil { return fmt.Errorf("%T write field begin error 3:perOperationStrategies: %s", p, err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.PerOperationStrategies)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.PerOperationStrategies)); err != nil { return fmt.Errorf("error writing list begin: %s", err) } for _, v := range p.PerOperationStrategies { @@ -526,10 +542,10 @@ func (p *PerOperationSamplingStrategies) writeField3(oprot thrift.TProtocol) (er return fmt.Errorf("%T error writing struct: %s", v, err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return fmt.Errorf("error writing list end: %s", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return fmt.Errorf("%T write field end error 3:perOperationStrategies: %s", p, err) } return err @@ -596,11 +612,12 @@ func (p *SamplingStrategyResponse) IsSetOperationSampling() bool { } func (p *SamplingStrategyResponse) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { + ctx := context.Background() + if _, err := iprot.ReadStructBegin(ctx); err != nil { return fmt.Errorf("%T read error: %s", p, err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) } @@ -625,22 +642,22 @@ func (p *SamplingStrategyResponse) Read(iprot thrift.TProtocol) error { return err } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return fmt.Errorf("%T read struct end error: %s", p, err) } return nil } func (p *SamplingStrategyResponse) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { + if v, err := iprot.ReadI32(context.Background()); err != nil { return fmt.Errorf("error reading field 1: %s", err) } else { temp := SamplingStrategyType(v) @@ -674,7 +691,8 @@ func (p *SamplingStrategyResponse) ReadField4(iprot thrift.TProtocol) error { } func (p *SamplingStrategyResponse) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("SamplingStrategyResponse"); err != nil { + ctx := context.Background() + if err := oprot.WriteStructBegin(ctx, "SamplingStrategyResponse"); err != nil { return fmt.Errorf("%T write struct begin error: %s", p, err) } if err := p.writeField1(oprot); err != nil { @@ -689,37 +707,39 @@ func (p *SamplingStrategyResponse) Write(oprot thrift.TProtocol) error { if err := p.writeField4(oprot); err != nil { return err } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return fmt.Errorf("write field stop error: %s", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return fmt.Errorf("write struct stop error: %s", err) } return nil } func (p *SamplingStrategyResponse) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("strategyType", thrift.I32, 1); err != nil { + ctx := context.Background() + if err := oprot.WriteFieldBegin(ctx, "strategyType", thrift.I32, 1); err != nil { return fmt.Errorf("%T write field begin error 1:strategyType: %s", p, err) } - if err := oprot.WriteI32(int32(p.StrategyType)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.StrategyType)); err != nil { return fmt.Errorf("%T.strategyType (1) field write error: %s", p, err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return fmt.Errorf("%T write field end error 1:strategyType: %s", p, err) } return err } func (p *SamplingStrategyResponse) writeField2(oprot thrift.TProtocol) (err error) { + ctx := context.Background() if p.IsSetProbabilisticSampling() { - if err := oprot.WriteFieldBegin("probabilisticSampling", thrift.STRUCT, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "probabilisticSampling", thrift.STRUCT, 2); err != nil { return fmt.Errorf("%T write field begin error 2:probabilisticSampling: %s", p, err) } if err := p.ProbabilisticSampling.Write(oprot); err != nil { return fmt.Errorf("%T error writing struct: %s", p.ProbabilisticSampling, err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return fmt.Errorf("%T write field end error 2:probabilisticSampling: %s", p, err) } } @@ -727,14 +747,15 @@ func (p *SamplingStrategyResponse) writeField2(oprot thrift.TProtocol) (err erro } func (p *SamplingStrategyResponse) writeField3(oprot thrift.TProtocol) (err error) { + ctx := context.Background() if p.IsSetRateLimitingSampling() { - if err := oprot.WriteFieldBegin("rateLimitingSampling", thrift.STRUCT, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "rateLimitingSampling", thrift.STRUCT, 3); err != nil { return fmt.Errorf("%T write field begin error 3:rateLimitingSampling: %s", p, err) } if err := p.RateLimitingSampling.Write(oprot); err != nil { return fmt.Errorf("%T error writing struct: %s", p.RateLimitingSampling, err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return fmt.Errorf("%T write field end error 3:rateLimitingSampling: %s", p, err) } } @@ -742,14 +763,15 @@ func (p *SamplingStrategyResponse) writeField3(oprot thrift.TProtocol) (err erro } func (p *SamplingStrategyResponse) writeField4(oprot thrift.TProtocol) (err error) { + ctx := context.Background() if p.IsSetOperationSampling() { - if err := oprot.WriteFieldBegin("operationSampling", thrift.STRUCT, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "operationSampling", thrift.STRUCT, 4); err != nil { return fmt.Errorf("%T write field begin error 4:operationSampling: %s", p, err) } if err := p.OperationSampling.Write(oprot); err != nil { return fmt.Errorf("%T error writing struct: %s", p.OperationSampling, err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return fmt.Errorf("%T write field end error 4:operationSampling: %s", p, err) } } diff --git a/thrift-gen/agent/GoUnusedProtection__.go b/thrift-gen/agent/GoUnusedProtection__.go index d5d8778a98c..54cd3b0867a 100644 --- a/thrift-gen/agent/GoUnusedProtection__.go +++ b/thrift-gen/agent/GoUnusedProtection__.go @@ -1,5 +1,4 @@ -// Autogenerated by Thrift Compiler (0.13.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. package agent diff --git a/thrift-gen/agent/agent-consts.go b/thrift-gen/agent/agent-consts.go index 2b10eb84787..af972ea8b60 100644 --- a/thrift-gen/agent/agent-consts.go +++ b/thrift-gen/agent/agent-consts.go @@ -1,13 +1,12 @@ -// Autogenerated by Thrift Compiler (0.13.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. package agent import( "bytes" "context" - "reflect" "fmt" + "time" "github.com/apache/thrift/lib/go/thrift" "github.com/jaegertracing/jaeger/thrift-gen/jaeger" "github.com/jaegertracing/jaeger/thrift-gen/zipkincore" @@ -18,7 +17,7 @@ import( var _ = thrift.ZERO var _ = fmt.Printf var _ = context.Background -var _ = reflect.DeepEqual +var _ = time.Now var _ = bytes.Equal var _ = jaeger.GoUnusedProtection__ diff --git a/thrift-gen/agent/agent.go b/thrift-gen/agent/agent.go index 659dafe25a0..cc68b54f92d 100644 --- a/thrift-gen/agent/agent.go +++ b/thrift-gen/agent/agent.go @@ -1,13 +1,12 @@ -// Autogenerated by Thrift Compiler (0.13.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. package agent import( "bytes" "context" - "reflect" "fmt" + "time" "github.com/apache/thrift/lib/go/thrift" "github.com/jaegertracing/jaeger/thrift-gen/jaeger" "github.com/jaegertracing/jaeger/thrift-gen/zipkincore" @@ -18,7 +17,7 @@ import( var _ = thrift.ZERO var _ = fmt.Printf var _ = context.Background -var _ = reflect.DeepEqual +var _ = time.Now var _ = bytes.Equal var _ = jaeger.GoUnusedProtection__ @@ -26,14 +25,15 @@ var _ = zipkincore.GoUnusedProtection__ type Agent interface { // Parameters: // - Spans - EmitZipkinBatch(ctx context.Context, spans []*zipkincore.Span) (err error) + EmitZipkinBatch(ctx context.Context, spans []*zipkincore.Span) (_err error) // Parameters: // - Batch - EmitBatch(ctx context.Context, batch *jaeger.Batch) (err error) + EmitBatch(ctx context.Context, batch *jaeger.Batch) (_err error) } type AgentClient struct { c thrift.TClient + meta thrift.ResponseMeta } func NewAgentClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *AgentClient { @@ -57,12 +57,22 @@ func NewAgentClient(c thrift.TClient) *AgentClient { func (p *AgentClient) Client_() thrift.TClient { return p.c } + +func (p *AgentClient) LastResponseMeta_() thrift.ResponseMeta { + return p.meta +} + +func (p *AgentClient) SetLastResponseMeta_(meta thrift.ResponseMeta) { + p.meta = meta +} + // Parameters: // - Spans -func (p *AgentClient) EmitZipkinBatch(ctx context.Context, spans []*zipkincore.Span) (err error) { +func (p *AgentClient) EmitZipkinBatch(ctx context.Context, spans []*zipkincore.Span) (_err error) { var _args0 AgentEmitZipkinBatchArgs _args0.Spans = spans - if err := p.Client_().Call(ctx, "emitZipkinBatch", &_args0, nil); err != nil { + p.SetLastResponseMeta_(thrift.ResponseMeta{}) + if _, err := p.Client_().Call(ctx, "emitZipkinBatch", &_args0, nil); err != nil { return err } return nil @@ -70,10 +80,11 @@ func (p *AgentClient) EmitZipkinBatch(ctx context.Context, spans []*zipkincore.S // Parameters: // - Batch -func (p *AgentClient) EmitBatch(ctx context.Context, batch *jaeger.Batch) (err error) { +func (p *AgentClient) EmitBatch(ctx context.Context, batch *jaeger.Batch) (_err error) { var _args1 AgentEmitBatchArgs _args1.Batch = batch - if err := p.Client_().Call(ctx, "emitBatch", &_args1, nil); err != nil { + p.SetLastResponseMeta_(thrift.ResponseMeta{}) + if _, err := p.Client_().Call(ctx, "emitBatch", &_args1, nil); err != nil { return err } return nil @@ -106,17 +117,17 @@ return self2 } func (p *AgentProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - name, _, seqId, err := iprot.ReadMessageBegin() - if err != nil { return false, err } + name, _, seqId, err2 := iprot.ReadMessageBegin(ctx) + if err2 != nil { return false, thrift.WrapTException(err2) } if processor, ok := p.GetProcessorFunction(name); ok { return processor.Process(ctx, seqId, iprot, oprot) } - iprot.Skip(thrift.STRUCT) - iprot.ReadMessageEnd() + iprot.Skip(ctx, thrift.STRUCT) + iprot.ReadMessageEnd(ctx) x3 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name) - oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) - x3.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId) + x3.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) return false, x3 @@ -128,16 +139,21 @@ type agentProcessorEmitZipkinBatch struct { func (p *agentProcessorEmitZipkinBatch) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AgentEmitZipkinBatchArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - return false, err + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + return false, thrift.WrapTException(err2) } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + _ = tickerCancel - iprot.ReadMessageEnd() - var err2 error if err2 = p.handler.EmitZipkinBatch(ctx, args.Spans); err2 != nil { - return true, err2 + tickerCancel() + return true, thrift.WrapTException(err2) } + tickerCancel() return true, nil } @@ -147,16 +163,21 @@ type agentProcessorEmitBatch struct { func (p *agentProcessorEmitBatch) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := AgentEmitBatchArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - return false, err + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + return false, thrift.WrapTException(err2) } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + _ = tickerCancel - iprot.ReadMessageEnd() - var err2 error if err2 = p.handler.EmitBatch(ctx, args.Batch); err2 != nil { - return true, err2 + tickerCancel() + return true, thrift.WrapTException(err2) } + tickerCancel() return true, nil } @@ -177,14 +198,14 @@ func NewAgentEmitZipkinBatchArgs() *AgentEmitZipkinBatchArgs { func (p *AgentEmitZipkinBatchArgs) GetSpans() []*zipkincore.Span { return p.Spans } -func (p *AgentEmitZipkinBatchArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AgentEmitZipkinBatchArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -192,31 +213,31 @@ func (p *AgentEmitZipkinBatchArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.LIST { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AgentEmitZipkinBatchArgs) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *AgentEmitZipkinBatchArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } @@ -224,45 +245,45 @@ func (p *AgentEmitZipkinBatchArgs) ReadField1(iprot thrift.TProtocol) error { p.Spans = tSlice for i := 0; i < size; i ++ { _elem4 := &zipkincore.Span{} - if err := _elem4.Read(iprot); err != nil { + if err := _elem4.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err) } p.Spans = append(p.Spans, _elem4) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *AgentEmitZipkinBatchArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("emitZipkinBatch_args"); err != nil { +func (p *AgentEmitZipkinBatchArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "emitZipkinBatch_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AgentEmitZipkinBatchArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("spans", thrift.LIST, 1); err != nil { +func (p *AgentEmitZipkinBatchArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "spans", thrift.LIST, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:spans: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Spans)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Spans)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Spans { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:spans: ", p), err) } return err } @@ -295,14 +316,14 @@ func (p *AgentEmitBatchArgs) IsSetBatch() bool { return p.Batch != nil } -func (p *AgentEmitBatchArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *AgentEmitBatchArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -310,57 +331,57 @@ func (p *AgentEmitBatchArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *AgentEmitBatchArgs) ReadField1(iprot thrift.TProtocol) error { +func (p *AgentEmitBatchArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Batch = &jaeger.Batch{} - if err := p.Batch.Read(iprot); err != nil { + if err := p.Batch.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Batch), err) } return nil } -func (p *AgentEmitBatchArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("emitBatch_args"); err != nil { +func (p *AgentEmitBatchArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "emitBatch_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *AgentEmitBatchArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("batch", thrift.STRUCT, 1); err != nil { +func (p *AgentEmitBatchArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "batch", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:batch: ", p), err) } - if err := p.Batch.Write(oprot); err != nil { + if err := p.Batch.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Batch), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:batch: ", p), err) } return err } diff --git a/thrift-gen/baggage/GoUnusedProtection__.go b/thrift-gen/baggage/GoUnusedProtection__.go index d872b3b7d72..712b6a9da4c 100644 --- a/thrift-gen/baggage/GoUnusedProtection__.go +++ b/thrift-gen/baggage/GoUnusedProtection__.go @@ -1,5 +1,4 @@ -// Autogenerated by Thrift Compiler (0.13.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. package baggage diff --git a/thrift-gen/baggage/baggage-consts.go b/thrift-gen/baggage/baggage-consts.go index cf8fb2102bc..0eeb8239f97 100644 --- a/thrift-gen/baggage/baggage-consts.go +++ b/thrift-gen/baggage/baggage-consts.go @@ -1,13 +1,12 @@ -// Autogenerated by Thrift Compiler (0.13.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. package baggage import( "bytes" "context" - "reflect" "fmt" + "time" "github.com/apache/thrift/lib/go/thrift" ) @@ -15,7 +14,7 @@ import( var _ = thrift.ZERO var _ = fmt.Printf var _ = context.Background -var _ = reflect.DeepEqual +var _ = time.Now var _ = bytes.Equal diff --git a/thrift-gen/baggage/baggage.go b/thrift-gen/baggage/baggage.go index ff7e815138f..40134450580 100644 --- a/thrift-gen/baggage/baggage.go +++ b/thrift-gen/baggage/baggage.go @@ -1,13 +1,12 @@ -// Autogenerated by Thrift Compiler (0.13.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. package baggage import( "bytes" "context" - "reflect" "fmt" + "time" "github.com/apache/thrift/lib/go/thrift" ) @@ -15,7 +14,7 @@ import( var _ = thrift.ZERO var _ = fmt.Printf var _ = context.Background -var _ = reflect.DeepEqual +var _ = time.Now var _ = bytes.Equal // Attributes: @@ -38,8 +37,8 @@ func (p *BaggageRestriction) GetBaggageKey() string { func (p *BaggageRestriction) GetMaxValueLength() int32 { return p.MaxValueLength } -func (p *BaggageRestriction) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *BaggageRestriction) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -47,7 +46,7 @@ func (p *BaggageRestriction) Read(iprot thrift.TProtocol) error { var issetMaxValueLength bool = false; for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -55,36 +54,36 @@ func (p *BaggageRestriction) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } issetBaggageKey = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } issetMaxValueLength = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } if !issetBaggageKey{ @@ -96,8 +95,8 @@ func (p *BaggageRestriction) Read(iprot thrift.TProtocol) error { return nil } -func (p *BaggageRestriction) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *BaggageRestriction) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.BaggageKey = v @@ -105,8 +104,8 @@ func (p *BaggageRestriction) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *BaggageRestriction) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *BaggageRestriction) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.MaxValueLength = v @@ -114,40 +113,51 @@ func (p *BaggageRestriction) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *BaggageRestriction) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("BaggageRestriction"); err != nil { +func (p *BaggageRestriction) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "BaggageRestriction"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *BaggageRestriction) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("baggageKey", thrift.STRING, 1); err != nil { +func (p *BaggageRestriction) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "baggageKey", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:baggageKey: ", p), err) } - if err := oprot.WriteString(string(p.BaggageKey)); err != nil { + if err := oprot.WriteString(ctx, string(p.BaggageKey)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.baggageKey (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:baggageKey: ", p), err) } return err } -func (p *BaggageRestriction) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("maxValueLength", thrift.I32, 2); err != nil { +func (p *BaggageRestriction) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "maxValueLength", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:maxValueLength: ", p), err) } - if err := oprot.WriteI32(int32(p.MaxValueLength)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.MaxValueLength)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.maxValueLength (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:maxValueLength: ", p), err) } return err } +func (p *BaggageRestriction) Equals(other *BaggageRestriction) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.BaggageKey != other.BaggageKey { return false } + if p.MaxValueLength != other.MaxValueLength { return false } + return true +} + func (p *BaggageRestriction) String() string { if p == nil { return "" @@ -162,11 +172,12 @@ type BaggageRestrictionManager interface { // // Parameters: // - ServiceName - GetBaggageRestrictions(ctx context.Context, serviceName string) (r []*BaggageRestriction, err error) + GetBaggageRestrictions(ctx context.Context, serviceName string) (_r []*BaggageRestriction, _err error) } type BaggageRestrictionManagerClient struct { c thrift.TClient + meta thrift.ResponseMeta } func NewBaggageRestrictionManagerClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *BaggageRestrictionManagerClient { @@ -190,20 +201,32 @@ func NewBaggageRestrictionManagerClient(c thrift.TClient) *BaggageRestrictionMan func (p *BaggageRestrictionManagerClient) Client_() thrift.TClient { return p.c } + +func (p *BaggageRestrictionManagerClient) LastResponseMeta_() thrift.ResponseMeta { + return p.meta +} + +func (p *BaggageRestrictionManagerClient) SetLastResponseMeta_(meta thrift.ResponseMeta) { + p.meta = meta +} + // getBaggageRestrictions retrieves the baggage restrictions for a specific service. // Usually, baggageRestrictions apply to all services however there may be situations // where a baggageKey might only be allowed to be set by a specific service. // // Parameters: // - ServiceName -func (p *BaggageRestrictionManagerClient) GetBaggageRestrictions(ctx context.Context, serviceName string) (r []*BaggageRestriction, err error) { +func (p *BaggageRestrictionManagerClient) GetBaggageRestrictions(ctx context.Context, serviceName string) (_r []*BaggageRestriction, _err error) { var _args0 BaggageRestrictionManagerGetBaggageRestrictionsArgs _args0.ServiceName = serviceName - var _result1 BaggageRestrictionManagerGetBaggageRestrictionsResult - if err = p.Client_().Call(ctx, "getBaggageRestrictions", &_args0, &_result1); err != nil { + var _result2 BaggageRestrictionManagerGetBaggageRestrictionsResult + var _meta1 thrift.ResponseMeta + _meta1, _err = p.Client_().Call(ctx, "getBaggageRestrictions", &_args0, &_result2) + p.SetLastResponseMeta_(_meta1) + if _err != nil { return } - return _result1.GetSuccess(), nil + return _result2.GetSuccess(), nil } type BaggageRestrictionManagerProcessor struct { @@ -226,25 +249,25 @@ func (p *BaggageRestrictionManagerProcessor) ProcessorMap() map[string]thrift.TP func NewBaggageRestrictionManagerProcessor(handler BaggageRestrictionManager) *BaggageRestrictionManagerProcessor { - self2 := &BaggageRestrictionManagerProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)} - self2.processorMap["getBaggageRestrictions"] = &baggageRestrictionManagerProcessorGetBaggageRestrictions{handler:handler} -return self2 + self3 := &BaggageRestrictionManagerProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)} + self3.processorMap["getBaggageRestrictions"] = &baggageRestrictionManagerProcessorGetBaggageRestrictions{handler:handler} +return self3 } func (p *BaggageRestrictionManagerProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - name, _, seqId, err := iprot.ReadMessageBegin() - if err != nil { return false, err } + name, _, seqId, err2 := iprot.ReadMessageBegin(ctx) + if err2 != nil { return false, thrift.WrapTException(err2) } if processor, ok := p.GetProcessorFunction(name); ok { return processor.Process(ctx, seqId, iprot, oprot) } - iprot.Skip(thrift.STRUCT) - iprot.ReadMessageEnd() - x3 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name) - oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) - x3.Write(oprot) - oprot.WriteMessageEnd() + iprot.Skip(ctx, thrift.STRUCT) + iprot.ReadMessageEnd(ctx) + x4 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name) + oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId) + x4.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, x3 + return false, x4 } @@ -254,41 +277,72 @@ type baggageRestrictionManagerProcessorGetBaggageRestrictions struct { func (p *baggageRestrictionManagerProcessorGetBaggageRestrictions) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := BaggageRestrictionManagerGetBaggageRestrictionsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getBaggageRestrictions", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getBaggageRestrictions", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := BaggageRestrictionManagerGetBaggageRestrictionsResult{} -var retval []*BaggageRestriction - var err2 error + var retval []*BaggageRestriction if retval, err2 = p.handler.GetBaggageRestrictions(ctx, args.ServiceName); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getBaggageRestrictions: " + err2.Error()) - oprot.WriteMessageBegin("getBaggageRestrictions", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getBaggageRestrictions", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getBaggageRestrictions", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getBaggageRestrictions", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -313,14 +367,14 @@ func NewBaggageRestrictionManagerGetBaggageRestrictionsArgs() *BaggageRestrictio func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) GetServiceName() string { return p.ServiceName } -func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -328,31 +382,31 @@ func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) Read(iprot thrift. switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.ServiceName = v @@ -360,25 +414,25 @@ func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) ReadField1(iprot return nil } -func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getBaggageRestrictions_args"); err != nil { +func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getBaggageRestrictions_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("serviceName", thrift.STRING, 1); err != nil { +func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "serviceName", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:serviceName: ", p), err) } - if err := oprot.WriteString(string(p.ServiceName)); err != nil { + if err := oprot.WriteString(ctx, string(p.ServiceName)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.serviceName (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:serviceName: ", p), err) } return err } @@ -409,14 +463,14 @@ func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) IsSetSuccess() b return p.Success != nil } -func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -424,78 +478,78 @@ func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) Read(iprot thrif switch fieldId { case 0: if fieldTypeId == thrift.LIST { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) ReadField0(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*BaggageRestriction, 0, size) p.Success = tSlice for i := 0; i < size; i ++ { - _elem4 := &BaggageRestriction{} - if err := _elem4.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err) + _elem5 := &BaggageRestriction{} + if err := _elem5.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem5), err) } - p.Success = append(p.Success, _elem4) + p.Success = append(p.Success, _elem5) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getBaggageRestrictions_result"); err != nil { +func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getBaggageRestrictions_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.LIST, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Success)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Success)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Success { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err diff --git a/thrift-gen/jaeger/GoUnusedProtection__.go b/thrift-gen/jaeger/GoUnusedProtection__.go index 6ed0be9d041..fe45a9f9ad2 100644 --- a/thrift-gen/jaeger/GoUnusedProtection__.go +++ b/thrift-gen/jaeger/GoUnusedProtection__.go @@ -1,5 +1,4 @@ -// Autogenerated by Thrift Compiler (0.13.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. package jaeger diff --git a/thrift-gen/jaeger/jaeger-consts.go b/thrift-gen/jaeger/jaeger-consts.go index 187cb41518d..ca723e29f1a 100644 --- a/thrift-gen/jaeger/jaeger-consts.go +++ b/thrift-gen/jaeger/jaeger-consts.go @@ -1,13 +1,12 @@ -// Autogenerated by Thrift Compiler (0.13.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. package jaeger import( "bytes" "context" - "reflect" "fmt" + "time" "github.com/apache/thrift/lib/go/thrift" ) @@ -15,7 +14,7 @@ import( var _ = thrift.ZERO var _ = fmt.Printf var _ = context.Background -var _ = reflect.DeepEqual +var _ = time.Now var _ = bytes.Equal diff --git a/thrift-gen/jaeger/jaeger.go b/thrift-gen/jaeger/jaeger.go index 1e8cb9f3243..9a55459f33f 100644 --- a/thrift-gen/jaeger/jaeger.go +++ b/thrift-gen/jaeger/jaeger.go @@ -1,15 +1,14 @@ -// Autogenerated by Thrift Compiler (0.13.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. package jaeger import( "bytes" "context" - "reflect" "database/sql/driver" "errors" "fmt" + "time" "github.com/apache/thrift/lib/go/thrift" ) @@ -17,7 +16,7 @@ import( var _ = thrift.ZERO var _ = fmt.Printf var _ = context.Background -var _ = reflect.DeepEqual +var _ = time.Now var _ = bytes.Equal type TagType int64 @@ -218,8 +217,8 @@ func (p *Tag) IsSetVBinary() bool { return p.VBinary != nil } -func (p *Tag) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Tag) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -227,7 +226,7 @@ func (p *Tag) Read(iprot thrift.TProtocol) error { var issetVType bool = false; for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -235,86 +234,86 @@ func (p *Tag) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } issetKey = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I32 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } issetVType = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.DOUBLE { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.BOOL { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.I64 { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: if fieldTypeId == thrift.STRING { - if err := p.ReadField7(iprot); err != nil { + if err := p.ReadField7(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } if !issetKey{ @@ -326,8 +325,8 @@ func (p *Tag) Read(iprot thrift.TProtocol) error { return nil } -func (p *Tag) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Tag) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Key = v @@ -335,8 +334,8 @@ func (p *Tag) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Tag) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *Tag) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { temp := TagType(v) @@ -345,8 +344,8 @@ func (p *Tag) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Tag) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Tag) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.VStr = &v @@ -354,8 +353,8 @@ func (p *Tag) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *Tag) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(); err != nil { +func (p *Tag) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadDouble(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.VDouble = &v @@ -363,8 +362,8 @@ func (p *Tag) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *Tag) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *Tag) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 5: ", err) } else { p.VBool = &v @@ -372,8 +371,8 @@ func (p *Tag) ReadField5(iprot thrift.TProtocol) error { return nil } -func (p *Tag) ReadField6(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Tag) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 6: ", err) } else { p.VLong = &v @@ -381,8 +380,8 @@ func (p *Tag) ReadField6(iprot thrift.TProtocol) error { return nil } -func (p *Tag) ReadField7(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBinary(); err != nil { +func (p *Tag) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBinary(ctx); err != nil { return thrift.PrependError("error reading field 7: ", err) } else { p.VBinary = v @@ -390,105 +389,141 @@ func (p *Tag) ReadField7(iprot thrift.TProtocol) error { return nil } -func (p *Tag) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Tag"); err != nil { +func (p *Tag) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Tag"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } - if err := p.writeField7(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Tag) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("key", thrift.STRING, 1); err != nil { +func (p *Tag) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) } - if err := oprot.WriteString(string(p.Key)); err != nil { + if err := oprot.WriteString(ctx, string(p.Key)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) } return err } -func (p *Tag) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("vType", thrift.I32, 2); err != nil { +func (p *Tag) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "vType", thrift.I32, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:vType: ", p), err) } - if err := oprot.WriteI32(int32(p.VType)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.VType)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.vType (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:vType: ", p), err) } return err } -func (p *Tag) writeField3(oprot thrift.TProtocol) (err error) { +func (p *Tag) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetVStr() { - if err := oprot.WriteFieldBegin("vStr", thrift.STRING, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "vStr", thrift.STRING, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:vStr: ", p), err) } - if err := oprot.WriteString(string(*p.VStr)); err != nil { + if err := oprot.WriteString(ctx, string(*p.VStr)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.vStr (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:vStr: ", p), err) } } return err } -func (p *Tag) writeField4(oprot thrift.TProtocol) (err error) { +func (p *Tag) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetVDouble() { - if err := oprot.WriteFieldBegin("vDouble", thrift.DOUBLE, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "vDouble", thrift.DOUBLE, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:vDouble: ", p), err) } - if err := oprot.WriteDouble(float64(*p.VDouble)); err != nil { + if err := oprot.WriteDouble(ctx, float64(*p.VDouble)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.vDouble (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:vDouble: ", p), err) } } return err } -func (p *Tag) writeField5(oprot thrift.TProtocol) (err error) { +func (p *Tag) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetVBool() { - if err := oprot.WriteFieldBegin("vBool", thrift.BOOL, 5); err != nil { + if err := oprot.WriteFieldBegin(ctx, "vBool", thrift.BOOL, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:vBool: ", p), err) } - if err := oprot.WriteBool(bool(*p.VBool)); err != nil { + if err := oprot.WriteBool(ctx, bool(*p.VBool)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.vBool (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:vBool: ", p), err) } } return err } -func (p *Tag) writeField6(oprot thrift.TProtocol) (err error) { +func (p *Tag) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetVLong() { - if err := oprot.WriteFieldBegin("vLong", thrift.I64, 6); err != nil { + if err := oprot.WriteFieldBegin(ctx, "vLong", thrift.I64, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:vLong: ", p), err) } - if err := oprot.WriteI64(int64(*p.VLong)); err != nil { + if err := oprot.WriteI64(ctx, int64(*p.VLong)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.vLong (6) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 6:vLong: ", p), err) } } return err } -func (p *Tag) writeField7(oprot thrift.TProtocol) (err error) { +func (p *Tag) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetVBinary() { - if err := oprot.WriteFieldBegin("vBinary", thrift.STRING, 7); err != nil { + if err := oprot.WriteFieldBegin(ctx, "vBinary", thrift.STRING, 7); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:vBinary: ", p), err) } - if err := oprot.WriteBinary(p.VBinary); err != nil { + if err := oprot.WriteBinary(ctx, p.VBinary); err != nil { return thrift.PrependError(fmt.Sprintf("%T.vBinary (7) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 7:vBinary: ", p), err) } } return err } +func (p *Tag) Equals(other *Tag) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Key != other.Key { return false } + if p.VType != other.VType { return false } + if p.VStr != other.VStr { + if p.VStr == nil || other.VStr == nil { + return false + } + if (*p.VStr) != (*other.VStr) { return false } + } + if p.VDouble != other.VDouble { + if p.VDouble == nil || other.VDouble == nil { + return false + } + if (*p.VDouble) != (*other.VDouble) { return false } + } + if p.VBool != other.VBool { + if p.VBool == nil || other.VBool == nil { + return false + } + if (*p.VBool) != (*other.VBool) { return false } + } + if p.VLong != other.VLong { + if p.VLong == nil || other.VLong == nil { + return false + } + if (*p.VLong) != (*other.VLong) { return false } + } + if bytes.Compare(p.VBinary, other.VBinary) != 0 { return false } + return true +} + func (p *Tag) String() string { if p == nil { return "" @@ -516,8 +551,8 @@ func (p *Log) GetTimestamp() int64 { func (p *Log) GetFields() []*Tag { return p.Fields } -func (p *Log) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Log) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -525,7 +560,7 @@ func (p *Log) Read(iprot thrift.TProtocol) error { var issetFields bool = false; for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -533,36 +568,36 @@ func (p *Log) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I64 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } issetTimestamp = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.LIST { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } issetFields = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } if !issetTimestamp{ @@ -574,8 +609,8 @@ func (p *Log) Read(iprot thrift.TProtocol) error { return nil } -func (p *Log) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Log) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Timestamp = v @@ -583,8 +618,8 @@ func (p *Log) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Log) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *Log) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } @@ -592,60 +627,75 @@ func (p *Log) ReadField2(iprot thrift.TProtocol) error { p.Fields = tSlice for i := 0; i < size; i ++ { _elem0 := &Tag{} - if err := _elem0.Read(iprot); err != nil { + if err := _elem0.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem0), err) } p.Fields = append(p.Fields, _elem0) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *Log) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Log"); err != nil { +func (p *Log) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Log"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Log) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timestamp", thrift.I64, 1); err != nil { +func (p *Log) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:timestamp: ", p), err) } - if err := oprot.WriteI64(int64(p.Timestamp)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.Timestamp)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.timestamp (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:timestamp: ", p), err) } return err } -func (p *Log) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("fields", thrift.LIST, 2); err != nil { +func (p *Log) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "fields", thrift.LIST, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:fields: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Fields)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Fields)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Fields { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:fields: ", p), err) } return err } +func (p *Log) Equals(other *Log) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Timestamp != other.Timestamp { return false } + if len(p.Fields) != len(other.Fields) { return false } + for i, _tgt := range p.Fields { + _src1 := other.Fields[i] + if !_tgt.Equals(_src1) { return false } + } + return true +} + func (p *Log) String() string { if p == nil { return "" @@ -685,8 +735,8 @@ func (p *SpanRef) GetTraceIdHigh() int64 { func (p *SpanRef) GetSpanId() int64 { return p.SpanId } -func (p *SpanRef) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *SpanRef) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -696,7 +746,7 @@ func (p *SpanRef) Read(iprot thrift.TProtocol) error { var issetSpanId bool = false; for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -704,58 +754,58 @@ func (p *SpanRef) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } issetRefType = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I64 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } issetTraceIdLow = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I64 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } issetTraceIdHigh = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.I64 { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } issetSpanId = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } if !issetRefType{ @@ -773,8 +823,8 @@ func (p *SpanRef) Read(iprot thrift.TProtocol) error { return nil } -func (p *SpanRef) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *SpanRef) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { temp := SpanRefType(v) @@ -783,8 +833,8 @@ func (p *SpanRef) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *SpanRef) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *SpanRef) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.TraceIdLow = v @@ -792,8 +842,8 @@ func (p *SpanRef) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *SpanRef) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *SpanRef) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.TraceIdHigh = v @@ -801,8 +851,8 @@ func (p *SpanRef) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *SpanRef) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *SpanRef) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.SpanId = v @@ -810,62 +860,75 @@ func (p *SpanRef) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *SpanRef) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("SpanRef"); err != nil { +func (p *SpanRef) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "SpanRef"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *SpanRef) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("refType", thrift.I32, 1); err != nil { +func (p *SpanRef) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "refType", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:refType: ", p), err) } - if err := oprot.WriteI32(int32(p.RefType)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.RefType)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.refType (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:refType: ", p), err) } return err } -func (p *SpanRef) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("traceIdLow", thrift.I64, 2); err != nil { +func (p *SpanRef) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "traceIdLow", thrift.I64, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:traceIdLow: ", p), err) } - if err := oprot.WriteI64(int64(p.TraceIdLow)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.TraceIdLow)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.traceIdLow (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:traceIdLow: ", p), err) } return err } -func (p *SpanRef) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("traceIdHigh", thrift.I64, 3); err != nil { +func (p *SpanRef) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "traceIdHigh", thrift.I64, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:traceIdHigh: ", p), err) } - if err := oprot.WriteI64(int64(p.TraceIdHigh)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.TraceIdHigh)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.traceIdHigh (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:traceIdHigh: ", p), err) } return err } -func (p *SpanRef) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("spanId", thrift.I64, 4); err != nil { +func (p *SpanRef) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "spanId", thrift.I64, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:spanId: ", p), err) } - if err := oprot.WriteI64(int64(p.SpanId)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.SpanId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.spanId (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:spanId: ", p), err) } return err } +func (p *SpanRef) Equals(other *SpanRef) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.RefType != other.RefType { return false } + if p.TraceIdLow != other.TraceIdLow { return false } + if p.TraceIdHigh != other.TraceIdHigh { return false } + if p.SpanId != other.SpanId { return false } + return true +} + func (p *SpanRef) String() string { if p == nil { return "" @@ -962,8 +1025,8 @@ func (p *Span) IsSetLogs() bool { return p.Logs != nil } -func (p *Span) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Span) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -977,7 +1040,7 @@ func (p *Span) Read(iprot thrift.TProtocol) error { var issetDuration bool = false; for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -985,132 +1048,132 @@ func (p *Span) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I64 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } issetTraceIdLow = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I64 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } issetTraceIdHigh = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I64 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } issetSpanId = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.I64 { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } issetParentSpanId = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.STRING { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } issetOperationName = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.LIST { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 7: if fieldTypeId == thrift.I32 { - if err := p.ReadField7(iprot); err != nil { + if err := p.ReadField7(ctx, iprot); err != nil { return err } issetFlags = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 8: if fieldTypeId == thrift.I64 { - if err := p.ReadField8(iprot); err != nil { + if err := p.ReadField8(ctx, iprot); err != nil { return err } issetStartTime = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 9: if fieldTypeId == thrift.I64 { - if err := p.ReadField9(iprot); err != nil { + if err := p.ReadField9(ctx, iprot); err != nil { return err } issetDuration = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 10: if fieldTypeId == thrift.LIST { - if err := p.ReadField10(iprot); err != nil { + if err := p.ReadField10(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 11: if fieldTypeId == thrift.LIST { - if err := p.ReadField11(iprot); err != nil { + if err := p.ReadField11(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } if !issetTraceIdLow{ @@ -1140,8 +1203,8 @@ func (p *Span) Read(iprot thrift.TProtocol) error { return nil } -func (p *Span) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Span) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.TraceIdLow = v @@ -1149,8 +1212,8 @@ func (p *Span) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Span) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Span) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.TraceIdHigh = v @@ -1158,8 +1221,8 @@ func (p *Span) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Span) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Span) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.SpanId = v @@ -1167,8 +1230,8 @@ func (p *Span) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *Span) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Span) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.ParentSpanId = v @@ -1176,8 +1239,8 @@ func (p *Span) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *Span) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Span) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 5: ", err) } else { p.OperationName = v @@ -1185,28 +1248,28 @@ func (p *Span) ReadField5(iprot thrift.TProtocol) error { return nil } -func (p *Span) ReadField6(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *Span) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*SpanRef, 0, size) p.References = tSlice for i := 0; i < size; i ++ { - _elem1 := &SpanRef{} - if err := _elem1.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem1), err) + _elem2 := &SpanRef{} + if err := _elem2.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem2), err) } - p.References = append(p.References, _elem1) + p.References = append(p.References, _elem2) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *Span) ReadField7(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *Span) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 7: ", err) } else { p.Flags = v @@ -1214,8 +1277,8 @@ func (p *Span) ReadField7(iprot thrift.TProtocol) error { return nil } -func (p *Span) ReadField8(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Span) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 8: ", err) } else { p.StartTime = v @@ -1223,8 +1286,8 @@ func (p *Span) ReadField8(iprot thrift.TProtocol) error { return nil } -func (p *Span) ReadField9(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Span) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 9: ", err) } else { p.Duration = v @@ -1232,212 +1295,244 @@ func (p *Span) ReadField9(iprot thrift.TProtocol) error { return nil } -func (p *Span) ReadField10(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *Span) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*Tag, 0, size) p.Tags = tSlice for i := 0; i < size; i ++ { - _elem2 := &Tag{} - if err := _elem2.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem2), err) + _elem3 := &Tag{} + if err := _elem3.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem3), err) } - p.Tags = append(p.Tags, _elem2) + p.Tags = append(p.Tags, _elem3) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *Span) ReadField11(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *Span) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*Log, 0, size) p.Logs = tSlice for i := 0; i < size; i ++ { - _elem3 := &Log{} - if err := _elem3.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem3), err) + _elem4 := &Log{} + if err := _elem4.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err) } - p.Logs = append(p.Logs, _elem3) + p.Logs = append(p.Logs, _elem4) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *Span) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Span"); err != nil { +func (p *Span) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Span"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } - if err := p.writeField7(oprot); err != nil { return err } - if err := p.writeField8(oprot); err != nil { return err } - if err := p.writeField9(oprot); err != nil { return err } - if err := p.writeField10(oprot); err != nil { return err } - if err := p.writeField11(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField7(ctx, oprot); err != nil { return err } + if err := p.writeField8(ctx, oprot); err != nil { return err } + if err := p.writeField9(ctx, oprot); err != nil { return err } + if err := p.writeField10(ctx, oprot); err != nil { return err } + if err := p.writeField11(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Span) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("traceIdLow", thrift.I64, 1); err != nil { +func (p *Span) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "traceIdLow", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:traceIdLow: ", p), err) } - if err := oprot.WriteI64(int64(p.TraceIdLow)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.TraceIdLow)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.traceIdLow (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:traceIdLow: ", p), err) } return err } -func (p *Span) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("traceIdHigh", thrift.I64, 2); err != nil { +func (p *Span) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "traceIdHigh", thrift.I64, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:traceIdHigh: ", p), err) } - if err := oprot.WriteI64(int64(p.TraceIdHigh)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.TraceIdHigh)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.traceIdHigh (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:traceIdHigh: ", p), err) } return err } -func (p *Span) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("spanId", thrift.I64, 3); err != nil { +func (p *Span) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "spanId", thrift.I64, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:spanId: ", p), err) } - if err := oprot.WriteI64(int64(p.SpanId)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.SpanId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.spanId (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:spanId: ", p), err) } return err } -func (p *Span) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("parentSpanId", thrift.I64, 4); err != nil { +func (p *Span) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "parentSpanId", thrift.I64, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:parentSpanId: ", p), err) } - if err := oprot.WriteI64(int64(p.ParentSpanId)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.ParentSpanId)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.parentSpanId (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:parentSpanId: ", p), err) } return err } -func (p *Span) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("operationName", thrift.STRING, 5); err != nil { +func (p *Span) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "operationName", thrift.STRING, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:operationName: ", p), err) } - if err := oprot.WriteString(string(p.OperationName)); err != nil { + if err := oprot.WriteString(ctx, string(p.OperationName)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.operationName (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:operationName: ", p), err) } return err } -func (p *Span) writeField6(oprot thrift.TProtocol) (err error) { +func (p *Span) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetReferences() { - if err := oprot.WriteFieldBegin("references", thrift.LIST, 6); err != nil { + if err := oprot.WriteFieldBegin(ctx, "references", thrift.LIST, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:references: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.References)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.References)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.References { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 6:references: ", p), err) } } return err } -func (p *Span) writeField7(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("flags", thrift.I32, 7); err != nil { +func (p *Span) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "flags", thrift.I32, 7); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:flags: ", p), err) } - if err := oprot.WriteI32(int32(p.Flags)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Flags)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.flags (7) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 7:flags: ", p), err) } return err } -func (p *Span) writeField8(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("startTime", thrift.I64, 8); err != nil { +func (p *Span) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "startTime", thrift.I64, 8); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:startTime: ", p), err) } - if err := oprot.WriteI64(int64(p.StartTime)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.StartTime)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.startTime (8) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 8:startTime: ", p), err) } return err } -func (p *Span) writeField9(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("duration", thrift.I64, 9); err != nil { +func (p *Span) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "duration", thrift.I64, 9); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:duration: ", p), err) } - if err := oprot.WriteI64(int64(p.Duration)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.Duration)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.duration (9) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 9:duration: ", p), err) } return err } -func (p *Span) writeField10(oprot thrift.TProtocol) (err error) { +func (p *Span) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetTags() { - if err := oprot.WriteFieldBegin("tags", thrift.LIST, 10); err != nil { + if err := oprot.WriteFieldBegin(ctx, "tags", thrift.LIST, 10); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:tags: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Tags)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Tags)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Tags { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 10:tags: ", p), err) } } return err } -func (p *Span) writeField11(oprot thrift.TProtocol) (err error) { +func (p *Span) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetLogs() { - if err := oprot.WriteFieldBegin("logs", thrift.LIST, 11); err != nil { + if err := oprot.WriteFieldBegin(ctx, "logs", thrift.LIST, 11); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:logs: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Logs)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Logs)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Logs { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 11:logs: ", p), err) } } return err } +func (p *Span) Equals(other *Span) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.TraceIdLow != other.TraceIdLow { return false } + if p.TraceIdHigh != other.TraceIdHigh { return false } + if p.SpanId != other.SpanId { return false } + if p.ParentSpanId != other.ParentSpanId { return false } + if p.OperationName != other.OperationName { return false } + if len(p.References) != len(other.References) { return false } + for i, _tgt := range p.References { + _src5 := other.References[i] + if !_tgt.Equals(_src5) { return false } + } + if p.Flags != other.Flags { return false } + if p.StartTime != other.StartTime { return false } + if p.Duration != other.Duration { return false } + if len(p.Tags) != len(other.Tags) { return false } + for i, _tgt := range p.Tags { + _src6 := other.Tags[i] + if !_tgt.Equals(_src6) { return false } + } + if len(p.Logs) != len(other.Logs) { return false } + for i, _tgt := range p.Logs { + _src7 := other.Logs[i] + if !_tgt.Equals(_src7) { return false } + } + return true +} + func (p *Span) String() string { if p == nil { return "" @@ -1470,15 +1565,15 @@ func (p *Process) IsSetTags() bool { return p.Tags != nil } -func (p *Process) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Process) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetServiceName bool = false; for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1486,35 +1581,35 @@ func (p *Process) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } issetServiceName = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.LIST { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } if !issetServiceName{ @@ -1523,8 +1618,8 @@ func (p *Process) Read(iprot thrift.TProtocol) error { return nil } -func (p *Process) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Process) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.ServiceName = v @@ -1532,71 +1627,86 @@ func (p *Process) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Process) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *Process) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*Tag, 0, size) p.Tags = tSlice for i := 0; i < size; i ++ { - _elem4 := &Tag{} - if err := _elem4.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err) + _elem8 := &Tag{} + if err := _elem8.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem8), err) } - p.Tags = append(p.Tags, _elem4) + p.Tags = append(p.Tags, _elem8) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *Process) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Process"); err != nil { +func (p *Process) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Process"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Process) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("serviceName", thrift.STRING, 1); err != nil { +func (p *Process) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "serviceName", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:serviceName: ", p), err) } - if err := oprot.WriteString(string(p.ServiceName)); err != nil { + if err := oprot.WriteString(ctx, string(p.ServiceName)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.serviceName (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:serviceName: ", p), err) } return err } -func (p *Process) writeField2(oprot thrift.TProtocol) (err error) { +func (p *Process) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetTags() { - if err := oprot.WriteFieldBegin("tags", thrift.LIST, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "tags", thrift.LIST, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:tags: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Tags)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Tags)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Tags { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:tags: ", p), err) } } return err } +func (p *Process) Equals(other *Process) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.ServiceName != other.ServiceName { return false } + if len(p.Tags) != len(other.Tags) { return false } + for i, _tgt := range p.Tags { + _src9 := other.Tags[i] + if !_tgt.Equals(_src9) { return false } + } + return true +} + func (p *Process) String() string { if p == nil { return "" @@ -1630,8 +1740,8 @@ func (p *ClientStats) GetTooLargeDroppedSpans() int64 { func (p *ClientStats) GetFailedToEmitSpans() int64 { return p.FailedToEmitSpans } -func (p *ClientStats) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ClientStats) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -1640,7 +1750,7 @@ func (p *ClientStats) Read(iprot thrift.TProtocol) error { var issetFailedToEmitSpans bool = false; for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1648,47 +1758,47 @@ func (p *ClientStats) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I64 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } issetFullQueueDroppedSpans = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I64 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } issetTooLargeDroppedSpans = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I64 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } issetFailedToEmitSpans = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } if !issetFullQueueDroppedSpans{ @@ -1703,8 +1813,8 @@ func (p *ClientStats) Read(iprot thrift.TProtocol) error { return nil } -func (p *ClientStats) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *ClientStats) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.FullQueueDroppedSpans = v @@ -1712,8 +1822,8 @@ func (p *ClientStats) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *ClientStats) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *ClientStats) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.TooLargeDroppedSpans = v @@ -1721,8 +1831,8 @@ func (p *ClientStats) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *ClientStats) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *ClientStats) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.FailedToEmitSpans = v @@ -1730,51 +1840,63 @@ func (p *ClientStats) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *ClientStats) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ClientStats"); err != nil { +func (p *ClientStats) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ClientStats"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ClientStats) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("fullQueueDroppedSpans", thrift.I64, 1); err != nil { +func (p *ClientStats) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "fullQueueDroppedSpans", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:fullQueueDroppedSpans: ", p), err) } - if err := oprot.WriteI64(int64(p.FullQueueDroppedSpans)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.FullQueueDroppedSpans)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.fullQueueDroppedSpans (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:fullQueueDroppedSpans: ", p), err) } return err } -func (p *ClientStats) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("tooLargeDroppedSpans", thrift.I64, 2); err != nil { +func (p *ClientStats) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "tooLargeDroppedSpans", thrift.I64, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:tooLargeDroppedSpans: ", p), err) } - if err := oprot.WriteI64(int64(p.TooLargeDroppedSpans)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.TooLargeDroppedSpans)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.tooLargeDroppedSpans (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:tooLargeDroppedSpans: ", p), err) } return err } -func (p *ClientStats) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("failedToEmitSpans", thrift.I64, 3); err != nil { +func (p *ClientStats) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "failedToEmitSpans", thrift.I64, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:failedToEmitSpans: ", p), err) } - if err := oprot.WriteI64(int64(p.FailedToEmitSpans)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.FailedToEmitSpans)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.failedToEmitSpans (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:failedToEmitSpans: ", p), err) } return err } +func (p *ClientStats) Equals(other *ClientStats) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.FullQueueDroppedSpans != other.FullQueueDroppedSpans { return false } + if p.TooLargeDroppedSpans != other.TooLargeDroppedSpans { return false } + if p.FailedToEmitSpans != other.FailedToEmitSpans { return false } + return true +} + func (p *ClientStats) String() string { if p == nil { return "" @@ -1835,8 +1957,8 @@ func (p *Batch) IsSetStats() bool { return p.Stats != nil } -func (p *Batch) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Batch) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -1844,7 +1966,7 @@ func (p *Batch) Read(iprot thrift.TProtocol) error { var issetSpans bool = false; for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1852,56 +1974,56 @@ func (p *Batch) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } issetProcess = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.LIST { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } issetSpans = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I64 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } if !issetProcess{ @@ -1913,36 +2035,36 @@ func (p *Batch) Read(iprot thrift.TProtocol) error { return nil } -func (p *Batch) ReadField1(iprot thrift.TProtocol) error { +func (p *Batch) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { p.Process = &Process{} - if err := p.Process.Read(iprot); err != nil { + if err := p.Process.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Process), err) } return nil } -func (p *Batch) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *Batch) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*Span, 0, size) p.Spans = tSlice for i := 0; i < size; i ++ { - _elem5 := &Span{} - if err := _elem5.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem5), err) + _elem10 := &Span{} + if err := _elem10.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem10), err) } - p.Spans = append(p.Spans, _elem5) + p.Spans = append(p.Spans, _elem10) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *Batch) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Batch) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.SeqNo = &v @@ -1950,85 +2072,107 @@ func (p *Batch) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *Batch) ReadField4(iprot thrift.TProtocol) error { +func (p *Batch) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { p.Stats = &ClientStats{} - if err := p.Stats.Read(iprot); err != nil { + if err := p.Stats.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Stats), err) } return nil } -func (p *Batch) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Batch"); err != nil { +func (p *Batch) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Batch"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Batch) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("process", thrift.STRUCT, 1); err != nil { +func (p *Batch) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "process", thrift.STRUCT, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:process: ", p), err) } - if err := p.Process.Write(oprot); err != nil { + if err := p.Process.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Process), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:process: ", p), err) } return err } -func (p *Batch) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("spans", thrift.LIST, 2); err != nil { +func (p *Batch) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "spans", thrift.LIST, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:spans: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Spans)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Spans)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Spans { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:spans: ", p), err) } return err } -func (p *Batch) writeField3(oprot thrift.TProtocol) (err error) { +func (p *Batch) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSeqNo() { - if err := oprot.WriteFieldBegin("seqNo", thrift.I64, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "seqNo", thrift.I64, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:seqNo: ", p), err) } - if err := oprot.WriteI64(int64(*p.SeqNo)); err != nil { + if err := oprot.WriteI64(ctx, int64(*p.SeqNo)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.seqNo (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:seqNo: ", p), err) } } return err } -func (p *Batch) writeField4(oprot thrift.TProtocol) (err error) { +func (p *Batch) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetStats() { - if err := oprot.WriteFieldBegin("stats", thrift.STRUCT, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "stats", thrift.STRUCT, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:stats: ", p), err) } - if err := p.Stats.Write(oprot); err != nil { + if err := p.Stats.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Stats), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:stats: ", p), err) } } return err } +func (p *Batch) Equals(other *Batch) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Process.Equals(other.Process) { return false } + if len(p.Spans) != len(other.Spans) { return false } + for i, _tgt := range p.Spans { + _src11 := other.Spans[i] + if !_tgt.Equals(_src11) { return false } + } + if p.SeqNo != other.SeqNo { + if p.SeqNo == nil || other.SeqNo == nil { + return false + } + if (*p.SeqNo) != (*other.SeqNo) { return false } + } + if !p.Stats.Equals(other.Stats) { return false } + return true +} + func (p *Batch) String() string { if p == nil { return "" @@ -2050,15 +2194,15 @@ func NewBatchSubmitResponse() *BatchSubmitResponse { func (p *BatchSubmitResponse) GetOk() bool { return p.Ok } -func (p *BatchSubmitResponse) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *BatchSubmitResponse) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetOk bool = false; for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -2066,25 +2210,25 @@ func (p *BatchSubmitResponse) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.BOOL { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } issetOk = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } if !issetOk{ @@ -2093,8 +2237,8 @@ func (p *BatchSubmitResponse) Read(iprot thrift.TProtocol) error { return nil } -func (p *BatchSubmitResponse) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *BatchSubmitResponse) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Ok = v @@ -2102,29 +2246,39 @@ func (p *BatchSubmitResponse) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *BatchSubmitResponse) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("BatchSubmitResponse"); err != nil { +func (p *BatchSubmitResponse) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "BatchSubmitResponse"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *BatchSubmitResponse) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("ok", thrift.BOOL, 1); err != nil { +func (p *BatchSubmitResponse) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "ok", thrift.BOOL, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ok: ", p), err) } - if err := oprot.WriteBool(bool(p.Ok)); err != nil { + if err := oprot.WriteBool(ctx, bool(p.Ok)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.ok (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ok: ", p), err) } return err } +func (p *BatchSubmitResponse) Equals(other *BatchSubmitResponse) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Ok != other.Ok { return false } + return true +} + func (p *BatchSubmitResponse) String() string { if p == nil { return "" @@ -2135,11 +2289,12 @@ func (p *BatchSubmitResponse) String() string { type Collector interface { // Parameters: // - Batches - SubmitBatches(ctx context.Context, batches []*Batch) (r []*BatchSubmitResponse, err error) + SubmitBatches(ctx context.Context, batches []*Batch) (_r []*BatchSubmitResponse, _err error) } type CollectorClient struct { c thrift.TClient + meta thrift.ResponseMeta } func NewCollectorClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *CollectorClient { @@ -2163,16 +2318,28 @@ func NewCollectorClient(c thrift.TClient) *CollectorClient { func (p *CollectorClient) Client_() thrift.TClient { return p.c } + +func (p *CollectorClient) LastResponseMeta_() thrift.ResponseMeta { + return p.meta +} + +func (p *CollectorClient) SetLastResponseMeta_(meta thrift.ResponseMeta) { + p.meta = meta +} + // Parameters: // - Batches -func (p *CollectorClient) SubmitBatches(ctx context.Context, batches []*Batch) (r []*BatchSubmitResponse, err error) { - var _args6 CollectorSubmitBatchesArgs - _args6.Batches = batches - var _result7 CollectorSubmitBatchesResult - if err = p.Client_().Call(ctx, "submitBatches", &_args6, &_result7); err != nil { +func (p *CollectorClient) SubmitBatches(ctx context.Context, batches []*Batch) (_r []*BatchSubmitResponse, _err error) { + var _args12 CollectorSubmitBatchesArgs + _args12.Batches = batches + var _result14 CollectorSubmitBatchesResult + var _meta13 thrift.ResponseMeta + _meta13, _err = p.Client_().Call(ctx, "submitBatches", &_args12, &_result14) + p.SetLastResponseMeta_(_meta13) + if _err != nil { return } - return _result7.GetSuccess(), nil + return _result14.GetSuccess(), nil } type CollectorProcessor struct { @@ -2195,25 +2362,25 @@ func (p *CollectorProcessor) ProcessorMap() map[string]thrift.TProcessorFunction func NewCollectorProcessor(handler Collector) *CollectorProcessor { - self8 := &CollectorProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)} - self8.processorMap["submitBatches"] = &collectorProcessorSubmitBatches{handler:handler} -return self8 + self15 := &CollectorProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)} + self15.processorMap["submitBatches"] = &collectorProcessorSubmitBatches{handler:handler} +return self15 } func (p *CollectorProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - name, _, seqId, err := iprot.ReadMessageBegin() - if err != nil { return false, err } + name, _, seqId, err2 := iprot.ReadMessageBegin(ctx) + if err2 != nil { return false, thrift.WrapTException(err2) } if processor, ok := p.GetProcessorFunction(name); ok { return processor.Process(ctx, seqId, iprot, oprot) } - iprot.Skip(thrift.STRUCT) - iprot.ReadMessageEnd() - x9 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name) - oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) - x9.Write(oprot) - oprot.WriteMessageEnd() + iprot.Skip(ctx, thrift.STRUCT) + iprot.ReadMessageEnd(ctx) + x16 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name) + oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId) + x16.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, x9 + return false, x16 } @@ -2223,41 +2390,72 @@ type collectorProcessorSubmitBatches struct { func (p *collectorProcessorSubmitBatches) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := CollectorSubmitBatchesArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("submitBatches", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "submitBatches", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := CollectorSubmitBatchesResult{} -var retval []*BatchSubmitResponse - var err2 error + var retval []*BatchSubmitResponse if retval, err2 = p.handler.SubmitBatches(ctx, args.Batches); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing submitBatches: " + err2.Error()) - oprot.WriteMessageBegin("submitBatches", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "submitBatches", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("submitBatches", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "submitBatches", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -2282,14 +2480,14 @@ func NewCollectorSubmitBatchesArgs() *CollectorSubmitBatchesArgs { func (p *CollectorSubmitBatchesArgs) GetBatches() []*Batch { return p.Batches } -func (p *CollectorSubmitBatchesArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *CollectorSubmitBatchesArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -2297,77 +2495,77 @@ func (p *CollectorSubmitBatchesArgs) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.LIST { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *CollectorSubmitBatchesArgs) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *CollectorSubmitBatchesArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*Batch, 0, size) p.Batches = tSlice for i := 0; i < size; i ++ { - _elem10 := &Batch{} - if err := _elem10.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem10), err) + _elem17 := &Batch{} + if err := _elem17.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem17), err) } - p.Batches = append(p.Batches, _elem10) + p.Batches = append(p.Batches, _elem17) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *CollectorSubmitBatchesArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("submitBatches_args"); err != nil { +func (p *CollectorSubmitBatchesArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "submitBatches_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *CollectorSubmitBatchesArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("batches", thrift.LIST, 1); err != nil { +func (p *CollectorSubmitBatchesArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "batches", thrift.LIST, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:batches: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Batches)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Batches)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Batches { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:batches: ", p), err) } return err } @@ -2398,14 +2596,14 @@ func (p *CollectorSubmitBatchesResult) IsSetSuccess() bool { return p.Success != nil } -func (p *CollectorSubmitBatchesResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *CollectorSubmitBatchesResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -2413,78 +2611,78 @@ func (p *CollectorSubmitBatchesResult) Read(iprot thrift.TProtocol) error { switch fieldId { case 0: if fieldTypeId == thrift.LIST { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *CollectorSubmitBatchesResult) ReadField0(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *CollectorSubmitBatchesResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*BatchSubmitResponse, 0, size) p.Success = tSlice for i := 0; i < size; i ++ { - _elem11 := &BatchSubmitResponse{} - if err := _elem11.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem11), err) + _elem18 := &BatchSubmitResponse{} + if err := _elem18.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem18), err) } - p.Success = append(p.Success, _elem11) + p.Success = append(p.Success, _elem18) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *CollectorSubmitBatchesResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("submitBatches_result"); err != nil { +func (p *CollectorSubmitBatchesResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "submitBatches_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *CollectorSubmitBatchesResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *CollectorSubmitBatchesResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.LIST, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Success)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Success)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Success { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err diff --git a/thrift-gen/sampling/GoUnusedProtection__.go b/thrift-gen/sampling/GoUnusedProtection__.go index 60b1d04b4f0..015ad4b0674 100644 --- a/thrift-gen/sampling/GoUnusedProtection__.go +++ b/thrift-gen/sampling/GoUnusedProtection__.go @@ -1,5 +1,4 @@ -// Autogenerated by Thrift Compiler (0.13.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. package sampling diff --git a/thrift-gen/sampling/sampling-consts.go b/thrift-gen/sampling/sampling-consts.go index 64bf76c9efd..9899b278c72 100644 --- a/thrift-gen/sampling/sampling-consts.go +++ b/thrift-gen/sampling/sampling-consts.go @@ -1,13 +1,12 @@ -// Autogenerated by Thrift Compiler (0.13.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. package sampling import( "bytes" "context" - "reflect" "fmt" + "time" "github.com/apache/thrift/lib/go/thrift" ) @@ -15,7 +14,7 @@ import( var _ = thrift.ZERO var _ = fmt.Printf var _ = context.Background -var _ = reflect.DeepEqual +var _ = time.Now var _ = bytes.Equal diff --git a/thrift-gen/sampling/sampling.go b/thrift-gen/sampling/sampling.go index d68b3cf12c8..f251540656d 100644 --- a/thrift-gen/sampling/sampling.go +++ b/thrift-gen/sampling/sampling.go @@ -1,15 +1,14 @@ -// Autogenerated by Thrift Compiler (0.13.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. package sampling import( "bytes" "context" - "reflect" "database/sql/driver" "errors" "fmt" + "time" "github.com/apache/thrift/lib/go/thrift" ) @@ -17,7 +16,7 @@ import( var _ = thrift.ZERO var _ = fmt.Printf var _ = context.Background -var _ = reflect.DeepEqual +var _ = time.Now var _ = bytes.Equal type SamplingStrategyType int64 @@ -87,15 +86,15 @@ func NewProbabilisticSamplingStrategy() *ProbabilisticSamplingStrategy { func (p *ProbabilisticSamplingStrategy) GetSamplingRate() float64 { return p.SamplingRate } -func (p *ProbabilisticSamplingStrategy) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ProbabilisticSamplingStrategy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetSamplingRate bool = false; for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -103,25 +102,25 @@ func (p *ProbabilisticSamplingStrategy) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.DOUBLE { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } issetSamplingRate = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } if !issetSamplingRate{ @@ -130,8 +129,8 @@ func (p *ProbabilisticSamplingStrategy) Read(iprot thrift.TProtocol) error { return nil } -func (p *ProbabilisticSamplingStrategy) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(); err != nil { +func (p *ProbabilisticSamplingStrategy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadDouble(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.SamplingRate = v @@ -139,29 +138,39 @@ func (p *ProbabilisticSamplingStrategy) ReadField1(iprot thrift.TProtocol) erro return nil } -func (p *ProbabilisticSamplingStrategy) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("ProbabilisticSamplingStrategy"); err != nil { +func (p *ProbabilisticSamplingStrategy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "ProbabilisticSamplingStrategy"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ProbabilisticSamplingStrategy) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("samplingRate", thrift.DOUBLE, 1); err != nil { +func (p *ProbabilisticSamplingStrategy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "samplingRate", thrift.DOUBLE, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:samplingRate: ", p), err) } - if err := oprot.WriteDouble(float64(p.SamplingRate)); err != nil { + if err := oprot.WriteDouble(ctx, float64(p.SamplingRate)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.samplingRate (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:samplingRate: ", p), err) } return err } +func (p *ProbabilisticSamplingStrategy) Equals(other *ProbabilisticSamplingStrategy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.SamplingRate != other.SamplingRate { return false } + return true +} + func (p *ProbabilisticSamplingStrategy) String() string { if p == nil { return "" @@ -183,15 +192,15 @@ func NewRateLimitingSamplingStrategy() *RateLimitingSamplingStrategy { func (p *RateLimitingSamplingStrategy) GetMaxTracesPerSecond() int16 { return p.MaxTracesPerSecond } -func (p *RateLimitingSamplingStrategy) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *RateLimitingSamplingStrategy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetMaxTracesPerSecond bool = false; for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -199,25 +208,25 @@ func (p *RateLimitingSamplingStrategy) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I16 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } issetMaxTracesPerSecond = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } if !issetMaxTracesPerSecond{ @@ -226,8 +235,8 @@ func (p *RateLimitingSamplingStrategy) Read(iprot thrift.TProtocol) error { return nil } -func (p *RateLimitingSamplingStrategy) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI16(); err != nil { +func (p *RateLimitingSamplingStrategy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI16(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.MaxTracesPerSecond = v @@ -235,29 +244,39 @@ func (p *RateLimitingSamplingStrategy) ReadField1(iprot thrift.TProtocol) error return nil } -func (p *RateLimitingSamplingStrategy) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("RateLimitingSamplingStrategy"); err != nil { +func (p *RateLimitingSamplingStrategy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "RateLimitingSamplingStrategy"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *RateLimitingSamplingStrategy) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("maxTracesPerSecond", thrift.I16, 1); err != nil { +func (p *RateLimitingSamplingStrategy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "maxTracesPerSecond", thrift.I16, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:maxTracesPerSecond: ", p), err) } - if err := oprot.WriteI16(int16(p.MaxTracesPerSecond)); err != nil { + if err := oprot.WriteI16(ctx, int16(p.MaxTracesPerSecond)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.maxTracesPerSecond (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:maxTracesPerSecond: ", p), err) } return err } +func (p *RateLimitingSamplingStrategy) Equals(other *RateLimitingSamplingStrategy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.MaxTracesPerSecond != other.MaxTracesPerSecond { return false } + return true +} + func (p *RateLimitingSamplingStrategy) String() string { if p == nil { return "" @@ -292,8 +311,8 @@ func (p *OperationSamplingStrategy) IsSetProbabilisticSampling() bool { return p.ProbabilisticSampling != nil } -func (p *OperationSamplingStrategy) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *OperationSamplingStrategy) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -301,7 +320,7 @@ func (p *OperationSamplingStrategy) Read(iprot thrift.TProtocol) error { var issetProbabilisticSampling bool = false; for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -309,36 +328,36 @@ func (p *OperationSamplingStrategy) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } issetOperation = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } issetProbabilisticSampling = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } if !issetOperation{ @@ -350,8 +369,8 @@ func (p *OperationSamplingStrategy) Read(iprot thrift.TProtocol) error { return nil } -func (p *OperationSamplingStrategy) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *OperationSamplingStrategy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Operation = v @@ -359,49 +378,60 @@ func (p *OperationSamplingStrategy) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *OperationSamplingStrategy) ReadField2(iprot thrift.TProtocol) error { +func (p *OperationSamplingStrategy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.ProbabilisticSampling = &ProbabilisticSamplingStrategy{} - if err := p.ProbabilisticSampling.Read(iprot); err != nil { + if err := p.ProbabilisticSampling.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ProbabilisticSampling), err) } return nil } -func (p *OperationSamplingStrategy) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("OperationSamplingStrategy"); err != nil { +func (p *OperationSamplingStrategy) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "OperationSamplingStrategy"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *OperationSamplingStrategy) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("operation", thrift.STRING, 1); err != nil { +func (p *OperationSamplingStrategy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "operation", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:operation: ", p), err) } - if err := oprot.WriteString(string(p.Operation)); err != nil { + if err := oprot.WriteString(ctx, string(p.Operation)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.operation (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:operation: ", p), err) } return err } -func (p *OperationSamplingStrategy) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("probabilisticSampling", thrift.STRUCT, 2); err != nil { +func (p *OperationSamplingStrategy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "probabilisticSampling", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:probabilisticSampling: ", p), err) } - if err := p.ProbabilisticSampling.Write(oprot); err != nil { + if err := p.ProbabilisticSampling.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ProbabilisticSampling), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:probabilisticSampling: ", p), err) } return err } +func (p *OperationSamplingStrategy) Equals(other *OperationSamplingStrategy) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Operation != other.Operation { return false } + if !p.ProbabilisticSampling.Equals(other.ProbabilisticSampling) { return false } + return true +} + func (p *OperationSamplingStrategy) String() string { if p == nil { return "" @@ -448,8 +478,8 @@ func (p *PerOperationSamplingStrategies) IsSetDefaultUpperBoundTracesPerSecond() return p.DefaultUpperBoundTracesPerSecond != nil } -func (p *PerOperationSamplingStrategies) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *PerOperationSamplingStrategies) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } @@ -458,7 +488,7 @@ func (p *PerOperationSamplingStrategies) Read(iprot thrift.TProtocol) error { var issetPerOperationStrategies bool = false; for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -466,57 +496,57 @@ func (p *PerOperationSamplingStrategies) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.DOUBLE { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } issetDefaultSamplingProbability = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.DOUBLE { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } issetDefaultLowerBoundTracesPerSecond = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.LIST { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } issetPerOperationStrategies = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.DOUBLE { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } if !issetDefaultSamplingProbability{ @@ -531,8 +561,8 @@ func (p *PerOperationSamplingStrategies) Read(iprot thrift.TProtocol) error { return nil } -func (p *PerOperationSamplingStrategies) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(); err != nil { +func (p *PerOperationSamplingStrategies) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadDouble(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.DefaultSamplingProbability = v @@ -540,8 +570,8 @@ func (p *PerOperationSamplingStrategies) ReadField1(iprot thrift.TProtocol) err return nil } -func (p *PerOperationSamplingStrategies) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(); err != nil { +func (p *PerOperationSamplingStrategies) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadDouble(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.DefaultLowerBoundTracesPerSecond = v @@ -549,8 +579,8 @@ func (p *PerOperationSamplingStrategies) ReadField2(iprot thrift.TProtocol) err return nil } -func (p *PerOperationSamplingStrategies) ReadField3(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *PerOperationSamplingStrategies) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } @@ -558,19 +588,19 @@ func (p *PerOperationSamplingStrategies) ReadField3(iprot thrift.TProtocol) err p.PerOperationStrategies = tSlice for i := 0; i < size; i ++ { _elem0 := &OperationSamplingStrategy{} - if err := _elem0.Read(iprot); err != nil { + if err := _elem0.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem0), err) } p.PerOperationStrategies = append(p.PerOperationStrategies, _elem0) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *PerOperationSamplingStrategies) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(); err != nil { +func (p *PerOperationSamplingStrategies) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadDouble(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.DefaultUpperBoundTracesPerSecond = &v @@ -578,73 +608,95 @@ func (p *PerOperationSamplingStrategies) ReadField4(iprot thrift.TProtocol) err return nil } -func (p *PerOperationSamplingStrategies) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("PerOperationSamplingStrategies"); err != nil { +func (p *PerOperationSamplingStrategies) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "PerOperationSamplingStrategies"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *PerOperationSamplingStrategies) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("defaultSamplingProbability", thrift.DOUBLE, 1); err != nil { +func (p *PerOperationSamplingStrategies) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "defaultSamplingProbability", thrift.DOUBLE, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:defaultSamplingProbability: ", p), err) } - if err := oprot.WriteDouble(float64(p.DefaultSamplingProbability)); err != nil { + if err := oprot.WriteDouble(ctx, float64(p.DefaultSamplingProbability)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.defaultSamplingProbability (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:defaultSamplingProbability: ", p), err) } return err } -func (p *PerOperationSamplingStrategies) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("defaultLowerBoundTracesPerSecond", thrift.DOUBLE, 2); err != nil { +func (p *PerOperationSamplingStrategies) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "defaultLowerBoundTracesPerSecond", thrift.DOUBLE, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:defaultLowerBoundTracesPerSecond: ", p), err) } - if err := oprot.WriteDouble(float64(p.DefaultLowerBoundTracesPerSecond)); err != nil { + if err := oprot.WriteDouble(ctx, float64(p.DefaultLowerBoundTracesPerSecond)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.defaultLowerBoundTracesPerSecond (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:defaultLowerBoundTracesPerSecond: ", p), err) } return err } -func (p *PerOperationSamplingStrategies) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("perOperationStrategies", thrift.LIST, 3); err != nil { +func (p *PerOperationSamplingStrategies) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "perOperationStrategies", thrift.LIST, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:perOperationStrategies: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.PerOperationStrategies)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.PerOperationStrategies)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.PerOperationStrategies { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:perOperationStrategies: ", p), err) } return err } -func (p *PerOperationSamplingStrategies) writeField4(oprot thrift.TProtocol) (err error) { +func (p *PerOperationSamplingStrategies) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetDefaultUpperBoundTracesPerSecond() { - if err := oprot.WriteFieldBegin("defaultUpperBoundTracesPerSecond", thrift.DOUBLE, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "defaultUpperBoundTracesPerSecond", thrift.DOUBLE, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:defaultUpperBoundTracesPerSecond: ", p), err) } - if err := oprot.WriteDouble(float64(*p.DefaultUpperBoundTracesPerSecond)); err != nil { + if err := oprot.WriteDouble(ctx, float64(*p.DefaultUpperBoundTracesPerSecond)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.defaultUpperBoundTracesPerSecond (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:defaultUpperBoundTracesPerSecond: ", p), err) } } return err } +func (p *PerOperationSamplingStrategies) Equals(other *PerOperationSamplingStrategies) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.DefaultSamplingProbability != other.DefaultSamplingProbability { return false } + if p.DefaultLowerBoundTracesPerSecond != other.DefaultLowerBoundTracesPerSecond { return false } + if len(p.PerOperationStrategies) != len(other.PerOperationStrategies) { return false } + for i, _tgt := range p.PerOperationStrategies { + _src1 := other.PerOperationStrategies[i] + if !_tgt.Equals(_src1) { return false } + } + if p.DefaultUpperBoundTracesPerSecond != other.DefaultUpperBoundTracesPerSecond { + if p.DefaultUpperBoundTracesPerSecond == nil || other.DefaultUpperBoundTracesPerSecond == nil { + return false + } + if (*p.DefaultUpperBoundTracesPerSecond) != (*other.DefaultUpperBoundTracesPerSecond) { return false } + } + return true +} + func (p *PerOperationSamplingStrategies) String() string { if p == nil { return "" @@ -705,15 +757,15 @@ func (p *SamplingStrategyResponse) IsSetOperationSampling() bool { return p.OperationSampling != nil } -func (p *SamplingStrategyResponse) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *SamplingStrategyResponse) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetStrategyType bool = false; for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -721,55 +773,55 @@ func (p *SamplingStrategyResponse) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } issetStrategyType = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } if !issetStrategyType{ @@ -778,8 +830,8 @@ func (p *SamplingStrategyResponse) Read(iprot thrift.TProtocol) error { return nil } -func (p *SamplingStrategyResponse) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *SamplingStrategyResponse) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { temp := SamplingStrategyType(v) @@ -788,95 +840,108 @@ func (p *SamplingStrategyResponse) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *SamplingStrategyResponse) ReadField2(iprot thrift.TProtocol) error { +func (p *SamplingStrategyResponse) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { p.ProbabilisticSampling = &ProbabilisticSamplingStrategy{} - if err := p.ProbabilisticSampling.Read(iprot); err != nil { + if err := p.ProbabilisticSampling.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ProbabilisticSampling), err) } return nil } -func (p *SamplingStrategyResponse) ReadField3(iprot thrift.TProtocol) error { +func (p *SamplingStrategyResponse) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { p.RateLimitingSampling = &RateLimitingSamplingStrategy{} - if err := p.RateLimitingSampling.Read(iprot); err != nil { + if err := p.RateLimitingSampling.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.RateLimitingSampling), err) } return nil } -func (p *SamplingStrategyResponse) ReadField4(iprot thrift.TProtocol) error { +func (p *SamplingStrategyResponse) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { p.OperationSampling = &PerOperationSamplingStrategies{} - if err := p.OperationSampling.Read(iprot); err != nil { + if err := p.OperationSampling.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.OperationSampling), err) } return nil } -func (p *SamplingStrategyResponse) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("SamplingStrategyResponse"); err != nil { +func (p *SamplingStrategyResponse) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "SamplingStrategyResponse"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *SamplingStrategyResponse) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("strategyType", thrift.I32, 1); err != nil { +func (p *SamplingStrategyResponse) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "strategyType", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:strategyType: ", p), err) } - if err := oprot.WriteI32(int32(p.StrategyType)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.StrategyType)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.strategyType (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:strategyType: ", p), err) } return err } -func (p *SamplingStrategyResponse) writeField2(oprot thrift.TProtocol) (err error) { +func (p *SamplingStrategyResponse) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetProbabilisticSampling() { - if err := oprot.WriteFieldBegin("probabilisticSampling", thrift.STRUCT, 2); err != nil { + if err := oprot.WriteFieldBegin(ctx, "probabilisticSampling", thrift.STRUCT, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:probabilisticSampling: ", p), err) } - if err := p.ProbabilisticSampling.Write(oprot); err != nil { + if err := p.ProbabilisticSampling.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ProbabilisticSampling), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:probabilisticSampling: ", p), err) } } return err } -func (p *SamplingStrategyResponse) writeField3(oprot thrift.TProtocol) (err error) { +func (p *SamplingStrategyResponse) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetRateLimitingSampling() { - if err := oprot.WriteFieldBegin("rateLimitingSampling", thrift.STRUCT, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "rateLimitingSampling", thrift.STRUCT, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:rateLimitingSampling: ", p), err) } - if err := p.RateLimitingSampling.Write(oprot); err != nil { + if err := p.RateLimitingSampling.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.RateLimitingSampling), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:rateLimitingSampling: ", p), err) } } return err } -func (p *SamplingStrategyResponse) writeField4(oprot thrift.TProtocol) (err error) { +func (p *SamplingStrategyResponse) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetOperationSampling() { - if err := oprot.WriteFieldBegin("operationSampling", thrift.STRUCT, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "operationSampling", thrift.STRUCT, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:operationSampling: ", p), err) } - if err := p.OperationSampling.Write(oprot); err != nil { + if err := p.OperationSampling.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.OperationSampling), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:operationSampling: ", p), err) } } return err } +func (p *SamplingStrategyResponse) Equals(other *SamplingStrategyResponse) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.StrategyType != other.StrategyType { return false } + if !p.ProbabilisticSampling.Equals(other.ProbabilisticSampling) { return false } + if !p.RateLimitingSampling.Equals(other.RateLimitingSampling) { return false } + if !p.OperationSampling.Equals(other.OperationSampling) { return false } + return true +} + func (p *SamplingStrategyResponse) String() string { if p == nil { return "" @@ -887,11 +952,12 @@ func (p *SamplingStrategyResponse) String() string { type SamplingManager interface { // Parameters: // - ServiceName - GetSamplingStrategy(ctx context.Context, serviceName string) (r *SamplingStrategyResponse, err error) + GetSamplingStrategy(ctx context.Context, serviceName string) (_r *SamplingStrategyResponse, _err error) } type SamplingManagerClient struct { c thrift.TClient + meta thrift.ResponseMeta } func NewSamplingManagerClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *SamplingManagerClient { @@ -915,16 +981,28 @@ func NewSamplingManagerClient(c thrift.TClient) *SamplingManagerClient { func (p *SamplingManagerClient) Client_() thrift.TClient { return p.c } + +func (p *SamplingManagerClient) LastResponseMeta_() thrift.ResponseMeta { + return p.meta +} + +func (p *SamplingManagerClient) SetLastResponseMeta_(meta thrift.ResponseMeta) { + p.meta = meta +} + // Parameters: // - ServiceName -func (p *SamplingManagerClient) GetSamplingStrategy(ctx context.Context, serviceName string) (r *SamplingStrategyResponse, err error) { - var _args1 SamplingManagerGetSamplingStrategyArgs - _args1.ServiceName = serviceName - var _result2 SamplingManagerGetSamplingStrategyResult - if err = p.Client_().Call(ctx, "getSamplingStrategy", &_args1, &_result2); err != nil { +func (p *SamplingManagerClient) GetSamplingStrategy(ctx context.Context, serviceName string) (_r *SamplingStrategyResponse, _err error) { + var _args2 SamplingManagerGetSamplingStrategyArgs + _args2.ServiceName = serviceName + var _result4 SamplingManagerGetSamplingStrategyResult + var _meta3 thrift.ResponseMeta + _meta3, _err = p.Client_().Call(ctx, "getSamplingStrategy", &_args2, &_result4) + p.SetLastResponseMeta_(_meta3) + if _err != nil { return } - return _result2.GetSuccess(), nil + return _result4.GetSuccess(), nil } type SamplingManagerProcessor struct { @@ -947,25 +1025,25 @@ func (p *SamplingManagerProcessor) ProcessorMap() map[string]thrift.TProcessorFu func NewSamplingManagerProcessor(handler SamplingManager) *SamplingManagerProcessor { - self3 := &SamplingManagerProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)} - self3.processorMap["getSamplingStrategy"] = &samplingManagerProcessorGetSamplingStrategy{handler:handler} -return self3 + self5 := &SamplingManagerProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)} + self5.processorMap["getSamplingStrategy"] = &samplingManagerProcessorGetSamplingStrategy{handler:handler} +return self5 } func (p *SamplingManagerProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - name, _, seqId, err := iprot.ReadMessageBegin() - if err != nil { return false, err } + name, _, seqId, err2 := iprot.ReadMessageBegin(ctx) + if err2 != nil { return false, thrift.WrapTException(err2) } if processor, ok := p.GetProcessorFunction(name); ok { return processor.Process(ctx, seqId, iprot, oprot) } - iprot.Skip(thrift.STRUCT) - iprot.ReadMessageEnd() - x4 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name) - oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) - x4.Write(oprot) - oprot.WriteMessageEnd() + iprot.Skip(ctx, thrift.STRUCT) + iprot.ReadMessageEnd(ctx) + x6 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name) + oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId) + x6.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, x4 + return false, x6 } @@ -975,41 +1053,72 @@ type samplingManagerProcessorGetSamplingStrategy struct { func (p *samplingManagerProcessorGetSamplingStrategy) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := SamplingManagerGetSamplingStrategyArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getSamplingStrategy", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "getSamplingStrategy", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := SamplingManagerGetSamplingStrategyResult{} -var retval *SamplingStrategyResponse - var err2 error + var retval *SamplingStrategyResponse if retval, err2 = p.handler.GetSamplingStrategy(ctx, args.ServiceName); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getSamplingStrategy: " + err2.Error()) - oprot.WriteMessageBegin("getSamplingStrategy", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "getSamplingStrategy", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("getSamplingStrategy", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "getSamplingStrategy", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -1034,14 +1143,14 @@ func NewSamplingManagerGetSamplingStrategyArgs() *SamplingManagerGetSamplingStra func (p *SamplingManagerGetSamplingStrategyArgs) GetServiceName() string { return p.ServiceName } -func (p *SamplingManagerGetSamplingStrategyArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *SamplingManagerGetSamplingStrategyArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1049,31 +1158,31 @@ func (p *SamplingManagerGetSamplingStrategyArgs) Read(iprot thrift.TProtocol) er switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *SamplingManagerGetSamplingStrategyArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *SamplingManagerGetSamplingStrategyArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.ServiceName = v @@ -1081,25 +1190,25 @@ func (p *SamplingManagerGetSamplingStrategyArgs) ReadField1(iprot thrift.TProto return nil } -func (p *SamplingManagerGetSamplingStrategyArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getSamplingStrategy_args"); err != nil { +func (p *SamplingManagerGetSamplingStrategyArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getSamplingStrategy_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *SamplingManagerGetSamplingStrategyArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("serviceName", thrift.STRING, 1); err != nil { +func (p *SamplingManagerGetSamplingStrategyArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "serviceName", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:serviceName: ", p), err) } - if err := oprot.WriteString(string(p.ServiceName)); err != nil { + if err := oprot.WriteString(ctx, string(p.ServiceName)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.serviceName (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:serviceName: ", p), err) } return err } @@ -1132,14 +1241,14 @@ func (p *SamplingManagerGetSamplingStrategyResult) IsSetSuccess() bool { return p.Success != nil } -func (p *SamplingManagerGetSamplingStrategyResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *SamplingManagerGetSamplingStrategyResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1147,58 +1256,58 @@ func (p *SamplingManagerGetSamplingStrategyResult) Read(iprot thrift.TProtocol) switch fieldId { case 0: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *SamplingManagerGetSamplingStrategyResult) ReadField0(iprot thrift.TProtocol) error { +func (p *SamplingManagerGetSamplingStrategyResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { p.Success = &SamplingStrategyResponse{} - if err := p.Success.Read(iprot); err != nil { + if err := p.Success.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err) } return nil } -func (p *SamplingManagerGetSamplingStrategyResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getSamplingStrategy_result"); err != nil { +func (p *SamplingManagerGetSamplingStrategyResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "getSamplingStrategy_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *SamplingManagerGetSamplingStrategyResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *SamplingManagerGetSamplingStrategyResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := p.Success.Write(oprot); err != nil { + if err := p.Success.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err diff --git a/thrift-gen/zipkincore/GoUnusedProtection__.go b/thrift-gen/zipkincore/GoUnusedProtection__.go index 470f857bdf6..ebf43018fe7 100644 --- a/thrift-gen/zipkincore/GoUnusedProtection__.go +++ b/thrift-gen/zipkincore/GoUnusedProtection__.go @@ -1,5 +1,4 @@ -// Autogenerated by Thrift Compiler (0.13.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. package zipkincore diff --git a/thrift-gen/zipkincore/zipkincore-consts.go b/thrift-gen/zipkincore/zipkincore-consts.go index 00dd516d403..8b6e02cd2d8 100644 --- a/thrift-gen/zipkincore/zipkincore-consts.go +++ b/thrift-gen/zipkincore/zipkincore-consts.go @@ -1,13 +1,12 @@ -// Autogenerated by Thrift Compiler (0.13.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. package zipkincore import( "bytes" "context" - "reflect" "fmt" + "time" "github.com/apache/thrift/lib/go/thrift" ) @@ -15,7 +14,7 @@ import( var _ = thrift.ZERO var _ = fmt.Printf var _ = context.Background -var _ = reflect.DeepEqual +var _ = time.Now var _ = bytes.Equal const CLIENT_SEND = "cs" diff --git a/thrift-gen/zipkincore/zipkincore.go b/thrift-gen/zipkincore/zipkincore.go index 494680839f9..71e89125c7b 100644 --- a/thrift-gen/zipkincore/zipkincore.go +++ b/thrift-gen/zipkincore/zipkincore.go @@ -1,15 +1,14 @@ -// Autogenerated by Thrift Compiler (0.13.0) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. package zipkincore import( "bytes" "context" - "reflect" "database/sql/driver" "errors" "fmt" + "time" "github.com/apache/thrift/lib/go/thrift" ) @@ -17,7 +16,7 @@ import( var _ = thrift.ZERO var _ = fmt.Printf var _ = context.Background -var _ = reflect.DeepEqual +var _ = time.Now var _ = bytes.Equal type AnnotationType int64 @@ -141,14 +140,14 @@ func (p *Endpoint) IsSetIpv6() bool { return p.Ipv6 != nil } -func (p *Endpoint) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Endpoint) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -156,61 +155,61 @@ func (p *Endpoint) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I32 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.I16 { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRING { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Endpoint) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *Endpoint) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Ipv4 = v @@ -218,8 +217,8 @@ func (p *Endpoint) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Endpoint) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI16(); err != nil { +func (p *Endpoint) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI16(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Port = v @@ -227,8 +226,8 @@ func (p *Endpoint) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Endpoint) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Endpoint) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.ServiceName = v @@ -236,8 +235,8 @@ func (p *Endpoint) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *Endpoint) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBinary(); err != nil { +func (p *Endpoint) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBinary(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.Ipv6 = v @@ -245,64 +244,77 @@ func (p *Endpoint) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *Endpoint) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Endpoint"); err != nil { +func (p *Endpoint) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Endpoint"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Endpoint) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("ipv4", thrift.I32, 1); err != nil { +func (p *Endpoint) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "ipv4", thrift.I32, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ipv4: ", p), err) } - if err := oprot.WriteI32(int32(p.Ipv4)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.Ipv4)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.ipv4 (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ipv4: ", p), err) } return err } -func (p *Endpoint) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("port", thrift.I16, 2); err != nil { +func (p *Endpoint) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "port", thrift.I16, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:port: ", p), err) } - if err := oprot.WriteI16(int16(p.Port)); err != nil { + if err := oprot.WriteI16(ctx, int16(p.Port)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.port (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:port: ", p), err) } return err } -func (p *Endpoint) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 3); err != nil { +func (p *Endpoint) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "service_name", thrift.STRING, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:service_name: ", p), err) } - if err := oprot.WriteString(string(p.ServiceName)); err != nil { + if err := oprot.WriteString(ctx, string(p.ServiceName)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.service_name (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:service_name: ", p), err) } return err } -func (p *Endpoint) writeField4(oprot thrift.TProtocol) (err error) { +func (p *Endpoint) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetIpv6() { - if err := oprot.WriteFieldBegin("ipv6", thrift.STRING, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "ipv6", thrift.STRING, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:ipv6: ", p), err) } - if err := oprot.WriteBinary(p.Ipv6); err != nil { + if err := oprot.WriteBinary(ctx, p.Ipv6); err != nil { return thrift.PrependError(fmt.Sprintf("%T.ipv6 (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:ipv6: ", p), err) } } return err } +func (p *Endpoint) Equals(other *Endpoint) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Ipv4 != other.Ipv4 { return false } + if p.Port != other.Port { return false } + if p.ServiceName != other.ServiceName { return false } + if bytes.Compare(p.Ipv6, other.Ipv6) != 0 { return false } + return true +} + func (p *Endpoint) String() string { if p == nil { return "" @@ -350,14 +362,14 @@ func (p *Annotation) IsSetHost() bool { return p.Host != nil } -func (p *Annotation) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Annotation) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -365,51 +377,51 @@ func (p *Annotation) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I64 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Annotation) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Annotation) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Timestamp = v @@ -417,8 +429,8 @@ func (p *Annotation) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Annotation) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Annotation) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Value = v @@ -426,62 +438,74 @@ func (p *Annotation) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *Annotation) ReadField3(iprot thrift.TProtocol) error { +func (p *Annotation) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { p.Host = &Endpoint{} - if err := p.Host.Read(iprot); err != nil { + if err := p.Host.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Host), err) } return nil } -func (p *Annotation) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Annotation"); err != nil { +func (p *Annotation) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Annotation"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Annotation) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timestamp", thrift.I64, 1); err != nil { +func (p *Annotation) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:timestamp: ", p), err) } - if err := oprot.WriteI64(int64(p.Timestamp)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.Timestamp)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.timestamp (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:timestamp: ", p), err) } return err } -func (p *Annotation) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("value", thrift.STRING, 2); err != nil { +func (p *Annotation) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:value: ", p), err) } - if err := oprot.WriteString(string(p.Value)); err != nil { + if err := oprot.WriteString(ctx, string(p.Value)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.value (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:value: ", p), err) } return err } -func (p *Annotation) writeField3(oprot thrift.TProtocol) (err error) { +func (p *Annotation) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetHost() { - if err := oprot.WriteFieldBegin("host", thrift.STRUCT, 3); err != nil { + if err := oprot.WriteFieldBegin(ctx, "host", thrift.STRUCT, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:host: ", p), err) } - if err := p.Host.Write(oprot); err != nil { + if err := p.Host.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Host), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:host: ", p), err) } } return err } +func (p *Annotation) Equals(other *Annotation) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Timestamp != other.Timestamp { return false } + if p.Value != other.Value { return false } + if !p.Host.Equals(other.Host) { return false } + return true +} + func (p *Annotation) String() string { if p == nil { return "" @@ -547,14 +571,14 @@ func (p *BinaryAnnotation) IsSetHost() bool { return p.Host != nil } -func (p *BinaryAnnotation) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *BinaryAnnotation) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -562,61 +586,61 @@ func (p *BinaryAnnotation) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.STRING { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 2: if fieldTypeId == thrift.STRING { - if err := p.ReadField2(iprot); err != nil { + if err := p.ReadField2(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.I32 { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.STRUCT { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *BinaryAnnotation) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *BinaryAnnotation) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Key = v @@ -624,8 +648,8 @@ func (p *BinaryAnnotation) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *BinaryAnnotation) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBinary(); err != nil { +func (p *BinaryAnnotation) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBinary(ctx); err != nil { return thrift.PrependError("error reading field 2: ", err) } else { p.Value = v @@ -633,8 +657,8 @@ func (p *BinaryAnnotation) ReadField2(iprot thrift.TProtocol) error { return nil } -func (p *BinaryAnnotation) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { +func (p *BinaryAnnotation) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { temp := AnnotationType(v) @@ -643,73 +667,86 @@ func (p *BinaryAnnotation) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *BinaryAnnotation) ReadField4(iprot thrift.TProtocol) error { +func (p *BinaryAnnotation) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { p.Host = &Endpoint{} - if err := p.Host.Read(iprot); err != nil { + if err := p.Host.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Host), err) } return nil } -func (p *BinaryAnnotation) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("BinaryAnnotation"); err != nil { +func (p *BinaryAnnotation) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "BinaryAnnotation"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField2(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *BinaryAnnotation) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("key", thrift.STRING, 1); err != nil { +func (p *BinaryAnnotation) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRING, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) } - if err := oprot.WriteString(string(p.Key)); err != nil { + if err := oprot.WriteString(ctx, string(p.Key)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) } return err } -func (p *BinaryAnnotation) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("value", thrift.STRING, 2); err != nil { +func (p *BinaryAnnotation) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRING, 2); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:value: ", p), err) } - if err := oprot.WriteBinary(p.Value); err != nil { + if err := oprot.WriteBinary(ctx, p.Value); err != nil { return thrift.PrependError(fmt.Sprintf("%T.value (2) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 2:value: ", p), err) } return err } -func (p *BinaryAnnotation) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("annotation_type", thrift.I32, 3); err != nil { +func (p *BinaryAnnotation) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "annotation_type", thrift.I32, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:annotation_type: ", p), err) } - if err := oprot.WriteI32(int32(p.AnnotationType)); err != nil { + if err := oprot.WriteI32(ctx, int32(p.AnnotationType)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.annotation_type (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:annotation_type: ", p), err) } return err } -func (p *BinaryAnnotation) writeField4(oprot thrift.TProtocol) (err error) { +func (p *BinaryAnnotation) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetHost() { - if err := oprot.WriteFieldBegin("host", thrift.STRUCT, 4); err != nil { + if err := oprot.WriteFieldBegin(ctx, "host", thrift.STRUCT, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:host: ", p), err) } - if err := p.Host.Write(oprot); err != nil { + if err := p.Host.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Host), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:host: ", p), err) } } return err } +func (p *BinaryAnnotation) Equals(other *BinaryAnnotation) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Key != other.Key { return false } + if bytes.Compare(p.Value, other.Value) != 0 { return false } + if p.AnnotationType != other.AnnotationType { return false } + if !p.Host.Equals(other.Host) { return false } + return true +} + func (p *BinaryAnnotation) String() string { if p == nil { return "" @@ -854,14 +891,14 @@ func (p *Span) IsSetTraceIDHigh() bool { return p.TraceIDHigh != nil } -func (p *Span) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Span) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -869,121 +906,121 @@ func (p *Span) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.I64 { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 3: if fieldTypeId == thrift.STRING { - if err := p.ReadField3(iprot); err != nil { + if err := p.ReadField3(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 4: if fieldTypeId == thrift.I64 { - if err := p.ReadField4(iprot); err != nil { + if err := p.ReadField4(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 5: if fieldTypeId == thrift.I64 { - if err := p.ReadField5(iprot); err != nil { + if err := p.ReadField5(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 6: if fieldTypeId == thrift.LIST { - if err := p.ReadField6(iprot); err != nil { + if err := p.ReadField6(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 8: if fieldTypeId == thrift.LIST { - if err := p.ReadField8(iprot); err != nil { + if err := p.ReadField8(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 9: if fieldTypeId == thrift.BOOL { - if err := p.ReadField9(iprot); err != nil { + if err := p.ReadField9(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 10: if fieldTypeId == thrift.I64 { - if err := p.ReadField10(iprot); err != nil { + if err := p.ReadField10(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 11: if fieldTypeId == thrift.I64 { - if err := p.ReadField11(iprot); err != nil { + if err := p.ReadField11(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } case 12: if fieldTypeId == thrift.I64 { - if err := p.ReadField12(iprot); err != nil { + if err := p.ReadField12(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *Span) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Span) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.TraceID = v @@ -991,8 +1028,8 @@ func (p *Span) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Span) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { +func (p *Span) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 3: ", err) } else { p.Name = v @@ -1000,8 +1037,8 @@ func (p *Span) ReadField3(iprot thrift.TProtocol) error { return nil } -func (p *Span) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Span) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 4: ", err) } else { p.ID = v @@ -1009,8 +1046,8 @@ func (p *Span) ReadField4(iprot thrift.TProtocol) error { return nil } -func (p *Span) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Span) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 5: ", err) } else { p.ParentID = &v @@ -1018,8 +1055,8 @@ func (p *Span) ReadField5(iprot thrift.TProtocol) error { return nil } -func (p *Span) ReadField6(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *Span) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } @@ -1027,19 +1064,19 @@ func (p *Span) ReadField6(iprot thrift.TProtocol) error { p.Annotations = tSlice for i := 0; i < size; i ++ { _elem0 := &Annotation{} - if err := _elem0.Read(iprot); err != nil { + if err := _elem0.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem0), err) } p.Annotations = append(p.Annotations, _elem0) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *Span) ReadField8(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *Span) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } @@ -1047,19 +1084,19 @@ func (p *Span) ReadField8(iprot thrift.TProtocol) error { p.BinaryAnnotations = tSlice for i := 0; i < size; i ++ { _elem1 := &BinaryAnnotation{} - if err := _elem1.Read(iprot); err != nil { + if err := _elem1.Read(ctx, iprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem1), err) } p.BinaryAnnotations = append(p.BinaryAnnotations, _elem1) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *Span) ReadField9(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *Span) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 9: ", err) } else { p.Debug = v @@ -1067,8 +1104,8 @@ func (p *Span) ReadField9(iprot thrift.TProtocol) error { return nil } -func (p *Span) ReadField10(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Span) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 10: ", err) } else { p.Timestamp = &v @@ -1076,8 +1113,8 @@ func (p *Span) ReadField10(iprot thrift.TProtocol) error { return nil } -func (p *Span) ReadField11(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Span) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 11: ", err) } else { p.Duration = &v @@ -1085,8 +1122,8 @@ func (p *Span) ReadField11(iprot thrift.TProtocol) error { return nil } -func (p *Span) ReadField12(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { +func (p *Span) ReadField12(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI64(ctx); err != nil { return thrift.PrependError("error reading field 12: ", err) } else { p.TraceIDHigh = &v @@ -1094,156 +1131,203 @@ func (p *Span) ReadField12(iprot thrift.TProtocol) error { return nil } -func (p *Span) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Span"); err != nil { +func (p *Span) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Span"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } - if err := p.writeField3(oprot); err != nil { return err } - if err := p.writeField4(oprot); err != nil { return err } - if err := p.writeField5(oprot); err != nil { return err } - if err := p.writeField6(oprot); err != nil { return err } - if err := p.writeField8(oprot); err != nil { return err } - if err := p.writeField9(oprot); err != nil { return err } - if err := p.writeField10(oprot); err != nil { return err } - if err := p.writeField11(oprot); err != nil { return err } - if err := p.writeField12(oprot); err != nil { return err } - } - if err := oprot.WriteFieldStop(); err != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + if err := p.writeField5(ctx, oprot); err != nil { return err } + if err := p.writeField6(ctx, oprot); err != nil { return err } + if err := p.writeField8(ctx, oprot); err != nil { return err } + if err := p.writeField9(ctx, oprot); err != nil { return err } + if err := p.writeField10(ctx, oprot); err != nil { return err } + if err := p.writeField11(ctx, oprot); err != nil { return err } + if err := p.writeField12(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Span) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("trace_id", thrift.I64, 1); err != nil { +func (p *Span) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "trace_id", thrift.I64, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:trace_id: ", p), err) } - if err := oprot.WriteI64(int64(p.TraceID)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.TraceID)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.trace_id (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:trace_id: ", p), err) } return err } -func (p *Span) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 3); err != nil { +func (p *Span) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 3); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:name: ", p), err) } - if err := oprot.WriteString(string(p.Name)); err != nil { + if err := oprot.WriteString(ctx, string(p.Name)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.name (3) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 3:name: ", p), err) } return err } -func (p *Span) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("id", thrift.I64, 4); err != nil { +func (p *Span) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "id", thrift.I64, 4); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:id: ", p), err) } - if err := oprot.WriteI64(int64(p.ID)); err != nil { + if err := oprot.WriteI64(ctx, int64(p.ID)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.id (4) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 4:id: ", p), err) } return err } -func (p *Span) writeField5(oprot thrift.TProtocol) (err error) { +func (p *Span) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetParentID() { - if err := oprot.WriteFieldBegin("parent_id", thrift.I64, 5); err != nil { + if err := oprot.WriteFieldBegin(ctx, "parent_id", thrift.I64, 5); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:parent_id: ", p), err) } - if err := oprot.WriteI64(int64(*p.ParentID)); err != nil { + if err := oprot.WriteI64(ctx, int64(*p.ParentID)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.parent_id (5) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 5:parent_id: ", p), err) } } return err } -func (p *Span) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("annotations", thrift.LIST, 6); err != nil { +func (p *Span) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "annotations", thrift.LIST, 6); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:annotations: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Annotations)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Annotations)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Annotations { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 6:annotations: ", p), err) } return err } -func (p *Span) writeField8(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("binary_annotations", thrift.LIST, 8); err != nil { +func (p *Span) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "binary_annotations", thrift.LIST, 8); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:binary_annotations: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.BinaryAnnotations)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.BinaryAnnotations)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.BinaryAnnotations { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 8:binary_annotations: ", p), err) } return err } -func (p *Span) writeField9(oprot thrift.TProtocol) (err error) { +func (p *Span) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetDebug() { - if err := oprot.WriteFieldBegin("debug", thrift.BOOL, 9); err != nil { + if err := oprot.WriteFieldBegin(ctx, "debug", thrift.BOOL, 9); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:debug: ", p), err) } - if err := oprot.WriteBool(bool(p.Debug)); err != nil { + if err := oprot.WriteBool(ctx, bool(p.Debug)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.debug (9) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 9:debug: ", p), err) } } return err } -func (p *Span) writeField10(oprot thrift.TProtocol) (err error) { +func (p *Span) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetTimestamp() { - if err := oprot.WriteFieldBegin("timestamp", thrift.I64, 10); err != nil { + if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 10); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:timestamp: ", p), err) } - if err := oprot.WriteI64(int64(*p.Timestamp)); err != nil { + if err := oprot.WriteI64(ctx, int64(*p.Timestamp)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.timestamp (10) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 10:timestamp: ", p), err) } } return err } -func (p *Span) writeField11(oprot thrift.TProtocol) (err error) { +func (p *Span) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetDuration() { - if err := oprot.WriteFieldBegin("duration", thrift.I64, 11); err != nil { + if err := oprot.WriteFieldBegin(ctx, "duration", thrift.I64, 11); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:duration: ", p), err) } - if err := oprot.WriteI64(int64(*p.Duration)); err != nil { + if err := oprot.WriteI64(ctx, int64(*p.Duration)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.duration (11) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 11:duration: ", p), err) } } return err } -func (p *Span) writeField12(oprot thrift.TProtocol) (err error) { +func (p *Span) writeField12(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetTraceIDHigh() { - if err := oprot.WriteFieldBegin("trace_id_high", thrift.I64, 12); err != nil { + if err := oprot.WriteFieldBegin(ctx, "trace_id_high", thrift.I64, 12); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 12:trace_id_high: ", p), err) } - if err := oprot.WriteI64(int64(*p.TraceIDHigh)); err != nil { + if err := oprot.WriteI64(ctx, int64(*p.TraceIDHigh)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.trace_id_high (12) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 12:trace_id_high: ", p), err) } } return err } +func (p *Span) Equals(other *Span) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.TraceID != other.TraceID { return false } + if p.Name != other.Name { return false } + if p.ID != other.ID { return false } + if p.ParentID != other.ParentID { + if p.ParentID == nil || other.ParentID == nil { + return false + } + if (*p.ParentID) != (*other.ParentID) { return false } + } + if len(p.Annotations) != len(other.Annotations) { return false } + for i, _tgt := range p.Annotations { + _src2 := other.Annotations[i] + if !_tgt.Equals(_src2) { return false } + } + if len(p.BinaryAnnotations) != len(other.BinaryAnnotations) { return false } + for i, _tgt := range p.BinaryAnnotations { + _src3 := other.BinaryAnnotations[i] + if !_tgt.Equals(_src3) { return false } + } + if p.Debug != other.Debug { return false } + if p.Timestamp != other.Timestamp { + if p.Timestamp == nil || other.Timestamp == nil { + return false + } + if (*p.Timestamp) != (*other.Timestamp) { return false } + } + if p.Duration != other.Duration { + if p.Duration == nil || other.Duration == nil { + return false + } + if (*p.Duration) != (*other.Duration) { return false } + } + if p.TraceIDHigh != other.TraceIDHigh { + if p.TraceIDHigh == nil || other.TraceIDHigh == nil { + return false + } + if (*p.TraceIDHigh) != (*other.TraceIDHigh) { return false } + } + return true +} + func (p *Span) String() string { if p == nil { return "" @@ -1265,15 +1349,15 @@ func NewResponse() *Response { func (p *Response) GetOk() bool { return p.Ok } -func (p *Response) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *Response) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } var issetOk bool = false; for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1281,25 +1365,25 @@ func (p *Response) Read(iprot thrift.TProtocol) error { switch fieldId { case 1: if fieldTypeId == thrift.BOOL { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } issetOk = true } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } if !issetOk{ @@ -1308,8 +1392,8 @@ func (p *Response) Read(iprot thrift.TProtocol) error { return nil } -func (p *Response) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { +func (p *Response) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { return thrift.PrependError("error reading field 1: ", err) } else { p.Ok = v @@ -1317,29 +1401,39 @@ func (p *Response) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *Response) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Response"); err != nil { +func (p *Response) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "Response"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *Response) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("ok", thrift.BOOL, 1); err != nil { +func (p *Response) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "ok", thrift.BOOL, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ok: ", p), err) } - if err := oprot.WriteBool(bool(p.Ok)); err != nil { + if err := oprot.WriteBool(ctx, bool(p.Ok)); err != nil { return thrift.PrependError(fmt.Sprintf("%T.ok (1) field write error: ", p), err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ok: ", p), err) } return err } +func (p *Response) Equals(other *Response) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.Ok != other.Ok { return false } + return true +} + func (p *Response) String() string { if p == nil { return "" @@ -1350,11 +1444,12 @@ func (p *Response) String() string { type ZipkinCollector interface { // Parameters: // - Spans - SubmitZipkinBatch(ctx context.Context, spans []*Span) (r []*Response, err error) + SubmitZipkinBatch(ctx context.Context, spans []*Span) (_r []*Response, _err error) } type ZipkinCollectorClient struct { c thrift.TClient + meta thrift.ResponseMeta } func NewZipkinCollectorClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ZipkinCollectorClient { @@ -1378,16 +1473,28 @@ func NewZipkinCollectorClient(c thrift.TClient) *ZipkinCollectorClient { func (p *ZipkinCollectorClient) Client_() thrift.TClient { return p.c } + +func (p *ZipkinCollectorClient) LastResponseMeta_() thrift.ResponseMeta { + return p.meta +} + +func (p *ZipkinCollectorClient) SetLastResponseMeta_(meta thrift.ResponseMeta) { + p.meta = meta +} + // Parameters: // - Spans -func (p *ZipkinCollectorClient) SubmitZipkinBatch(ctx context.Context, spans []*Span) (r []*Response, err error) { - var _args2 ZipkinCollectorSubmitZipkinBatchArgs - _args2.Spans = spans - var _result3 ZipkinCollectorSubmitZipkinBatchResult - if err = p.Client_().Call(ctx, "submitZipkinBatch", &_args2, &_result3); err != nil { +func (p *ZipkinCollectorClient) SubmitZipkinBatch(ctx context.Context, spans []*Span) (_r []*Response, _err error) { + var _args4 ZipkinCollectorSubmitZipkinBatchArgs + _args4.Spans = spans + var _result6 ZipkinCollectorSubmitZipkinBatchResult + var _meta5 thrift.ResponseMeta + _meta5, _err = p.Client_().Call(ctx, "submitZipkinBatch", &_args4, &_result6) + p.SetLastResponseMeta_(_meta5) + if _err != nil { return } - return _result3.GetSuccess(), nil + return _result6.GetSuccess(), nil } type ZipkinCollectorProcessor struct { @@ -1410,25 +1517,25 @@ func (p *ZipkinCollectorProcessor) ProcessorMap() map[string]thrift.TProcessorFu func NewZipkinCollectorProcessor(handler ZipkinCollector) *ZipkinCollectorProcessor { - self4 := &ZipkinCollectorProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)} - self4.processorMap["submitZipkinBatch"] = &zipkinCollectorProcessorSubmitZipkinBatch{handler:handler} -return self4 + self7 := &ZipkinCollectorProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)} + self7.processorMap["submitZipkinBatch"] = &zipkinCollectorProcessorSubmitZipkinBatch{handler:handler} +return self7 } func (p *ZipkinCollectorProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - name, _, seqId, err := iprot.ReadMessageBegin() - if err != nil { return false, err } + name, _, seqId, err2 := iprot.ReadMessageBegin(ctx) + if err2 != nil { return false, thrift.WrapTException(err2) } if processor, ok := p.GetProcessorFunction(name); ok { return processor.Process(ctx, seqId, iprot, oprot) } - iprot.Skip(thrift.STRUCT) - iprot.ReadMessageEnd() - x5 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name) - oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) - x5.Write(oprot) - oprot.WriteMessageEnd() + iprot.Skip(ctx, thrift.STRUCT) + iprot.ReadMessageEnd(ctx) + x8 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name) + oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId) + x8.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, x5 + return false, x8 } @@ -1438,41 +1545,72 @@ type zipkinCollectorProcessorSubmitZipkinBatch struct { func (p *zipkinCollectorProcessorSubmitZipkinBatch) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { args := ZipkinCollectorSubmitZipkinBatchArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("submitZipkinBatch", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + var err2 error + if err2 = args.Read(ctx, iprot); err2 != nil { + iprot.ReadMessageEnd(ctx) + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) + oprot.WriteMessageBegin(ctx, "submitZipkinBatch", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return false, err + return false, thrift.WrapTException(err2) + } + iprot.ReadMessageEnd(ctx) + + tickerCancel := func() {} + // Start a goroutine to do server side connectivity check. + if thrift.ServerConnectivityCheckInterval > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(ctx) + defer cancel() + var tickerCtx context.Context + tickerCtx, tickerCancel = context.WithCancel(context.Background()) + defer tickerCancel() + go func(ctx context.Context, cancel context.CancelFunc) { + ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if !iprot.Transport().IsOpen() { + cancel() + return + } + } + } + }(tickerCtx, cancel) } - iprot.ReadMessageEnd() result := ZipkinCollectorSubmitZipkinBatchResult{} -var retval []*Response - var err2 error + var retval []*Response if retval, err2 = p.handler.SubmitZipkinBatch(ctx, args.Spans); err2 != nil { + tickerCancel() + if err2 == thrift.ErrAbandonRequest { + return false, thrift.WrapTException(err2) + } x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing submitZipkinBatch: " + err2.Error()) - oprot.WriteMessageBegin("submitZipkinBatch", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() + oprot.WriteMessageBegin(ctx, "submitZipkinBatch", thrift.EXCEPTION, seqId) + x.Write(ctx, oprot) + oprot.WriteMessageEnd(ctx) oprot.Flush(ctx) - return true, err2 + return true, thrift.WrapTException(err2) } else { result.Success = retval -} - if err2 = oprot.WriteMessageBegin("submitZipkinBatch", thrift.REPLY, seqId); err2 != nil { - err = err2 } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + tickerCancel() + if err2 = oprot.WriteMessageBegin(ctx, "submitZipkinBatch", thrift.REPLY, seqId); err2 != nil { + err = thrift.WrapTException(err2) + } + if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { + err = thrift.WrapTException(err2) } if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + err = thrift.WrapTException(err2) } if err != nil { return @@ -1497,14 +1635,14 @@ func NewZipkinCollectorSubmitZipkinBatchArgs() *ZipkinCollectorSubmitZipkinBatch func (p *ZipkinCollectorSubmitZipkinBatchArgs) GetSpans() []*Span { return p.Spans } -func (p *ZipkinCollectorSubmitZipkinBatchArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ZipkinCollectorSubmitZipkinBatchArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1512,77 +1650,77 @@ func (p *ZipkinCollectorSubmitZipkinBatchArgs) Read(iprot thrift.TProtocol) erro switch fieldId { case 1: if fieldTypeId == thrift.LIST { - if err := p.ReadField1(iprot); err != nil { + if err := p.ReadField1(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ZipkinCollectorSubmitZipkinBatchArgs) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *ZipkinCollectorSubmitZipkinBatchArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*Span, 0, size) p.Spans = tSlice for i := 0; i < size; i ++ { - _elem6 := &Span{} - if err := _elem6.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem6), err) + _elem9 := &Span{} + if err := _elem9.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem9), err) } - p.Spans = append(p.Spans, _elem6) + p.Spans = append(p.Spans, _elem9) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *ZipkinCollectorSubmitZipkinBatchArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("submitZipkinBatch_args"); err != nil { +func (p *ZipkinCollectorSubmitZipkinBatchArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "submitZipkinBatch_args"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField1(oprot); err != nil { return err } + if err := p.writeField1(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ZipkinCollectorSubmitZipkinBatchArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("spans", thrift.LIST, 1); err != nil { +func (p *ZipkinCollectorSubmitZipkinBatchArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "spans", thrift.LIST, 1); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:spans: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Spans)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Spans)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Spans { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 1:spans: ", p), err) } return err } @@ -1613,14 +1751,14 @@ func (p *ZipkinCollectorSubmitZipkinBatchResult) IsSetSuccess() bool { return p.Success != nil } -func (p *ZipkinCollectorSubmitZipkinBatchResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { +func (p *ZipkinCollectorSubmitZipkinBatchResult) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) } for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) if err != nil { return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) } @@ -1628,78 +1766,78 @@ func (p *ZipkinCollectorSubmitZipkinBatchResult) Read(iprot thrift.TProtocol) er switch fieldId { case 0: if fieldTypeId == thrift.LIST { - if err := p.ReadField0(iprot); err != nil { + if err := p.ReadField0(ctx, iprot); err != nil { return err } } else { - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } default: - if err := iprot.Skip(fieldTypeId); err != nil { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err } } - if err := iprot.ReadFieldEnd(); err != nil { + if err := iprot.ReadFieldEnd(ctx); err != nil { return err } } - if err := iprot.ReadStructEnd(); err != nil { + if err := iprot.ReadStructEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } return nil } -func (p *ZipkinCollectorSubmitZipkinBatchResult) ReadField0(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() +func (p *ZipkinCollectorSubmitZipkinBatchResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]*Response, 0, size) p.Success = tSlice for i := 0; i < size; i ++ { - _elem7 := &Response{} - if err := _elem7.Read(iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem7), err) + _elem10 := &Response{} + if err := _elem10.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem10), err) } - p.Success = append(p.Success, _elem7) + p.Success = append(p.Success, _elem10) } - if err := iprot.ReadListEnd(); err != nil { + if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil } -func (p *ZipkinCollectorSubmitZipkinBatchResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("submitZipkinBatch_result"); err != nil { +func (p *ZipkinCollectorSubmitZipkinBatchResult) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "submitZipkinBatch_result"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { - if err := p.writeField0(oprot); err != nil { return err } + if err := p.writeField0(ctx, oprot); err != nil { return err } } - if err := oprot.WriteFieldStop(); err != nil { + if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } - if err := oprot.WriteStructEnd(); err != nil { + if err := oprot.WriteStructEnd(ctx); err != nil { return thrift.PrependError("write struct stop error: ", err) } return nil } -func (p *ZipkinCollectorSubmitZipkinBatchResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ZipkinCollectorSubmitZipkinBatchResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil { + if err := oprot.WriteFieldBegin(ctx, "success", thrift.LIST, 0); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Success)); err != nil { + if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Success)); err != nil { return thrift.PrependError("error writing list begin: ", err) } for _, v := range p.Success { - if err := v.Write(oprot); err != nil { + if err := v.Write(ctx, oprot); err != nil { return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) } } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteListEnd(ctx); err != nil { return thrift.PrependError("error writing list end: ", err) } - if err := oprot.WriteFieldEnd(); err != nil { + if err := oprot.WriteFieldEnd(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) } } return err