diff --git a/tracing/README.md b/tracing/README.md index 6a7879e7f..d5e60e826 100644 --- a/tracing/README.md +++ b/tracing/README.md @@ -1,11 +1,6 @@ # package tracing `package tracing` provides [Dapper][]-style request tracing to services. -An implementation exists for [Zipkin][]; [Appdash][] support is planned. - -[Dapper]: http://research.google.com/pubs/pub36356.html -[Zipkin]: https://blog.twitter.com/2012/distributed-systems-tracing-with-zipkin -[Appdash]: https://github.com/sourcegraph/appdash ## Rationale @@ -14,3 +9,52 @@ applications. It's instrumental in understanding request flows, identifying hot spots, and diagnosing errors. All microservice infrastructures will benefit from request tracing; sufficiently large infrastructures will require it. + +## OpenTracing + +Go kit builds on top of the [OpenTracing] API and uses the [opentracing-go] +package to provide tracing middlewares for its servers and clients. Currently +`kit/transport/http` and `kit/transport/grpc` transports are supported. + +Since [OpenTracing] is an upcoming standard API, Go kit should support a +multitude of tracing backends. If a Tracer implementation in Go for your +back-end exists, it should work out of the box. The following tracing back-ends +are known to work with Go kit through the OpenTracing interface and are +highlighted in the [addsvc] example. + + +### LightStep + +[LightStep] support is available through their standard Go package +[lightstep-tracer-go]. + +### AppDash + +[Appdash] support is available straight from their system repository in the +[appdash/opentracing] directory. + +### Zipkin + +[Zipkin] support is now available from the [zipkin-go-opentracing] package which +can be found at the [Open Zipkin GitHub] page. This means our old custom +`tracing/zipkin` package is now deprecated. In the `kit/tracing/zipkin` +directory you can still find the `docker-compose` script to bootstrap a Zipkin +development environment and a [README] detailing how to transition from the +old package to the new. + +[Dapper]: http://research.google.com/pubs/pub36356.html +[addsvc]:https://github.com/go-kit/kit/tree/master/examples/addsvc +[README]: https://github.com/go-kit/kit/blob/master/tracing/zipkin/README.md + +[OpenTracing]: http://opentracing.io +[opentracing-go]: https://github.com/opentracing/opentracing-go + +[Zipkin]: http://zipkin.io/ +[Open Zipkin GitHub]: https://github.com/openzipkin +[zipkin-go-opentracing]: https://github.com/openzipkin/zipkin-go-opentracing + +[Appdash]: https://github.com/sourcegraph/appdash +[appdash/opentracing]: https://github.com/sourcegraph/appdash/tree/master/opentracing + +[LightStep]: http://lightstep.com/ +[lightstep-tracer-go]: https://github.com/lightstep/lightstep-tracer-go diff --git a/tracing/zipkin/README.md b/tracing/zipkin/README.md index c62cc0cab..f13d20be9 100644 --- a/tracing/zipkin/README.md +++ b/tracing/zipkin/README.md @@ -4,8 +4,7 @@ Setting up [Zipkin] is not an easy thing to do. It will also demand quite some resources. To help you get started with development and testing we've made a -docker-compose file available for running a full Zipkin stack. See the -`kit/tracing/zipkin/_docker` subdirectory. +docker-compose file available for running a full Zipkin stack. You will need [docker-compose] 1.6.0+ and [docker-engine] 1.10.0+. @@ -14,7 +13,7 @@ or Windows you probably need to set the hostname environment variable to the hostname of the VM running the docker containers. ```sh -cd tracing/zipkin/_docker +cd tracing/zipkin HOSTNAME=localhost docker-compose -f docker-compose-zipkin.yml up ``` @@ -36,131 +35,97 @@ The following services have been set-up to run: ## Middleware Usage -Wrap a server- or client-side [endpoint][] so that it emits traces to a Zipkin -collector. Make sure the host given to `MakeNewSpanFunc` resolves to an IP. If -not your span will silently fail! +Follow the [addsvc] example to check out how to wire the Zipkin Middleware. The +changes should be relatively minor. -[endpoint]: http://godoc.org/github.com/go-kit/kit/endpoint#Endpoint +The [zipkin-go-opentracing] package has support for Kafka and Scribe collectors +as well as using Go Kit's [Log] package for logging. -If needing to create child spans in methods or calling another service from your -service method, it is highly recommended to request a context parameter so you -can transfer the needed metadata for traces across service boundaries. +### Span per Node vs. Span per RPC +OpenTracing tends to support the `span per node` model, meaning the server and +client side of an RPC call are dealt with in separate spans. This diverts from +the Zipkin V1 model which is more tailored towards the `span per RPC call` model +in which the server and client side annotations of the same RPC call are part of +the same span. The [zipkin-go-opentracing] implementation allows you to choose +which model you wish to use. Make sure you select the same model consistently +for all your services that are required to talk to each other or you will have +trace propagation issues. If using non OpenTracing / legacy instrumentation use +the `span per RPC call` model. -It is also wise to always return error parameters with your service method -calls, even if your service method implementations will not throw errors -themselves. The error return parameter can be wired to pass the potential -transport errors when consuming your service API in a networked environment. +To adhere to the OpenTracing philosophy the Tracer defaults to `span per node`. +To set the `span per RPC call` mode start your tracer like this: ```go -func main() { +tracer, err = zipkin.NewTracer( + zipkin.NewRecorder(...), + zipkin.ClientServerSameSpan(true), +) +``` + +[zipkin-go-opentracing]: https://github.com/openzipkin/zipkin-go-opentracing +[addsvc]:https://github.com/go-kit/kit/tree/master/examples/addsvc +[Log]: https://github.com/go-kit/kit/tree/master/log + +### Tracing Resources + +In our legacy implementation we had the `NewChildSpan` method to allow +annotation of resources such as databases, caches and other services that do not +have server side tracing support. Since OpenTracing has no specific method of +dealing with these items explicitely that is compatible with Zipkin's `SA` +annotation the [zipkin-go-opentracing] has implemented support using the +OpenTracing Tags system. Here is an example of how one would be able to record +a resource span compatible with standard OpenTracing and triggering an `SA` +annotation in [zipkin-go-opentracing]: + +```go +// you need to import the ext package for the Tag helper functions +import ( + "github.com/opentracing/opentracing-go" + "github.com/opentracing/opentracing-go/ext" +) + +func (svc *Service) GetMeSomeExamples(ctx context.Context, ...) ([]Examples, error) { + // Example of annotating a database query: var ( - // myHost MUST resolve to an IP or your span will not show up in Zipkin. - myHost = "instance01.addsvc.internal.net:8000" - myService = "AddService" - myMethod = "Add" - url = myHost + "/add/" - kafkaHost = []string{"kafka.internal.net:9092"} + serviceName = "MySQL" + serviceHost = "mysql.example.com" + servicePort = uint16(3306) + queryLabel = "GetExamplesByParam" + query = "select * from example where param = 'value'" ) - ctx := context.Background() - - // Set Up Zipkin Collector and Span factory - spanFunc := zipkin.MakeNewSpanFunc(myHost, myService, myMethod) - collector, _ := zipkin.NewKafkaCollector(kafkaHost) - - // Server-side Wiring - var server endpoint.Endpoint - server = makeEndpoint() // for your service - // wrap endpoint with Zipkin tracing middleware - server = zipkin.AnnotateServer(spanFunc, collector)(server) - - http.Handle( - "/add/", - httptransport.NewServer( - ctx, - server, - decodeRequestFunc, - encodeResponseFunc, - httptransport.ServerBefore( - zipkin.ToContext(spanFunc), - ), - ), - ) - ... + // retrieve the parent span, if not found create a new trace + parentSpan := opentracing.SpanFromContext(ctx) + if parentSpan == nil { + parentSpan = opentracing.StartSpan(queryLabel) + } - // Client-side - var client endpoint.Endpoint - client = httptransport.NewClient( - "GET", - URL, - encodeRequestFunc, - decodeResponseFunc, - httptransport.ClientBefore(zipkin.ToRequest(spanFunc)), - ).Endpoint() - client = zipkin.AnnotateClient(spanFunc, collector)(client) - - ctx, cancel := context.WithTimeout(ctx, myTimeout) - defer cancel() - - reply, err := client(ctx, param1, param2) - // do something with the response/error - ... -} -``` + // create a new span to record the resource interaction + span := opentracing.StartChildSpan(parentSpan, queryLabel) -## Annotating Remote Resources + // span.kind "resource" triggers SA annotation + ext.SpanKind.Set(span, "resource") -Next to the above shown examples of wiring server-side and client-side tracing -middlewares, you can also span resources called from your service methods. + // this will label the span's service & hostPort (called Endpoint in Zipkin) + ext.PeerService.Set(span, serviceName) + ext.PeerHostname,Set(span, serviceHost) + ext.PeerPort.Set(span, servicePort) -To do this, the service method needs to include a context parameter. From your -endpoint wrapper you can inject the endpoint context which will hold the parent -span already created by the server-side middleware. If the resource is a remote -database you can use the `zipkin.ServerAddr` spanOption to identify the remote -host:port and the display name of this resource. + // a Tag is the equivalent of a Zipkin Binary Annotation (key:value pair) + span.SetTag("query", query) -```go -type MyService struct { - // add a Zipkin Collector to your service implementation's properties. - Collector zipkin.Collector -} + // a LogEvent is the equivalent of a Zipkin Annotation (timestamped) + span.LogEvent("query:start") -// Example of the endpoint.Endpoint to service method wrapper, injecting the -// context provided by the transport server. -func makeComplexEndpoint() endpoint.Endpoint { - return func(ctx context.Context, request interface{}) (interface{}, error) { - req := request.(ComplexRequest) - v, err := svc.Complex(ctx, req.A, req.B) - return ComplexResponse{V: v, Err: err}, nil - } -} + // do the actual query... -// Complex is an example method of our service, displaying the tracing of a -// remote database resource. -func (s *MyService) Complex(ctx context.Context, A someType, B otherType) (returnType, error) { - // we've parsed the incoming parameters and now we need to query the database. - // we wish to include this action into our trace. - span, collect := zipkin.NewChildSpan( - ctx, - s.Collector, - "complexQuery", - zipkin.ServerAddr( - "mysql01.internal.net:3306", - "MySQL", - ), - ) - // you probably want to binary annotate your query - span.AnnotateBinary("query", "SELECT ... FROM ... WHERE ... ORDER BY ..."), - // annotate the start of the query - span.Annotate("complexQuery:start") - // do the query and handle resultset - ... - // annotate we are done with the query - span.Annotate("complexQuery:end") - // maybe binary annotate some items returned by the resultset - ... - // when done with all annotations, collect the span - collect() + // let's annotate the end... + span.LogEvent("query:end") + + // we're done with the span. send it to the SpanRecorder for collection... + span.Finish() + + // do other stuff ... } ``` diff --git a/tracing/zipkin/_thrift/compile.sh b/tracing/zipkin/_thrift/compile.sh deleted file mode 100755 index 5b88bbfb3..000000000 --- a/tracing/zipkin/_thrift/compile.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env sh - -# Thrift code generation for Go is broken in the current stable (0.9.2) -# release. Leaving this stubbed out until the fix is released. -# https://issues.apache.org/jira/browse/THRIFT-3021 - -# https://thrift.apache.org/tutorial/go -for f in *.thrift ; do - thrift -r --gen go:thrift_import=github.com/apache/thrift/lib/go/thrift $f -done - diff --git a/tracing/zipkin/_thrift/gen-go/scribe/constants.go b/tracing/zipkin/_thrift/gen-go/scribe/constants.go deleted file mode 100644 index d814d4dd0..000000000 --- a/tracing/zipkin/_thrift/gen-go/scribe/constants.go +++ /dev/null @@ -1,18 +0,0 @@ -// Autogenerated by Thrift Compiler (0.9.2) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -package scribe - -import ( - "bytes" - "fmt" - "github.com/apache/thrift/lib/go/thrift" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = bytes.Equal - -func init() { -} diff --git a/tracing/zipkin/_thrift/gen-go/scribe/scribe-remote/scribe-remote.go b/tracing/zipkin/_thrift/gen-go/scribe/scribe-remote/scribe-remote.go deleted file mode 100755 index dc4eafe3b..000000000 --- a/tracing/zipkin/_thrift/gen-go/scribe/scribe-remote/scribe-remote.go +++ /dev/null @@ -1,150 +0,0 @@ -// Autogenerated by Thrift Compiler (0.9.2) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -package main - -import ( - "flag" - "fmt" - "github.com/apache/thrift/lib/go/thrift" - "math" - "net" - "net/url" - "os" - "scribe" - "strconv" - "strings" -) - -func Usage() { - fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:") - flag.PrintDefaults() - fmt.Fprintln(os.Stderr, "\nFunctions:") - fmt.Fprintln(os.Stderr, " ResultCode Log( messages)") - fmt.Fprintln(os.Stderr) - os.Exit(0) -} - -func main() { - flag.Usage = Usage - var host string - var port int - var protocol string - var urlString string - var framed bool - var useHttp bool - var parsedUrl url.URL - var trans thrift.TTransport - _ = strconv.Atoi - _ = math.Abs - flag.Usage = Usage - flag.StringVar(&host, "h", "localhost", "Specify host and port") - flag.IntVar(&port, "p", 9090, "Specify port") - flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)") - flag.StringVar(&urlString, "u", "", "Specify the url") - flag.BoolVar(&framed, "framed", false, "Use framed transport") - flag.BoolVar(&useHttp, "http", false, "Use http") - flag.Parse() - - if len(urlString) > 0 { - parsedUrl, err := url.Parse(urlString) - if err != nil { - fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) - flag.Usage() - } - host = parsedUrl.Host - useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" - } else if useHttp { - _, err := url.Parse(fmt.Sprint("http://", host, ":", port)) - if err != nil { - fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) - flag.Usage() - } - } - - cmd := flag.Arg(0) - var err error - if useHttp { - trans, err = thrift.NewTHttpClient(parsedUrl.String()) - } else { - portStr := fmt.Sprint(port) - if strings.Contains(host, ":") { - host, portStr, err = net.SplitHostPort(host) - if err != nil { - fmt.Fprintln(os.Stderr, "error with host:", err) - os.Exit(1) - } - } - trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr)) - if err != nil { - fmt.Fprintln(os.Stderr, "error resolving address:", err) - os.Exit(1) - } - if framed { - trans = thrift.NewTFramedTransport(trans) - } - } - if err != nil { - fmt.Fprintln(os.Stderr, "Error creating transport", err) - os.Exit(1) - } - defer trans.Close() - var protocolFactory thrift.TProtocolFactory - switch protocol { - case "compact": - protocolFactory = thrift.NewTCompactProtocolFactory() - break - case "simplejson": - protocolFactory = thrift.NewTSimpleJSONProtocolFactory() - break - case "json": - protocolFactory = thrift.NewTJSONProtocolFactory() - break - case "binary", "": - protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() - break - default: - fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol) - Usage() - os.Exit(1) - } - client := scribe.NewScribeClientFactory(trans, protocolFactory) - if err := trans.Open(); err != nil { - fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err) - os.Exit(1) - } - - switch cmd { - case "Log": - if flag.NArg()-1 != 1 { - fmt.Fprintln(os.Stderr, "Log requires 1 args") - flag.Usage() - } - arg5 := flag.Arg(1) - mbTrans6 := thrift.NewTMemoryBufferLen(len(arg5)) - defer mbTrans6.Close() - _, err7 := mbTrans6.WriteString(arg5) - if err7 != nil { - Usage() - return - } - factory8 := thrift.NewTSimpleJSONProtocolFactory() - jsProt9 := factory8.GetProtocol(mbTrans6) - containerStruct0 := scribe.NewLogArgs() - err10 := containerStruct0.ReadField1(jsProt9) - if err10 != nil { - Usage() - return - } - argvalue0 := containerStruct0.Messages - value0 := argvalue0 - fmt.Print(client.Log(value0)) - fmt.Print("\n") - break - case "": - Usage() - break - default: - fmt.Fprintln(os.Stderr, "Invalid function ", cmd) - } -} diff --git a/tracing/zipkin/_thrift/gen-go/scribe/scribe.go b/tracing/zipkin/_thrift/gen-go/scribe/scribe.go deleted file mode 100644 index 44f60367c..000000000 --- a/tracing/zipkin/_thrift/gen-go/scribe/scribe.go +++ /dev/null @@ -1,418 +0,0 @@ -// Autogenerated by Thrift Compiler (0.9.2) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -package scribe - -import ( - "bytes" - "fmt" - - "github.com/apache/thrift/lib/go/thrift" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = bytes.Equal - -type Scribe interface { - // Parameters: - // - Messages - Log(messages []*LogEntry) (r ResultCode, err error) -} - -type ScribeClient struct { - Transport thrift.TTransport - ProtocolFactory thrift.TProtocolFactory - InputProtocol thrift.TProtocol - OutputProtocol thrift.TProtocol - SeqId int32 -} - -func NewScribeClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ScribeClient { - return &ScribeClient{Transport: t, - ProtocolFactory: f, - InputProtocol: f.GetProtocol(t), - OutputProtocol: f.GetProtocol(t), - SeqId: 0, - } -} - -func NewScribeClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ScribeClient { - return &ScribeClient{Transport: t, - ProtocolFactory: nil, - InputProtocol: iprot, - OutputProtocol: oprot, - SeqId: 0, - } -} - -// Parameters: -// - Messages -func (p *ScribeClient) Log(messages []*LogEntry) (r ResultCode, err error) { - if err = p.sendLog(messages); err != nil { - return - } - return p.recvLog() -} - -func (p *ScribeClient) sendLog(messages []*LogEntry) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("Log", thrift.CALL, p.SeqId); err != nil { - return - } - args := LogArgs{ - Messages: messages, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ScribeClient) recvLog() (value ResultCode, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error0 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error1 error - error1, err = error0.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error1 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "Log failed: out of sequence response") - return - } - result := LogResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - value = result.GetSuccess() - return -} - -type ScribeProcessor struct { - processorMap map[string]thrift.TProcessorFunction - handler Scribe -} - -func (p *ScribeProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { - p.processorMap[key] = processor -} - -func (p *ScribeProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { - processor, ok = p.processorMap[key] - return processor, ok -} - -func (p *ScribeProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { - return p.processorMap -} - -func NewScribeProcessor(handler Scribe) *ScribeProcessor { - - self2 := &ScribeProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} - self2.processorMap["Log"] = &scribeProcessorLog{handler: handler} - return self2 -} - -func (p *ScribeProcessor) Process(iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - name, _, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return false, err - } - if processor, ok := p.GetProcessorFunction(name); ok { - return processor.Process(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() - oprot.Flush() - return false, x3 - -} - -type scribeProcessorLog struct { - handler Scribe -} - -func (p *scribeProcessorLog) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := LogArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("Log", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := LogResult{} - var retval ResultCode - var err2 error - if retval, err2 = p.handler.Log(args.Messages); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing Log: "+err2.Error()) - oprot.WriteMessageBegin("Log", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } else { - result.Success = &retval - } - if err2 = oprot.WriteMessageBegin("Log", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -// HELPER FUNCTIONS AND STRUCTURES - -type LogArgs struct { - Messages []*LogEntry `thrift:"messages,1" json:"messages"` -} - -func NewLogArgs() *LogArgs { - return &LogArgs{} -} - -func (p *LogArgs) GetMessages() []*LogEntry { - return p.Messages -} -func (p *LogArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *LogArgs) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]*LogEntry, 0, size) - p.Messages = tSlice - for i := 0; i < size; i++ { - _elem4 := &LogEntry{} - if err := _elem4.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem4, err) - } - p.Messages = append(p.Messages, _elem4) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *LogArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Log_args"); 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *LogArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("messages", thrift.LIST, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:messages: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Messages)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Messages { - if err := v.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", v, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:messages: %s", p, err) - } - return err -} - -func (p *LogArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("LogArgs(%+v)", *p) -} - -type LogResult struct { - Success *ResultCode `thrift:"success,0" json:"success"` -} - -func NewLogResult() *LogResult { - return &LogResult{} -} - -var LogResult_Success_DEFAULT ResultCode - -func (p *LogResult) GetSuccess() ResultCode { - if !p.IsSetSuccess() { - return LogResult_Success_DEFAULT - } - return *p.Success -} -func (p *LogResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *LogResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *LogResult) ReadField0(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - temp := ResultCode(v) - p.Success = &temp - } - return nil -} - -func (p *LogResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Log_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *LogResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.I32, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := oprot.WriteI32(int32(*p.Success)); err != nil { - return fmt.Errorf("%T.success (0) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *LogResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("LogResult(%+v)", *p) -} diff --git a/tracing/zipkin/_thrift/gen-go/scribe/ttypes.go b/tracing/zipkin/_thrift/gen-go/scribe/ttypes.go deleted file mode 100644 index 269989176..000000000 --- a/tracing/zipkin/_thrift/gen-go/scribe/ttypes.go +++ /dev/null @@ -1,168 +0,0 @@ -// Autogenerated by Thrift Compiler (0.9.2) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -package scribe - -import ( - "bytes" - "fmt" - "github.com/apache/thrift/lib/go/thrift" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = bytes.Equal - -var GoUnusedProtection__ int - -type ResultCode int64 - -const ( - ResultCode_OK ResultCode = 0 - ResultCode_TRY_LATER ResultCode = 1 -) - -func (p ResultCode) String() string { - switch p { - case ResultCode_OK: - return "ResultCode_OK" - case ResultCode_TRY_LATER: - return "ResultCode_TRY_LATER" - } - return "" -} - -func ResultCodeFromString(s string) (ResultCode, error) { - switch s { - case "ResultCode_OK": - return ResultCode_OK, nil - case "ResultCode_TRY_LATER": - return ResultCode_TRY_LATER, nil - } - return ResultCode(0), fmt.Errorf("not a valid ResultCode string") -} - -func ResultCodePtr(v ResultCode) *ResultCode { return &v } - -type LogEntry struct { - Category string `thrift:"category,1" json:"category"` - Message string `thrift:"message,2" json:"message"` -} - -func NewLogEntry() *LogEntry { - return &LogEntry{} -} - -func (p *LogEntry) GetCategory() string { - return p.Category -} - -func (p *LogEntry) GetMessage() string { - return p.Message -} -func (p *LogEntry) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *LogEntry) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.Category = v - } - return nil -} - -func (p *LogEntry) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.Message = v - } - return nil -} - -func (p *LogEntry) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("LogEntry"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := p.writeField2(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *LogEntry) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("category", thrift.STRING, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:category: %s", p, err) - } - if err := oprot.WriteString(string(p.Category)); err != nil { - return fmt.Errorf("%T.category (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:category: %s", p, err) - } - return err -} - -func (p *LogEntry) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("message", thrift.STRING, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:message: %s", p, err) - } - if err := oprot.WriteString(string(p.Message)); err != nil { - return fmt.Errorf("%T.message (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:message: %s", p, err) - } - return err -} - -func (p *LogEntry) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("LogEntry(%+v)", *p) -} diff --git a/tracing/zipkin/_thrift/gen-go/zipkincollector/constants.go b/tracing/zipkin/_thrift/gen-go/zipkincollector/constants.go deleted file mode 100644 index 4dddb68b9..000000000 --- a/tracing/zipkin/_thrift/gen-go/zipkincollector/constants.go +++ /dev/null @@ -1,23 +0,0 @@ -// Autogenerated by Thrift Compiler (0.9.2) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -package zipkincollector - -import ( - "bytes" - "fmt" - "github.com/apache/thrift/lib/go/thrift" - "scribe" - "zipkindependencies" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = bytes.Equal - -var _ = scribe.GoUnusedProtection__ -var _ = zipkindependencies.GoUnusedProtection__ - -func init() { -} diff --git a/tracing/zipkin/_thrift/gen-go/zipkincollector/ttypes.go b/tracing/zipkin/_thrift/gen-go/zipkincollector/ttypes.go deleted file mode 100644 index 931d4c480..000000000 --- a/tracing/zipkin/_thrift/gen-go/zipkincollector/ttypes.go +++ /dev/null @@ -1,205 +0,0 @@ -// Autogenerated by Thrift Compiler (0.9.2) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -package zipkincollector - -import ( - "bytes" - "fmt" - "github.com/apache/thrift/lib/go/thrift" - "scribe" - "zipkindependencies" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = bytes.Equal - -var _ = scribe.GoUnusedProtection__ -var _ = zipkindependencies.GoUnusedProtection__ -var GoUnusedProtection__ int - -type AdjustableRateException struct { - Msg string `thrift:"msg,1" json:"msg"` -} - -func NewAdjustableRateException() *AdjustableRateException { - return &AdjustableRateException{} -} - -func (p *AdjustableRateException) GetMsg() string { - return p.Msg -} -func (p *AdjustableRateException) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *AdjustableRateException) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.Msg = v - } - return nil -} - -func (p *AdjustableRateException) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("AdjustableRateException"); 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *AdjustableRateException) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("msg", thrift.STRING, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:msg: %s", p, err) - } - if err := oprot.WriteString(string(p.Msg)); err != nil { - return fmt.Errorf("%T.msg (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:msg: %s", p, err) - } - return err -} - -func (p *AdjustableRateException) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("AdjustableRateException(%+v)", *p) -} - -func (p *AdjustableRateException) Error() string { - return p.String() -} - -type StoreAggregatesException struct { - Msg string `thrift:"msg,1" json:"msg"` -} - -func NewStoreAggregatesException() *StoreAggregatesException { - return &StoreAggregatesException{} -} - -func (p *StoreAggregatesException) GetMsg() string { - return p.Msg -} -func (p *StoreAggregatesException) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *StoreAggregatesException) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.Msg = v - } - return nil -} - -func (p *StoreAggregatesException) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("StoreAggregatesException"); 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *StoreAggregatesException) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("msg", thrift.STRING, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:msg: %s", p, err) - } - if err := oprot.WriteString(string(p.Msg)); err != nil { - return fmt.Errorf("%T.msg (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:msg: %s", p, err) - } - return err -} - -func (p *StoreAggregatesException) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("StoreAggregatesException(%+v)", *p) -} - -func (p *StoreAggregatesException) Error() string { - return p.String() -} diff --git a/tracing/zipkin/_thrift/gen-go/zipkincollector/zipkin_collector-remote/zipkin_collector-remote.go b/tracing/zipkin/_thrift/gen-go/zipkincollector/zipkin_collector-remote/zipkin_collector-remote.go deleted file mode 100755 index 4602235a8..000000000 --- a/tracing/zipkin/_thrift/gen-go/zipkincollector/zipkin_collector-remote/zipkin_collector-remote.go +++ /dev/null @@ -1,234 +0,0 @@ -// Autogenerated by Thrift Compiler (0.9.2) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -package main - -import ( - "flag" - "fmt" - "github.com/apache/thrift/lib/go/thrift" - "math" - "net" - "net/url" - "os" - "strconv" - "strings" - "zipkincollector" -) - -func Usage() { - fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:") - flag.PrintDefaults() - fmt.Fprintln(os.Stderr, "\nFunctions:") - fmt.Fprintln(os.Stderr, " void storeTopAnnotations(string service_name, annotations)") - fmt.Fprintln(os.Stderr, " void storeTopKeyValueAnnotations(string service_name, annotations)") - fmt.Fprintln(os.Stderr, " void storeDependencies(Dependencies dependencies)") - fmt.Fprintln(os.Stderr, " ResultCode Log( messages)") - fmt.Fprintln(os.Stderr) - os.Exit(0) -} - -func main() { - flag.Usage = Usage - var host string - var port int - var protocol string - var urlString string - var framed bool - var useHttp bool - var parsedUrl url.URL - var trans thrift.TTransport - _ = strconv.Atoi - _ = math.Abs - flag.Usage = Usage - flag.StringVar(&host, "h", "localhost", "Specify host and port") - flag.IntVar(&port, "p", 9090, "Specify port") - flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)") - flag.StringVar(&urlString, "u", "", "Specify the url") - flag.BoolVar(&framed, "framed", false, "Use framed transport") - flag.BoolVar(&useHttp, "http", false, "Use http") - flag.Parse() - - if len(urlString) > 0 { - parsedUrl, err := url.Parse(urlString) - if err != nil { - fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) - flag.Usage() - } - host = parsedUrl.Host - useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" - } else if useHttp { - _, err := url.Parse(fmt.Sprint("http://", host, ":", port)) - if err != nil { - fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) - flag.Usage() - } - } - - cmd := flag.Arg(0) - var err error - if useHttp { - trans, err = thrift.NewTHttpClient(parsedUrl.String()) - } else { - portStr := fmt.Sprint(port) - if strings.Contains(host, ":") { - host, portStr, err = net.SplitHostPort(host) - if err != nil { - fmt.Fprintln(os.Stderr, "error with host:", err) - os.Exit(1) - } - } - trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr)) - if err != nil { - fmt.Fprintln(os.Stderr, "error resolving address:", err) - os.Exit(1) - } - if framed { - trans = thrift.NewTFramedTransport(trans) - } - } - if err != nil { - fmt.Fprintln(os.Stderr, "Error creating transport", err) - os.Exit(1) - } - defer trans.Close() - var protocolFactory thrift.TProtocolFactory - switch protocol { - case "compact": - protocolFactory = thrift.NewTCompactProtocolFactory() - break - case "simplejson": - protocolFactory = thrift.NewTSimpleJSONProtocolFactory() - break - case "json": - protocolFactory = thrift.NewTJSONProtocolFactory() - break - case "binary", "": - protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() - break - default: - fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol) - Usage() - os.Exit(1) - } - client := zipkincollector.NewZipkinCollectorClientFactory(trans, protocolFactory) - if err := trans.Open(); err != nil { - fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err) - os.Exit(1) - } - - switch cmd { - case "storeTopAnnotations": - if flag.NArg()-1 != 2 { - fmt.Fprintln(os.Stderr, "StoreTopAnnotations requires 2 args") - flag.Usage() - } - argvalue0 := flag.Arg(1) - value0 := argvalue0 - arg10 := flag.Arg(2) - mbTrans11 := thrift.NewTMemoryBufferLen(len(arg10)) - defer mbTrans11.Close() - _, err12 := mbTrans11.WriteString(arg10) - if err12 != nil { - Usage() - return - } - factory13 := thrift.NewTSimpleJSONProtocolFactory() - jsProt14 := factory13.GetProtocol(mbTrans11) - containerStruct1 := zipkincollector.NewStoreTopAnnotationsArgs() - err15 := containerStruct1.ReadField2(jsProt14) - if err15 != nil { - Usage() - return - } - argvalue1 := containerStruct1.Annotations - value1 := argvalue1 - fmt.Print(client.StoreTopAnnotations(value0, value1)) - fmt.Print("\n") - break - case "storeTopKeyValueAnnotations": - if flag.NArg()-1 != 2 { - fmt.Fprintln(os.Stderr, "StoreTopKeyValueAnnotations requires 2 args") - flag.Usage() - } - argvalue0 := flag.Arg(1) - value0 := argvalue0 - arg17 := flag.Arg(2) - mbTrans18 := thrift.NewTMemoryBufferLen(len(arg17)) - defer mbTrans18.Close() - _, err19 := mbTrans18.WriteString(arg17) - if err19 != nil { - Usage() - return - } - factory20 := thrift.NewTSimpleJSONProtocolFactory() - jsProt21 := factory20.GetProtocol(mbTrans18) - containerStruct1 := zipkincollector.NewStoreTopKeyValueAnnotationsArgs() - err22 := containerStruct1.ReadField2(jsProt21) - if err22 != nil { - Usage() - return - } - argvalue1 := containerStruct1.Annotations - value1 := argvalue1 - fmt.Print(client.StoreTopKeyValueAnnotations(value0, value1)) - fmt.Print("\n") - break - case "storeDependencies": - if flag.NArg()-1 != 1 { - fmt.Fprintln(os.Stderr, "StoreDependencies requires 1 args") - flag.Usage() - } - arg23 := flag.Arg(1) - mbTrans24 := thrift.NewTMemoryBufferLen(len(arg23)) - defer mbTrans24.Close() - _, err25 := mbTrans24.WriteString(arg23) - if err25 != nil { - Usage() - return - } - factory26 := thrift.NewTSimpleJSONProtocolFactory() - jsProt27 := factory26.GetProtocol(mbTrans24) - argvalue0 := zipkincollector.NewDependencies() - err28 := argvalue0.Read(jsProt27) - if err28 != nil { - Usage() - return - } - value0 := argvalue0 - fmt.Print(client.StoreDependencies(value0)) - fmt.Print("\n") - break - case "Log": - if flag.NArg()-1 != 1 { - fmt.Fprintln(os.Stderr, "Log requires 1 args") - flag.Usage() - } - arg29 := flag.Arg(1) - mbTrans30 := thrift.NewTMemoryBufferLen(len(arg29)) - defer mbTrans30.Close() - _, err31 := mbTrans30.WriteString(arg29) - if err31 != nil { - Usage() - return - } - factory32 := thrift.NewTSimpleJSONProtocolFactory() - jsProt33 := factory32.GetProtocol(mbTrans30) - containerStruct0 := zipkincollector.NewLogArgs() - err34 := containerStruct0.ReadField1(jsProt33) - if err34 != nil { - Usage() - return - } - argvalue0 := containerStruct0.Messages - value0 := argvalue0 - fmt.Print(client.Log(value0)) - fmt.Print("\n") - break - case "": - Usage() - break - default: - fmt.Fprintln(os.Stderr, "Invalid function ", cmd) - } -} diff --git a/tracing/zipkin/_thrift/gen-go/zipkincollector/zipkincollector.go b/tracing/zipkin/_thrift/gen-go/zipkincollector/zipkincollector.go deleted file mode 100644 index 1724abea4..000000000 --- a/tracing/zipkin/_thrift/gen-go/zipkincollector/zipkincollector.go +++ /dev/null @@ -1,1112 +0,0 @@ -// Autogenerated by Thrift Compiler (0.9.2) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -package zipkincollector - -import ( - "bytes" - "fmt" - "github.com/apache/thrift/lib/go/thrift" - "scribe" - "zipkindependencies" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = bytes.Equal - -var _ = scribe.GoUnusedProtection__ -var _ = zipkindependencies.GoUnusedProtection__ - -type ZipkinCollector interface { - scribe.Scribe - - // Aggregates methods - // - // Parameters: - // - ServiceName - // - Annotations - StoreTopAnnotations(service_name string, annotations []string) (err error) - // Parameters: - // - ServiceName - // - Annotations - StoreTopKeyValueAnnotations(service_name string, annotations []string) (err error) - // Parameters: - // - Dependencies - StoreDependencies(dependencies *zipkindependencies.Dependencies) (err error) -} - -type ZipkinCollectorClient struct { - *scribe.ScribeClient -} - -func NewZipkinCollectorClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ZipkinCollectorClient { - return &ZipkinCollectorClient{ScribeClient: scribe.NewScribeClientFactory(t, f)} -} - -func NewZipkinCollectorClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ZipkinCollectorClient { - return &ZipkinCollectorClient{ScribeClient: scribe.NewScribeClientProtocol(t, iprot, oprot)} -} - -// Aggregates methods -// -// Parameters: -// - ServiceName -// - Annotations -func (p *ZipkinCollectorClient) StoreTopAnnotations(service_name string, annotations []string) (err error) { - if err = p.sendStoreTopAnnotations(service_name, annotations); err != nil { - return - } - return p.recvStoreTopAnnotations() -} - -func (p *ZipkinCollectorClient) sendStoreTopAnnotations(service_name string, annotations []string) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("storeTopAnnotations", thrift.CALL, p.SeqId); err != nil { - return - } - args := StoreTopAnnotationsArgs{ - ServiceName: service_name, - Annotations: annotations, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinCollectorClient) recvStoreTopAnnotations() (err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error0 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error1 error - error1, err = error0.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error1 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "storeTopAnnotations failed: out of sequence response") - return - } - result := StoreTopAnnotationsResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.E != nil { - err = result.E - return - } - return -} - -// Parameters: -// - ServiceName -// - Annotations -func (p *ZipkinCollectorClient) StoreTopKeyValueAnnotations(service_name string, annotations []string) (err error) { - if err = p.sendStoreTopKeyValueAnnotations(service_name, annotations); err != nil { - return - } - return p.recvStoreTopKeyValueAnnotations() -} - -func (p *ZipkinCollectorClient) sendStoreTopKeyValueAnnotations(service_name string, annotations []string) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("storeTopKeyValueAnnotations", thrift.CALL, p.SeqId); err != nil { - return - } - args := StoreTopKeyValueAnnotationsArgs{ - ServiceName: service_name, - Annotations: annotations, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinCollectorClient) recvStoreTopKeyValueAnnotations() (err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error2 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error3 error - error3, err = error2.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error3 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "storeTopKeyValueAnnotations failed: out of sequence response") - return - } - result := StoreTopKeyValueAnnotationsResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.E != nil { - err = result.E - return - } - return -} - -// Parameters: -// - Dependencies -func (p *ZipkinCollectorClient) StoreDependencies(dependencies *zipkindependencies.Dependencies) (err error) { - if err = p.sendStoreDependencies(dependencies); err != nil { - return - } - return p.recvStoreDependencies() -} - -func (p *ZipkinCollectorClient) sendStoreDependencies(dependencies *zipkindependencies.Dependencies) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("storeDependencies", thrift.CALL, p.SeqId); err != nil { - return - } - args := StoreDependenciesArgs{ - Dependencies: dependencies, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinCollectorClient) recvStoreDependencies() (err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error4 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error5 error - error5, err = error4.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error5 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "storeDependencies failed: out of sequence response") - return - } - result := StoreDependenciesResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.E != nil { - err = result.E - return - } - return -} - -type ZipkinCollectorProcessor struct { - *scribe.ScribeProcessor -} - -func NewZipkinCollectorProcessor(handler ZipkinCollector) *ZipkinCollectorProcessor { - self6 := &ZipkinCollectorProcessor{scribe.NewScribeProcessor(handler)} - self6.AddToProcessorMap("storeTopAnnotations", &zipkinCollectorProcessorStoreTopAnnotations{handler: handler}) - self6.AddToProcessorMap("storeTopKeyValueAnnotations", &zipkinCollectorProcessorStoreTopKeyValueAnnotations{handler: handler}) - self6.AddToProcessorMap("storeDependencies", &zipkinCollectorProcessorStoreDependencies{handler: handler}) - return self6 -} - -type zipkinCollectorProcessorStoreTopAnnotations struct { - handler ZipkinCollector -} - -func (p *zipkinCollectorProcessorStoreTopAnnotations) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := StoreTopAnnotationsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("storeTopAnnotations", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := StoreTopAnnotationsResult{} - var err2 error - if err2 = p.handler.StoreTopAnnotations(args.ServiceName, args.Annotations); err2 != nil { - switch v := err2.(type) { - case *StoreAggregatesException: - result.E = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing storeTopAnnotations: "+err2.Error()) - oprot.WriteMessageBegin("storeTopAnnotations", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } - if err2 = oprot.WriteMessageBegin("storeTopAnnotations", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinCollectorProcessorStoreTopKeyValueAnnotations struct { - handler ZipkinCollector -} - -func (p *zipkinCollectorProcessorStoreTopKeyValueAnnotations) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := StoreTopKeyValueAnnotationsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("storeTopKeyValueAnnotations", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := StoreTopKeyValueAnnotationsResult{} - var err2 error - if err2 = p.handler.StoreTopKeyValueAnnotations(args.ServiceName, args.Annotations); err2 != nil { - switch v := err2.(type) { - case *StoreAggregatesException: - result.E = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing storeTopKeyValueAnnotations: "+err2.Error()) - oprot.WriteMessageBegin("storeTopKeyValueAnnotations", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } - if err2 = oprot.WriteMessageBegin("storeTopKeyValueAnnotations", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinCollectorProcessorStoreDependencies struct { - handler ZipkinCollector -} - -func (p *zipkinCollectorProcessorStoreDependencies) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := StoreDependenciesArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("storeDependencies", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := StoreDependenciesResult{} - var err2 error - if err2 = p.handler.StoreDependencies(args.Dependencies); err2 != nil { - switch v := err2.(type) { - case *StoreAggregatesException: - result.E = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing storeDependencies: "+err2.Error()) - oprot.WriteMessageBegin("storeDependencies", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } - if err2 = oprot.WriteMessageBegin("storeDependencies", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -// HELPER FUNCTIONS AND STRUCTURES - -type StoreTopAnnotationsArgs struct { - ServiceName string `thrift:"service_name,1" json:"service_name"` - Annotations []string `thrift:"annotations,2" json:"annotations"` -} - -func NewStoreTopAnnotationsArgs() *StoreTopAnnotationsArgs { - return &StoreTopAnnotationsArgs{} -} - -func (p *StoreTopAnnotationsArgs) GetServiceName() string { - return p.ServiceName -} - -func (p *StoreTopAnnotationsArgs) GetAnnotations() []string { - return p.Annotations -} -func (p *StoreTopAnnotationsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *StoreTopAnnotationsArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.ServiceName = v - } - return nil -} - -func (p *StoreTopAnnotationsArgs) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]string, 0, size) - p.Annotations = tSlice - for i := 0; i < size; i++ { - var _elem7 string - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem7 = v - } - p.Annotations = append(p.Annotations, _elem7) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *StoreTopAnnotationsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("storeTopAnnotations_args"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := p.writeField2(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *StoreTopAnnotationsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err) - } - if err := oprot.WriteString(string(p.ServiceName)); err != nil { - return fmt.Errorf("%T.service_name (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:service_name: %s", p, err) - } - return err -} - -func (p *StoreTopAnnotationsArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("annotations", thrift.LIST, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:annotations: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRING, len(p.Annotations)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Annotations { - if err := oprot.WriteString(string(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:annotations: %s", p, err) - } - return err -} - -func (p *StoreTopAnnotationsArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("StoreTopAnnotationsArgs(%+v)", *p) -} - -type StoreTopAnnotationsResult struct { - E *StoreAggregatesException `thrift:"e,1" json:"e"` -} - -func NewStoreTopAnnotationsResult() *StoreTopAnnotationsResult { - return &StoreTopAnnotationsResult{} -} - -var StoreTopAnnotationsResult_E_DEFAULT *StoreAggregatesException - -func (p *StoreTopAnnotationsResult) GetE() *StoreAggregatesException { - if !p.IsSetE() { - return StoreTopAnnotationsResult_E_DEFAULT - } - return p.E -} -func (p *StoreTopAnnotationsResult) IsSetE() bool { - return p.E != nil -} - -func (p *StoreTopAnnotationsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *StoreTopAnnotationsResult) ReadField1(iprot thrift.TProtocol) error { - p.E = &StoreAggregatesException{} - if err := p.E.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.E, err) - } - return nil -} - -func (p *StoreTopAnnotationsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("storeTopAnnotations_result"); 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *StoreTopAnnotationsResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetE() { - if err := oprot.WriteFieldBegin("e", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:e: %s", p, err) - } - if err := p.E.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.E, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:e: %s", p, err) - } - } - return err -} - -func (p *StoreTopAnnotationsResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("StoreTopAnnotationsResult(%+v)", *p) -} - -type StoreTopKeyValueAnnotationsArgs struct { - ServiceName string `thrift:"service_name,1" json:"service_name"` - Annotations []string `thrift:"annotations,2" json:"annotations"` -} - -func NewStoreTopKeyValueAnnotationsArgs() *StoreTopKeyValueAnnotationsArgs { - return &StoreTopKeyValueAnnotationsArgs{} -} - -func (p *StoreTopKeyValueAnnotationsArgs) GetServiceName() string { - return p.ServiceName -} - -func (p *StoreTopKeyValueAnnotationsArgs) GetAnnotations() []string { - return p.Annotations -} -func (p *StoreTopKeyValueAnnotationsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *StoreTopKeyValueAnnotationsArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.ServiceName = v - } - return nil -} - -func (p *StoreTopKeyValueAnnotationsArgs) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]string, 0, size) - p.Annotations = tSlice - for i := 0; i < size; i++ { - var _elem8 string - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem8 = v - } - p.Annotations = append(p.Annotations, _elem8) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *StoreTopKeyValueAnnotationsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("storeTopKeyValueAnnotations_args"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := p.writeField2(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *StoreTopKeyValueAnnotationsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err) - } - if err := oprot.WriteString(string(p.ServiceName)); err != nil { - return fmt.Errorf("%T.service_name (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:service_name: %s", p, err) - } - return err -} - -func (p *StoreTopKeyValueAnnotationsArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("annotations", thrift.LIST, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:annotations: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRING, len(p.Annotations)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Annotations { - if err := oprot.WriteString(string(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:annotations: %s", p, err) - } - return err -} - -func (p *StoreTopKeyValueAnnotationsArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("StoreTopKeyValueAnnotationsArgs(%+v)", *p) -} - -type StoreTopKeyValueAnnotationsResult struct { - E *StoreAggregatesException `thrift:"e,1" json:"e"` -} - -func NewStoreTopKeyValueAnnotationsResult() *StoreTopKeyValueAnnotationsResult { - return &StoreTopKeyValueAnnotationsResult{} -} - -var StoreTopKeyValueAnnotationsResult_E_DEFAULT *StoreAggregatesException - -func (p *StoreTopKeyValueAnnotationsResult) GetE() *StoreAggregatesException { - if !p.IsSetE() { - return StoreTopKeyValueAnnotationsResult_E_DEFAULT - } - return p.E -} -func (p *StoreTopKeyValueAnnotationsResult) IsSetE() bool { - return p.E != nil -} - -func (p *StoreTopKeyValueAnnotationsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *StoreTopKeyValueAnnotationsResult) ReadField1(iprot thrift.TProtocol) error { - p.E = &StoreAggregatesException{} - if err := p.E.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.E, err) - } - return nil -} - -func (p *StoreTopKeyValueAnnotationsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("storeTopKeyValueAnnotations_result"); 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *StoreTopKeyValueAnnotationsResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetE() { - if err := oprot.WriteFieldBegin("e", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:e: %s", p, err) - } - if err := p.E.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.E, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:e: %s", p, err) - } - } - return err -} - -func (p *StoreTopKeyValueAnnotationsResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("StoreTopKeyValueAnnotationsResult(%+v)", *p) -} - -type StoreDependenciesArgs struct { - Dependencies *zipkindependencies.Dependencies `thrift:"dependencies,1" json:"dependencies"` -} - -func NewStoreDependenciesArgs() *StoreDependenciesArgs { - return &StoreDependenciesArgs{} -} - -var StoreDependenciesArgs_Dependencies_DEFAULT *zipkindependencies.Dependencies - -func (p *StoreDependenciesArgs) GetDependencies() *zipkindependencies.Dependencies { - if !p.IsSetDependencies() { - return StoreDependenciesArgs_Dependencies_DEFAULT - } - return p.Dependencies -} -func (p *StoreDependenciesArgs) IsSetDependencies() bool { - return p.Dependencies != nil -} - -func (p *StoreDependenciesArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *StoreDependenciesArgs) ReadField1(iprot thrift.TProtocol) error { - p.Dependencies = &zipkindependencies.Dependencies{} - if err := p.Dependencies.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Dependencies, err) - } - return nil -} - -func (p *StoreDependenciesArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("storeDependencies_args"); 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *StoreDependenciesArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("dependencies", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:dependencies: %s", p, err) - } - if err := p.Dependencies.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Dependencies, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:dependencies: %s", p, err) - } - return err -} - -func (p *StoreDependenciesArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("StoreDependenciesArgs(%+v)", *p) -} - -type StoreDependenciesResult struct { - E *StoreAggregatesException `thrift:"e,1" json:"e"` -} - -func NewStoreDependenciesResult() *StoreDependenciesResult { - return &StoreDependenciesResult{} -} - -var StoreDependenciesResult_E_DEFAULT *StoreAggregatesException - -func (p *StoreDependenciesResult) GetE() *StoreAggregatesException { - if !p.IsSetE() { - return StoreDependenciesResult_E_DEFAULT - } - return p.E -} -func (p *StoreDependenciesResult) IsSetE() bool { - return p.E != nil -} - -func (p *StoreDependenciesResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *StoreDependenciesResult) ReadField1(iprot thrift.TProtocol) error { - p.E = &StoreAggregatesException{} - if err := p.E.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.E, err) - } - return nil -} - -func (p *StoreDependenciesResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("storeDependencies_result"); 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *StoreDependenciesResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetE() { - if err := oprot.WriteFieldBegin("e", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:e: %s", p, err) - } - if err := p.E.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.E, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:e: %s", p, err) - } - } - return err -} - -func (p *StoreDependenciesResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("StoreDependenciesResult(%+v)", *p) -} diff --git a/tracing/zipkin/_thrift/gen-go/zipkincore/constants.go b/tracing/zipkin/_thrift/gen-go/zipkincore/constants.go deleted file mode 100644 index 5808fdf45..000000000 --- a/tracing/zipkin/_thrift/gen-go/zipkincore/constants.go +++ /dev/null @@ -1,23 +0,0 @@ -// Autogenerated by Thrift Compiler (0.9.2) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -package zipkincore - -import ( - "bytes" - "fmt" - "github.com/apache/thrift/lib/go/thrift" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = bytes.Equal - -const CLIENT_SEND = "cs" -const CLIENT_RECV = "cr" -const SERVER_SEND = "ss" -const SERVER_RECV = "sr" - -func init() { -} diff --git a/tracing/zipkin/_thrift/gen-go/zipkincore/ttypes.go b/tracing/zipkin/_thrift/gen-go/zipkincore/ttypes.go deleted file mode 100644 index 365ed8ba0..000000000 --- a/tracing/zipkin/_thrift/gen-go/zipkincore/ttypes.go +++ /dev/null @@ -1,990 +0,0 @@ -// Autogenerated by Thrift Compiler (0.9.2) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -package zipkincore - -import ( - "bytes" - "fmt" - "github.com/apache/thrift/lib/go/thrift" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = bytes.Equal - -var GoUnusedProtection__ int - -type AnnotationType int64 - -const ( - AnnotationType_BOOL AnnotationType = 0 - AnnotationType_BYTES AnnotationType = 1 - AnnotationType_I16 AnnotationType = 2 - AnnotationType_I32 AnnotationType = 3 - AnnotationType_I64 AnnotationType = 4 - AnnotationType_DOUBLE AnnotationType = 5 - AnnotationType_STRING AnnotationType = 6 -) - -func (p AnnotationType) String() string { - switch p { - case AnnotationType_BOOL: - return "AnnotationType_BOOL" - case AnnotationType_BYTES: - return "AnnotationType_BYTES" - case AnnotationType_I16: - return "AnnotationType_I16" - case AnnotationType_I32: - return "AnnotationType_I32" - case AnnotationType_I64: - return "AnnotationType_I64" - case AnnotationType_DOUBLE: - return "AnnotationType_DOUBLE" - case AnnotationType_STRING: - return "AnnotationType_STRING" - } - return "" -} - -func AnnotationTypeFromString(s string) (AnnotationType, error) { - switch s { - case "AnnotationType_BOOL": - return AnnotationType_BOOL, nil - case "AnnotationType_BYTES": - return AnnotationType_BYTES, nil - case "AnnotationType_I16": - return AnnotationType_I16, nil - case "AnnotationType_I32": - return AnnotationType_I32, nil - case "AnnotationType_I64": - return AnnotationType_I64, nil - case "AnnotationType_DOUBLE": - return AnnotationType_DOUBLE, nil - case "AnnotationType_STRING": - return AnnotationType_STRING, nil - } - return AnnotationType(0), fmt.Errorf("not a valid AnnotationType string") -} - -func AnnotationTypePtr(v AnnotationType) *AnnotationType { return &v } - -type Endpoint struct { - Ipv4 int32 `thrift:"ipv4,1" json:"ipv4"` - Port int16 `thrift:"port,2" json:"port"` - ServiceName string `thrift:"service_name,3" json:"service_name"` -} - -func NewEndpoint() *Endpoint { - return &Endpoint{} -} - -func (p *Endpoint) GetIpv4() int32 { - return p.Ipv4 -} - -func (p *Endpoint) GetPort() int16 { - return p.Port -} - -func (p *Endpoint) GetServiceName() string { - return p.ServiceName -} -func (p *Endpoint) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *Endpoint) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.Ipv4 = v - } - return nil -} - -func (p *Endpoint) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI16(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.Port = v - } - return nil -} - -func (p *Endpoint) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 3: %s", err) - } else { - p.ServiceName = v - } - return nil -} - -func (p *Endpoint) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Endpoint"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - 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 := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *Endpoint) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("ipv4", thrift.I32, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:ipv4: %s", p, err) - } - if err := oprot.WriteI32(int32(p.Ipv4)); err != nil { - return fmt.Errorf("%T.ipv4 (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:ipv4: %s", p, err) - } - return err -} - -func (p *Endpoint) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("port", thrift.I16, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:port: %s", p, err) - } - if err := oprot.WriteI16(int16(p.Port)); err != nil { - return fmt.Errorf("%T.port (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:port: %s", p, err) - } - return err -} - -func (p *Endpoint) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:service_name: %s", p, err) - } - if err := oprot.WriteString(string(p.ServiceName)); err != nil { - return fmt.Errorf("%T.service_name (3) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:service_name: %s", p, err) - } - return err -} - -func (p *Endpoint) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("Endpoint(%+v)", *p) -} - -type Annotation struct { - Timestamp int64 `thrift:"timestamp,1" json:"timestamp"` - Value string `thrift:"value,2" json:"value"` - Host *Endpoint `thrift:"host,3" json:"host"` - Duration *int32 `thrift:"duration,4" json:"duration"` -} - -func NewAnnotation() *Annotation { - return &Annotation{} -} - -func (p *Annotation) GetTimestamp() int64 { - return p.Timestamp -} - -func (p *Annotation) GetValue() string { - return p.Value -} - -var Annotation_Host_DEFAULT *Endpoint - -func (p *Annotation) GetHost() *Endpoint { - if !p.IsSetHost() { - return Annotation_Host_DEFAULT - } - return p.Host -} - -var Annotation_Duration_DEFAULT int32 - -func (p *Annotation) GetDuration() int32 { - if !p.IsSetDuration() { - return Annotation_Duration_DEFAULT - } - return *p.Duration -} -func (p *Annotation) IsSetHost() bool { - return p.Host != nil -} - -func (p *Annotation) IsSetDuration() bool { - return p.Duration != nil -} - -func (p *Annotation) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } - case 4: - if err := p.ReadField4(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *Annotation) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.Timestamp = v - } - return nil -} - -func (p *Annotation) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.Value = v - } - return nil -} - -func (p *Annotation) ReadField3(iprot thrift.TProtocol) error { - p.Host = &Endpoint{} - if err := p.Host.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Host, err) - } - return nil -} - -func (p *Annotation) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 4: %s", err) - } else { - p.Duration = &v - } - return nil -} - -func (p *Annotation) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Annotation"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - 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 := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *Annotation) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timestamp", thrift.I64, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:timestamp: %s", p, err) - } - if err := oprot.WriteI64(int64(p.Timestamp)); err != nil { - return fmt.Errorf("%T.timestamp (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:timestamp: %s", p, err) - } - return err -} - -func (p *Annotation) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("value", thrift.STRING, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:value: %s", p, err) - } - if err := oprot.WriteString(string(p.Value)); err != nil { - return fmt.Errorf("%T.value (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:value: %s", p, err) - } - return err -} - -func (p *Annotation) writeField3(oprot thrift.TProtocol) (err error) { - if p.IsSetHost() { - if err := oprot.WriteFieldBegin("host", thrift.STRUCT, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:host: %s", p, err) - } - if err := p.Host.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Host, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:host: %s", p, err) - } - } - return err -} - -func (p *Annotation) writeField4(oprot thrift.TProtocol) (err error) { - if p.IsSetDuration() { - if err := oprot.WriteFieldBegin("duration", thrift.I32, 4); err != nil { - return fmt.Errorf("%T write field begin error 4:duration: %s", p, err) - } - if err := oprot.WriteI32(int32(*p.Duration)); err != nil { - return fmt.Errorf("%T.duration (4) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 4:duration: %s", p, err) - } - } - return err -} - -func (p *Annotation) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("Annotation(%+v)", *p) -} - -type BinaryAnnotation struct { - Key string `thrift:"key,1" json:"key"` - Value []byte `thrift:"value,2" json:"value"` - AnnotationType AnnotationType `thrift:"annotation_type,3" json:"annotation_type"` - Host *Endpoint `thrift:"host,4" json:"host"` -} - -func NewBinaryAnnotation() *BinaryAnnotation { - return &BinaryAnnotation{} -} - -func (p *BinaryAnnotation) GetKey() string { - return p.Key -} - -func (p *BinaryAnnotation) GetValue() []byte { - return p.Value -} - -func (p *BinaryAnnotation) GetAnnotationType() AnnotationType { - return p.AnnotationType -} - -var BinaryAnnotation_Host_DEFAULT *Endpoint - -func (p *BinaryAnnotation) GetHost() *Endpoint { - if !p.IsSetHost() { - return BinaryAnnotation_Host_DEFAULT - } - return p.Host -} -func (p *BinaryAnnotation) IsSetHost() bool { - return p.Host != nil -} - -func (p *BinaryAnnotation) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } - case 4: - if err := p.ReadField4(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *BinaryAnnotation) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.Key = v - } - return nil -} - -func (p *BinaryAnnotation) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBinary(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.Value = v - } - return nil -} - -func (p *BinaryAnnotation) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 3: %s", err) - } else { - temp := AnnotationType(v) - p.AnnotationType = temp - } - return nil -} - -func (p *BinaryAnnotation) ReadField4(iprot thrift.TProtocol) error { - p.Host = &Endpoint{} - if err := p.Host.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Host, err) - } - return nil -} - -func (p *BinaryAnnotation) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("BinaryAnnotation"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - 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 := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *BinaryAnnotation) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("key", thrift.STRING, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:key: %s", p, err) - } - if err := oprot.WriteString(string(p.Key)); err != nil { - return fmt.Errorf("%T.key (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:key: %s", p, err) - } - return err -} - -func (p *BinaryAnnotation) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("value", thrift.STRING, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:value: %s", p, err) - } - if err := oprot.WriteBinary(p.Value); err != nil { - return fmt.Errorf("%T.value (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:value: %s", p, err) - } - return err -} - -func (p *BinaryAnnotation) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("annotation_type", thrift.I32, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:annotation_type: %s", p, err) - } - if err := oprot.WriteI32(int32(p.AnnotationType)); err != nil { - return fmt.Errorf("%T.annotation_type (3) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:annotation_type: %s", p, err) - } - return err -} - -func (p *BinaryAnnotation) writeField4(oprot thrift.TProtocol) (err error) { - if p.IsSetHost() { - if err := oprot.WriteFieldBegin("host", thrift.STRUCT, 4); err != nil { - return fmt.Errorf("%T write field begin error 4:host: %s", p, err) - } - if err := p.Host.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Host, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 4:host: %s", p, err) - } - } - return err -} - -func (p *BinaryAnnotation) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("BinaryAnnotation(%+v)", *p) -} - -type Span struct { - TraceId int64 `thrift:"trace_id,1" json:"trace_id"` - // unused field # 2 - Name string `thrift:"name,3" json:"name"` - Id int64 `thrift:"id,4" json:"id"` - ParentId *int64 `thrift:"parent_id,5" json:"parent_id"` - Annotations []*Annotation `thrift:"annotations,6" json:"annotations"` - // unused field # 7 - BinaryAnnotations []*BinaryAnnotation `thrift:"binary_annotations,8" json:"binary_annotations"` - Debug bool `thrift:"debug,9" json:"debug"` -} - -func NewSpan() *Span { - return &Span{} -} - -func (p *Span) GetTraceId() int64 { - return p.TraceId -} - -func (p *Span) GetName() string { - return p.Name -} - -func (p *Span) GetId() int64 { - return p.Id -} - -var Span_ParentId_DEFAULT int64 - -func (p *Span) GetParentId() int64 { - if !p.IsSetParentId() { - return Span_ParentId_DEFAULT - } - return *p.ParentId -} - -func (p *Span) GetAnnotations() []*Annotation { - return p.Annotations -} - -func (p *Span) GetBinaryAnnotations() []*BinaryAnnotation { - return p.BinaryAnnotations -} - -var Span_Debug_DEFAULT bool = false - -func (p *Span) GetDebug() bool { - return p.Debug -} -func (p *Span) IsSetParentId() bool { - return p.ParentId != nil -} - -func (p *Span) IsSetDebug() bool { - return p.Debug != Span_Debug_DEFAULT -} - -func (p *Span) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } - case 4: - if err := p.ReadField4(iprot); err != nil { - return err - } - case 5: - if err := p.ReadField5(iprot); err != nil { - return err - } - case 6: - if err := p.ReadField6(iprot); err != nil { - return err - } - case 8: - if err := p.ReadField8(iprot); err != nil { - return err - } - case 9: - if err := p.ReadField9(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *Span) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.TraceId = v - } - return nil -} - -func (p *Span) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 3: %s", err) - } else { - p.Name = v - } - return nil -} - -func (p *Span) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 4: %s", err) - } else { - p.Id = v - } - return nil -} - -func (p *Span) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 5: %s", err) - } else { - p.ParentId = &v - } - return nil -} - -func (p *Span) ReadField6(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]*Annotation, 0, size) - p.Annotations = tSlice - for i := 0; i < size; i++ { - _elem0 := &Annotation{} - if err := _elem0.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem0, err) - } - p.Annotations = append(p.Annotations, _elem0) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *Span) ReadField8(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]*BinaryAnnotation, 0, size) - p.BinaryAnnotations = tSlice - for i := 0; i < size; i++ { - _elem1 := &BinaryAnnotation{} - if err := _elem1.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem1, err) - } - p.BinaryAnnotations = append(p.BinaryAnnotations, _elem1) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *Span) ReadField9(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(); err != nil { - return fmt.Errorf("error reading field 9: %s", err) - } else { - p.Debug = v - } - return nil -} - -func (p *Span) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Span"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - 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 := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *Span) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("trace_id", thrift.I64, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:trace_id: %s", p, err) - } - if err := oprot.WriteI64(int64(p.TraceId)); err != nil { - return fmt.Errorf("%T.trace_id (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:trace_id: %s", p, err) - } - return err -} - -func (p *Span) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:name: %s", p, err) - } - if err := oprot.WriteString(string(p.Name)); err != nil { - return fmt.Errorf("%T.name (3) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:name: %s", p, err) - } - return err -} - -func (p *Span) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("id", thrift.I64, 4); err != nil { - return fmt.Errorf("%T write field begin error 4:id: %s", p, err) - } - if err := oprot.WriteI64(int64(p.Id)); err != nil { - return fmt.Errorf("%T.id (4) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 4:id: %s", p, err) - } - return err -} - -func (p *Span) writeField5(oprot thrift.TProtocol) (err error) { - if p.IsSetParentId() { - if err := oprot.WriteFieldBegin("parent_id", thrift.I64, 5); err != nil { - return fmt.Errorf("%T write field begin error 5:parent_id: %s", p, err) - } - if err := oprot.WriteI64(int64(*p.ParentId)); err != nil { - return fmt.Errorf("%T.parent_id (5) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 5:parent_id: %s", p, err) - } - } - return err -} - -func (p *Span) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("annotations", thrift.LIST, 6); err != nil { - return fmt.Errorf("%T write field begin error 6:annotations: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Annotations)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Annotations { - if err := v.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", v, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 6:annotations: %s", p, err) - } - return err -} - -func (p *Span) writeField8(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("binary_annotations", thrift.LIST, 8); err != nil { - return fmt.Errorf("%T write field begin error 8:binary_annotations: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.BinaryAnnotations)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.BinaryAnnotations { - if err := v.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", v, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 8:binary_annotations: %s", p, err) - } - return err -} - -func (p *Span) writeField9(oprot thrift.TProtocol) (err error) { - if p.IsSetDebug() { - if err := oprot.WriteFieldBegin("debug", thrift.BOOL, 9); err != nil { - return fmt.Errorf("%T write field begin error 9:debug: %s", p, err) - } - if err := oprot.WriteBool(bool(p.Debug)); err != nil { - return fmt.Errorf("%T.debug (9) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 9:debug: %s", p, err) - } - } - return err -} - -func (p *Span) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("Span(%+v)", *p) -} diff --git a/tracing/zipkin/_thrift/gen-go/zipkindependencies/constants.go b/tracing/zipkin/_thrift/gen-go/zipkindependencies/constants.go deleted file mode 100644 index 16d060abb..000000000 --- a/tracing/zipkin/_thrift/gen-go/zipkindependencies/constants.go +++ /dev/null @@ -1,18 +0,0 @@ -// Autogenerated by Thrift Compiler (0.9.2) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -package zipkindependencies - -import ( - "bytes" - "fmt" - "github.com/apache/thrift/lib/go/thrift" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = bytes.Equal - -func init() { -} diff --git a/tracing/zipkin/_thrift/gen-go/zipkindependencies/ttypes.go b/tracing/zipkin/_thrift/gen-go/zipkindependencies/ttypes.go deleted file mode 100644 index b4de42e51..000000000 --- a/tracing/zipkin/_thrift/gen-go/zipkindependencies/ttypes.go +++ /dev/null @@ -1,580 +0,0 @@ -// Autogenerated by Thrift Compiler (0.9.2) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -package zipkindependencies - -import ( - "bytes" - "fmt" - "github.com/apache/thrift/lib/go/thrift" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = bytes.Equal - -var GoUnusedProtection__ int - -type Moments struct { - M0 int64 `thrift:"m0,1" json:"m0"` - M1 float64 `thrift:"m1,2" json:"m1"` - M2 float64 `thrift:"m2,3" json:"m2"` - M3 float64 `thrift:"m3,4" json:"m3"` - M4 float64 `thrift:"m4,5" json:"m4"` -} - -func NewMoments() *Moments { - return &Moments{} -} - -func (p *Moments) GetM0() int64 { - return p.M0 -} - -func (p *Moments) GetM1() float64 { - return p.M1 -} - -func (p *Moments) GetM2() float64 { - return p.M2 -} - -func (p *Moments) GetM3() float64 { - return p.M3 -} - -func (p *Moments) GetM4() float64 { - return p.M4 -} -func (p *Moments) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } - case 4: - if err := p.ReadField4(iprot); err != nil { - return err - } - case 5: - if err := p.ReadField5(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *Moments) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.M0 = v - } - return nil -} - -func (p *Moments) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.M1 = v - } - return nil -} - -func (p *Moments) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(); err != nil { - return fmt.Errorf("error reading field 3: %s", err) - } else { - p.M2 = v - } - return nil -} - -func (p *Moments) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(); err != nil { - return fmt.Errorf("error reading field 4: %s", err) - } else { - p.M3 = v - } - return nil -} - -func (p *Moments) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(); err != nil { - return fmt.Errorf("error reading field 5: %s", err) - } else { - p.M4 = v - } - return nil -} - -func (p *Moments) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Moments"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - 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 := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *Moments) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("m0", thrift.I64, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:m0: %s", p, err) - } - if err := oprot.WriteI64(int64(p.M0)); err != nil { - return fmt.Errorf("%T.m0 (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:m0: %s", p, err) - } - return err -} - -func (p *Moments) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("m1", thrift.DOUBLE, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:m1: %s", p, err) - } - if err := oprot.WriteDouble(float64(p.M1)); err != nil { - return fmt.Errorf("%T.m1 (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:m1: %s", p, err) - } - return err -} - -func (p *Moments) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("m2", thrift.DOUBLE, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:m2: %s", p, err) - } - if err := oprot.WriteDouble(float64(p.M2)); err != nil { - return fmt.Errorf("%T.m2 (3) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:m2: %s", p, err) - } - return err -} - -func (p *Moments) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("m3", thrift.DOUBLE, 4); err != nil { - return fmt.Errorf("%T write field begin error 4:m3: %s", p, err) - } - if err := oprot.WriteDouble(float64(p.M3)); err != nil { - return fmt.Errorf("%T.m3 (4) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 4:m3: %s", p, err) - } - return err -} - -func (p *Moments) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("m4", thrift.DOUBLE, 5); err != nil { - return fmt.Errorf("%T write field begin error 5:m4: %s", p, err) - } - if err := oprot.WriteDouble(float64(p.M4)); err != nil { - return fmt.Errorf("%T.m4 (5) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 5:m4: %s", p, err) - } - return err -} - -func (p *Moments) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("Moments(%+v)", *p) -} - -type DependencyLink struct { - Parent string `thrift:"parent,1" json:"parent"` - Child string `thrift:"child,2" json:"child"` - DurationMoments *Moments `thrift:"duration_moments,3" json:"duration_moments"` -} - -func NewDependencyLink() *DependencyLink { - return &DependencyLink{} -} - -func (p *DependencyLink) GetParent() string { - return p.Parent -} - -func (p *DependencyLink) GetChild() string { - return p.Child -} - -var DependencyLink_DurationMoments_DEFAULT *Moments - -func (p *DependencyLink) GetDurationMoments() *Moments { - if !p.IsSetDurationMoments() { - return DependencyLink_DurationMoments_DEFAULT - } - return p.DurationMoments -} -func (p *DependencyLink) IsSetDurationMoments() bool { - return p.DurationMoments != nil -} - -func (p *DependencyLink) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *DependencyLink) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.Parent = v - } - return nil -} - -func (p *DependencyLink) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.Child = v - } - return nil -} - -func (p *DependencyLink) ReadField3(iprot thrift.TProtocol) error { - p.DurationMoments = &Moments{} - if err := p.DurationMoments.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.DurationMoments, err) - } - return nil -} - -func (p *DependencyLink) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("DependencyLink"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - 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 := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *DependencyLink) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("parent", thrift.STRING, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:parent: %s", p, err) - } - if err := oprot.WriteString(string(p.Parent)); err != nil { - return fmt.Errorf("%T.parent (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:parent: %s", p, err) - } - return err -} - -func (p *DependencyLink) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("child", thrift.STRING, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:child: %s", p, err) - } - if err := oprot.WriteString(string(p.Child)); err != nil { - return fmt.Errorf("%T.child (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:child: %s", p, err) - } - return err -} - -func (p *DependencyLink) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("duration_moments", thrift.STRUCT, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:duration_moments: %s", p, err) - } - if err := p.DurationMoments.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.DurationMoments, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:duration_moments: %s", p, err) - } - return err -} - -func (p *DependencyLink) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("DependencyLink(%+v)", *p) -} - -type Dependencies struct { - StartTime int64 `thrift:"start_time,1" json:"start_time"` - EndTime int64 `thrift:"end_time,2" json:"end_time"` - Links []*DependencyLink `thrift:"links,3" json:"links"` -} - -func NewDependencies() *Dependencies { - return &Dependencies{} -} - -func (p *Dependencies) GetStartTime() int64 { - return p.StartTime -} - -func (p *Dependencies) GetEndTime() int64 { - return p.EndTime -} - -func (p *Dependencies) GetLinks() []*DependencyLink { - return p.Links -} -func (p *Dependencies) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *Dependencies) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.StartTime = v - } - return nil -} - -func (p *Dependencies) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.EndTime = v - } - return nil -} - -func (p *Dependencies) ReadField3(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]*DependencyLink, 0, size) - p.Links = tSlice - for i := 0; i < size; i++ { - _elem0 := &DependencyLink{} - if err := _elem0.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem0, err) - } - p.Links = append(p.Links, _elem0) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *Dependencies) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Dependencies"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - 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 := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *Dependencies) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("start_time", thrift.I64, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:start_time: %s", p, err) - } - if err := oprot.WriteI64(int64(p.StartTime)); err != nil { - return fmt.Errorf("%T.start_time (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:start_time: %s", p, err) - } - return err -} - -func (p *Dependencies) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("end_time", thrift.I64, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:end_time: %s", p, err) - } - if err := oprot.WriteI64(int64(p.EndTime)); err != nil { - return fmt.Errorf("%T.end_time (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:end_time: %s", p, err) - } - return err -} - -func (p *Dependencies) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("links", thrift.LIST, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:links: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Links)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Links { - if err := v.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", v, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:links: %s", p, err) - } - return err -} - -func (p *Dependencies) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("Dependencies(%+v)", *p) -} diff --git a/tracing/zipkin/_thrift/gen-go/zipkinquery/constants.go b/tracing/zipkin/_thrift/gen-go/zipkinquery/constants.go deleted file mode 100644 index 5c176e66f..000000000 --- a/tracing/zipkin/_thrift/gen-go/zipkinquery/constants.go +++ /dev/null @@ -1,23 +0,0 @@ -// Autogenerated by Thrift Compiler (0.9.2) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -package zipkinquery - -import ( - "bytes" - "fmt" - "github.com/apache/thrift/lib/go/thrift" - "zipkincore" - "zipkindependencies" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = bytes.Equal - -var _ = zipkincore.GoUnusedProtection__ -var _ = zipkindependencies.GoUnusedProtection__ - -func init() { -} diff --git a/tracing/zipkin/_thrift/gen-go/zipkinquery/ttypes.go b/tracing/zipkin/_thrift/gen-go/zipkinquery/ttypes.go deleted file mode 100644 index 1fedbd6e7..000000000 --- a/tracing/zipkin/_thrift/gen-go/zipkinquery/ttypes.go +++ /dev/null @@ -1,2085 +0,0 @@ -// Autogenerated by Thrift Compiler (0.9.2) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -package zipkinquery - -import ( - "bytes" - "fmt" - "github.com/apache/thrift/lib/go/thrift" - "zipkincore" - "zipkindependencies" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = bytes.Equal - -var _ = zipkincore.GoUnusedProtection__ -var _ = zipkindependencies.GoUnusedProtection__ -var GoUnusedProtection__ int - -type Order int64 - -const ( - Order_TIMESTAMP_DESC Order = 0 - Order_TIMESTAMP_ASC Order = 1 - Order_DURATION_ASC Order = 2 - Order_DURATION_DESC Order = 3 - Order_NONE Order = 4 -) - -func (p Order) String() string { - switch p { - case Order_TIMESTAMP_DESC: - return "Order_TIMESTAMP_DESC" - case Order_TIMESTAMP_ASC: - return "Order_TIMESTAMP_ASC" - case Order_DURATION_ASC: - return "Order_DURATION_ASC" - case Order_DURATION_DESC: - return "Order_DURATION_DESC" - case Order_NONE: - return "Order_NONE" - } - return "" -} - -func OrderFromString(s string) (Order, error) { - switch s { - case "Order_TIMESTAMP_DESC": - return Order_TIMESTAMP_DESC, nil - case "Order_TIMESTAMP_ASC": - return Order_TIMESTAMP_ASC, nil - case "Order_DURATION_ASC": - return Order_DURATION_ASC, nil - case "Order_DURATION_DESC": - return Order_DURATION_DESC, nil - case "Order_NONE": - return Order_NONE, nil - } - return Order(0), fmt.Errorf("not a valid Order string") -} - -func OrderPtr(v Order) *Order { return &v } - -//The raw data in our storage might have various problems. How should we adjust it before -//returning it to the user? -// -//Time skew adjuster tries to make sure that even though servers might have slightly -//different clocks the annotations in the returned data are adjusted so that they are -//in the correct order. -type Adjust int64 - -const ( - Adjust_NOTHING Adjust = 0 - Adjust_TIME_SKEW Adjust = 1 -) - -func (p Adjust) String() string { - switch p { - case Adjust_NOTHING: - return "Adjust_NOTHING" - case Adjust_TIME_SKEW: - return "Adjust_TIME_SKEW" - } - return "" -} - -func AdjustFromString(s string) (Adjust, error) { - switch s { - case "Adjust_NOTHING": - return Adjust_NOTHING, nil - case "Adjust_TIME_SKEW": - return Adjust_TIME_SKEW, nil - } - return Adjust(0), fmt.Errorf("not a valid Adjust string") -} - -func AdjustPtr(v Adjust) *Adjust { return &v } - -type Trace struct { - Spans []*zipkincore.Span `thrift:"spans,1" json:"spans"` -} - -func NewTrace() *Trace { - return &Trace{} -} - -func (p *Trace) GetSpans() []*zipkincore.Span { - return p.Spans -} -func (p *Trace) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *Trace) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]*zipkincore.Span, 0, size) - p.Spans = tSlice - for i := 0; i < size; i++ { - _elem0 := &zipkincore.Span{} - if err := _elem0.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem0, err) - } - p.Spans = append(p.Spans, _elem0) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *Trace) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("Trace"); 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *Trace) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("spans", thrift.LIST, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:spans: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Spans)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Spans { - if err := v.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", v, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:spans: %s", p, err) - } - return err -} - -func (p *Trace) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("Trace(%+v)", *p) -} - -type QueryException struct { - Msg string `thrift:"msg,1" json:"msg"` -} - -func NewQueryException() *QueryException { - return &QueryException{} -} - -func (p *QueryException) GetMsg() string { - return p.Msg -} -func (p *QueryException) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *QueryException) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.Msg = v - } - return nil -} - -func (p *QueryException) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("QueryException"); 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *QueryException) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("msg", thrift.STRING, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:msg: %s", p, err) - } - if err := oprot.WriteString(string(p.Msg)); err != nil { - return fmt.Errorf("%T.msg (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:msg: %s", p, err) - } - return err -} - -func (p *QueryException) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("QueryException(%+v)", *p) -} - -func (p *QueryException) Error() string { - return p.String() -} - -type SpanTimestamp struct { - Name string `thrift:"name,1" json:"name"` - StartTimestamp int64 `thrift:"start_timestamp,2" json:"start_timestamp"` - EndTimestamp int64 `thrift:"end_timestamp,3" json:"end_timestamp"` -} - -func NewSpanTimestamp() *SpanTimestamp { - return &SpanTimestamp{} -} - -func (p *SpanTimestamp) GetName() string { - return p.Name -} - -func (p *SpanTimestamp) GetStartTimestamp() int64 { - return p.StartTimestamp -} - -func (p *SpanTimestamp) GetEndTimestamp() int64 { - return p.EndTimestamp -} -func (p *SpanTimestamp) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *SpanTimestamp) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.Name = v - } - return nil -} - -func (p *SpanTimestamp) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.StartTimestamp = v - } - return nil -} - -func (p *SpanTimestamp) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 3: %s", err) - } else { - p.EndTimestamp = v - } - return nil -} - -func (p *SpanTimestamp) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("SpanTimestamp"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - 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 := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *SpanTimestamp) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:name: %s", p, err) - } - if err := oprot.WriteString(string(p.Name)); err != nil { - return fmt.Errorf("%T.name (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:name: %s", p, err) - } - return err -} - -func (p *SpanTimestamp) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("start_timestamp", thrift.I64, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:start_timestamp: %s", p, err) - } - if err := oprot.WriteI64(int64(p.StartTimestamp)); err != nil { - return fmt.Errorf("%T.start_timestamp (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:start_timestamp: %s", p, err) - } - return err -} - -func (p *SpanTimestamp) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("end_timestamp", thrift.I64, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:end_timestamp: %s", p, err) - } - if err := oprot.WriteI64(int64(p.EndTimestamp)); err != nil { - return fmt.Errorf("%T.end_timestamp (3) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:end_timestamp: %s", p, err) - } - return err -} - -func (p *SpanTimestamp) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("SpanTimestamp(%+v)", *p) -} - -type TraceSummary struct { - TraceId int64 `thrift:"trace_id,1" json:"trace_id"` - StartTimestamp int64 `thrift:"start_timestamp,2" json:"start_timestamp"` - EndTimestamp int64 `thrift:"end_timestamp,3" json:"end_timestamp"` - DurationMicro int32 `thrift:"duration_micro,4" json:"duration_micro"` - // unused field # 5 - Endpoints []*zipkincore.Endpoint `thrift:"endpoints,6" json:"endpoints"` - SpanTimestamps []*SpanTimestamp `thrift:"span_timestamps,7" json:"span_timestamps"` -} - -func NewTraceSummary() *TraceSummary { - return &TraceSummary{} -} - -func (p *TraceSummary) GetTraceId() int64 { - return p.TraceId -} - -func (p *TraceSummary) GetStartTimestamp() int64 { - return p.StartTimestamp -} - -func (p *TraceSummary) GetEndTimestamp() int64 { - return p.EndTimestamp -} - -func (p *TraceSummary) GetDurationMicro() int32 { - return p.DurationMicro -} - -func (p *TraceSummary) GetEndpoints() []*zipkincore.Endpoint { - return p.Endpoints -} - -func (p *TraceSummary) GetSpanTimestamps() []*SpanTimestamp { - return p.SpanTimestamps -} -func (p *TraceSummary) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } - case 4: - if err := p.ReadField4(iprot); err != nil { - return err - } - case 6: - if err := p.ReadField6(iprot); err != nil { - return err - } - case 7: - if err := p.ReadField7(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *TraceSummary) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.TraceId = v - } - return nil -} - -func (p *TraceSummary) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.StartTimestamp = v - } - return nil -} - -func (p *TraceSummary) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 3: %s", err) - } else { - p.EndTimestamp = v - } - return nil -} - -func (p *TraceSummary) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 4: %s", err) - } else { - p.DurationMicro = v - } - return nil -} - -func (p *TraceSummary) ReadField6(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]*zipkincore.Endpoint, 0, size) - p.Endpoints = tSlice - for i := 0; i < size; i++ { - _elem1 := &zipkincore.Endpoint{} - if err := _elem1.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem1, err) - } - p.Endpoints = append(p.Endpoints, _elem1) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *TraceSummary) ReadField7(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]*SpanTimestamp, 0, size) - p.SpanTimestamps = tSlice - for i := 0; i < size; i++ { - _elem2 := &SpanTimestamp{} - if err := _elem2.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem2, err) - } - p.SpanTimestamps = append(p.SpanTimestamps, _elem2) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *TraceSummary) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("TraceSummary"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - 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.writeField6(oprot); err != nil { - return err - } - if err := p.writeField7(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *TraceSummary) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("trace_id", thrift.I64, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:trace_id: %s", p, err) - } - if err := oprot.WriteI64(int64(p.TraceId)); err != nil { - return fmt.Errorf("%T.trace_id (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:trace_id: %s", p, err) - } - return err -} - -func (p *TraceSummary) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("start_timestamp", thrift.I64, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:start_timestamp: %s", p, err) - } - if err := oprot.WriteI64(int64(p.StartTimestamp)); err != nil { - return fmt.Errorf("%T.start_timestamp (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:start_timestamp: %s", p, err) - } - return err -} - -func (p *TraceSummary) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("end_timestamp", thrift.I64, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:end_timestamp: %s", p, err) - } - if err := oprot.WriteI64(int64(p.EndTimestamp)); err != nil { - return fmt.Errorf("%T.end_timestamp (3) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:end_timestamp: %s", p, err) - } - return err -} - -func (p *TraceSummary) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("duration_micro", thrift.I32, 4); err != nil { - return fmt.Errorf("%T write field begin error 4:duration_micro: %s", p, err) - } - if err := oprot.WriteI32(int32(p.DurationMicro)); err != nil { - return fmt.Errorf("%T.duration_micro (4) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 4:duration_micro: %s", p, err) - } - return err -} - -func (p *TraceSummary) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("endpoints", thrift.LIST, 6); err != nil { - return fmt.Errorf("%T write field begin error 6:endpoints: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Endpoints)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Endpoints { - if err := v.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", v, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 6:endpoints: %s", p, err) - } - return err -} - -func (p *TraceSummary) writeField7(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("span_timestamps", thrift.LIST, 7); err != nil { - return fmt.Errorf("%T write field begin error 7:span_timestamps: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.SpanTimestamps)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.SpanTimestamps { - if err := v.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", v, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 7:span_timestamps: %s", p, err) - } - return err -} - -func (p *TraceSummary) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("TraceSummary(%+v)", *p) -} - -type TimelineAnnotation struct { - Timestamp int64 `thrift:"timestamp,1" json:"timestamp"` - Value string `thrift:"value,2" json:"value"` - Host *zipkincore.Endpoint `thrift:"host,3" json:"host"` - SpanId int64 `thrift:"span_id,4" json:"span_id"` - ParentId *int64 `thrift:"parent_id,5" json:"parent_id"` - ServiceName string `thrift:"service_name,6" json:"service_name"` - SpanName string `thrift:"span_name,7" json:"span_name"` -} - -func NewTimelineAnnotation() *TimelineAnnotation { - return &TimelineAnnotation{} -} - -func (p *TimelineAnnotation) GetTimestamp() int64 { - return p.Timestamp -} - -func (p *TimelineAnnotation) GetValue() string { - return p.Value -} - -var TimelineAnnotation_Host_DEFAULT *zipkincore.Endpoint - -func (p *TimelineAnnotation) GetHost() *zipkincore.Endpoint { - if !p.IsSetHost() { - return TimelineAnnotation_Host_DEFAULT - } - return p.Host -} - -func (p *TimelineAnnotation) GetSpanId() int64 { - return p.SpanId -} - -var TimelineAnnotation_ParentId_DEFAULT int64 - -func (p *TimelineAnnotation) GetParentId() int64 { - if !p.IsSetParentId() { - return TimelineAnnotation_ParentId_DEFAULT - } - return *p.ParentId -} - -func (p *TimelineAnnotation) GetServiceName() string { - return p.ServiceName -} - -func (p *TimelineAnnotation) GetSpanName() string { - return p.SpanName -} -func (p *TimelineAnnotation) IsSetHost() bool { - return p.Host != nil -} - -func (p *TimelineAnnotation) IsSetParentId() bool { - return p.ParentId != nil -} - -func (p *TimelineAnnotation) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } - case 4: - if err := p.ReadField4(iprot); err != nil { - return err - } - case 5: - if err := p.ReadField5(iprot); err != nil { - return err - } - case 6: - if err := p.ReadField6(iprot); err != nil { - return err - } - case 7: - if err := p.ReadField7(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *TimelineAnnotation) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.Timestamp = v - } - return nil -} - -func (p *TimelineAnnotation) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.Value = v - } - return nil -} - -func (p *TimelineAnnotation) ReadField3(iprot thrift.TProtocol) error { - p.Host = &zipkincore.Endpoint{} - if err := p.Host.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Host, err) - } - return nil -} - -func (p *TimelineAnnotation) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 4: %s", err) - } else { - p.SpanId = v - } - return nil -} - -func (p *TimelineAnnotation) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 5: %s", err) - } else { - p.ParentId = &v - } - return nil -} - -func (p *TimelineAnnotation) ReadField6(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 6: %s", err) - } else { - p.ServiceName = v - } - return nil -} - -func (p *TimelineAnnotation) ReadField7(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 7: %s", err) - } else { - p.SpanName = v - } - return nil -} - -func (p *TimelineAnnotation) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("TimelineAnnotation"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *TimelineAnnotation) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("timestamp", thrift.I64, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:timestamp: %s", p, err) - } - if err := oprot.WriteI64(int64(p.Timestamp)); err != nil { - return fmt.Errorf("%T.timestamp (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:timestamp: %s", p, err) - } - return err -} - -func (p *TimelineAnnotation) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("value", thrift.STRING, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:value: %s", p, err) - } - if err := oprot.WriteString(string(p.Value)); err != nil { - return fmt.Errorf("%T.value (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:value: %s", p, err) - } - return err -} - -func (p *TimelineAnnotation) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("host", thrift.STRUCT, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:host: %s", p, err) - } - if err := p.Host.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Host, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:host: %s", p, err) - } - return err -} - -func (p *TimelineAnnotation) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("span_id", thrift.I64, 4); err != nil { - return fmt.Errorf("%T write field begin error 4:span_id: %s", p, err) - } - if err := oprot.WriteI64(int64(p.SpanId)); err != nil { - return fmt.Errorf("%T.span_id (4) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 4:span_id: %s", p, err) - } - return err -} - -func (p *TimelineAnnotation) writeField5(oprot thrift.TProtocol) (err error) { - if p.IsSetParentId() { - if err := oprot.WriteFieldBegin("parent_id", thrift.I64, 5); err != nil { - return fmt.Errorf("%T write field begin error 5:parent_id: %s", p, err) - } - if err := oprot.WriteI64(int64(*p.ParentId)); err != nil { - return fmt.Errorf("%T.parent_id (5) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 5:parent_id: %s", p, err) - } - } - return err -} - -func (p *TimelineAnnotation) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 6); err != nil { - return fmt.Errorf("%T write field begin error 6:service_name: %s", p, err) - } - if err := oprot.WriteString(string(p.ServiceName)); err != nil { - return fmt.Errorf("%T.service_name (6) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 6:service_name: %s", p, err) - } - return err -} - -func (p *TimelineAnnotation) writeField7(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("span_name", thrift.STRING, 7); err != nil { - return fmt.Errorf("%T write field begin error 7:span_name: %s", p, err) - } - if err := oprot.WriteString(string(p.SpanName)); err != nil { - return fmt.Errorf("%T.span_name (7) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 7:span_name: %s", p, err) - } - return err -} - -func (p *TimelineAnnotation) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("TimelineAnnotation(%+v)", *p) -} - -type TraceTimeline struct { - TraceId int64 `thrift:"trace_id,1" json:"trace_id"` - RootMostSpanId int64 `thrift:"root_most_span_id,2" json:"root_most_span_id"` - // unused fields # 3 to 5 - Annotations []*TimelineAnnotation `thrift:"annotations,6" json:"annotations"` - BinaryAnnotations []*zipkincore.BinaryAnnotation `thrift:"binary_annotations,7" json:"binary_annotations"` -} - -func NewTraceTimeline() *TraceTimeline { - return &TraceTimeline{} -} - -func (p *TraceTimeline) GetTraceId() int64 { - return p.TraceId -} - -func (p *TraceTimeline) GetRootMostSpanId() int64 { - return p.RootMostSpanId -} - -func (p *TraceTimeline) GetAnnotations() []*TimelineAnnotation { - return p.Annotations -} - -func (p *TraceTimeline) GetBinaryAnnotations() []*zipkincore.BinaryAnnotation { - return p.BinaryAnnotations -} -func (p *TraceTimeline) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - case 6: - if err := p.ReadField6(iprot); err != nil { - return err - } - case 7: - if err := p.ReadField7(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *TraceTimeline) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.TraceId = v - } - return nil -} - -func (p *TraceTimeline) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.RootMostSpanId = v - } - return nil -} - -func (p *TraceTimeline) ReadField6(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]*TimelineAnnotation, 0, size) - p.Annotations = tSlice - for i := 0; i < size; i++ { - _elem3 := &TimelineAnnotation{} - if err := _elem3.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem3, err) - } - p.Annotations = append(p.Annotations, _elem3) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *TraceTimeline) ReadField7(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]*zipkincore.BinaryAnnotation, 0, size) - p.BinaryAnnotations = tSlice - for i := 0; i < size; i++ { - _elem4 := &zipkincore.BinaryAnnotation{} - if err := _elem4.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem4, err) - } - p.BinaryAnnotations = append(p.BinaryAnnotations, _elem4) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *TraceTimeline) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("TraceTimeline"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := p.writeField2(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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *TraceTimeline) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("trace_id", thrift.I64, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:trace_id: %s", p, err) - } - if err := oprot.WriteI64(int64(p.TraceId)); err != nil { - return fmt.Errorf("%T.trace_id (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:trace_id: %s", p, err) - } - return err -} - -func (p *TraceTimeline) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("root_most_span_id", thrift.I64, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:root_most_span_id: %s", p, err) - } - if err := oprot.WriteI64(int64(p.RootMostSpanId)); err != nil { - return fmt.Errorf("%T.root_most_span_id (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:root_most_span_id: %s", p, err) - } - return err -} - -func (p *TraceTimeline) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("annotations", thrift.LIST, 6); err != nil { - return fmt.Errorf("%T write field begin error 6:annotations: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Annotations)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Annotations { - if err := v.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", v, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 6:annotations: %s", p, err) - } - return err -} - -func (p *TraceTimeline) writeField7(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("binary_annotations", thrift.LIST, 7); err != nil { - return fmt.Errorf("%T write field begin error 7:binary_annotations: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.BinaryAnnotations)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.BinaryAnnotations { - if err := v.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", v, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 7:binary_annotations: %s", p, err) - } - return err -} - -func (p *TraceTimeline) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("TraceTimeline(%+v)", *p) -} - -type TraceCombo struct { - Trace *Trace `thrift:"trace,1" json:"trace"` - Summary *TraceSummary `thrift:"summary,2" json:"summary"` - Timeline *TraceTimeline `thrift:"timeline,3" json:"timeline"` - SpanDepths map[int64]int32 `thrift:"span_depths,4" json:"span_depths"` -} - -func NewTraceCombo() *TraceCombo { - return &TraceCombo{} -} - -var TraceCombo_Trace_DEFAULT *Trace - -func (p *TraceCombo) GetTrace() *Trace { - if !p.IsSetTrace() { - return TraceCombo_Trace_DEFAULT - } - return p.Trace -} - -var TraceCombo_Summary_DEFAULT *TraceSummary - -func (p *TraceCombo) GetSummary() *TraceSummary { - if !p.IsSetSummary() { - return TraceCombo_Summary_DEFAULT - } - return p.Summary -} - -var TraceCombo_Timeline_DEFAULT *TraceTimeline - -func (p *TraceCombo) GetTimeline() *TraceTimeline { - if !p.IsSetTimeline() { - return TraceCombo_Timeline_DEFAULT - } - return p.Timeline -} - -var TraceCombo_SpanDepths_DEFAULT map[int64]int32 - -func (p *TraceCombo) GetSpanDepths() map[int64]int32 { - return p.SpanDepths -} -func (p *TraceCombo) IsSetTrace() bool { - return p.Trace != nil -} - -func (p *TraceCombo) IsSetSummary() bool { - return p.Summary != nil -} - -func (p *TraceCombo) IsSetTimeline() bool { - return p.Timeline != nil -} - -func (p *TraceCombo) IsSetSpanDepths() bool { - return p.SpanDepths != nil -} - -func (p *TraceCombo) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } - case 4: - if err := p.ReadField4(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *TraceCombo) ReadField1(iprot thrift.TProtocol) error { - p.Trace = &Trace{} - if err := p.Trace.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Trace, err) - } - return nil -} - -func (p *TraceCombo) ReadField2(iprot thrift.TProtocol) error { - p.Summary = &TraceSummary{} - if err := p.Summary.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Summary, err) - } - return nil -} - -func (p *TraceCombo) ReadField3(iprot thrift.TProtocol) error { - p.Timeline = &TraceTimeline{} - if err := p.Timeline.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Timeline, err) - } - return nil -} - -func (p *TraceCombo) ReadField4(iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin() - if err != nil { - return fmt.Errorf("error reading map begin: %s", err) - } - tMap := make(map[int64]int32, size) - p.SpanDepths = tMap - for i := 0; i < size; i++ { - var _key5 int64 - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _key5 = v - } - var _val6 int32 - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _val6 = v - } - p.SpanDepths[_key5] = _val6 - } - if err := iprot.ReadMapEnd(); err != nil { - return fmt.Errorf("error reading map end: %s", err) - } - return nil -} - -func (p *TraceCombo) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("TraceCombo"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - 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 := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *TraceCombo) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("trace", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:trace: %s", p, err) - } - if err := p.Trace.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Trace, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:trace: %s", p, err) - } - return err -} - -func (p *TraceCombo) writeField2(oprot thrift.TProtocol) (err error) { - if p.IsSetSummary() { - if err := oprot.WriteFieldBegin("summary", thrift.STRUCT, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:summary: %s", p, err) - } - if err := p.Summary.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Summary, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:summary: %s", p, err) - } - } - return err -} - -func (p *TraceCombo) writeField3(oprot thrift.TProtocol) (err error) { - if p.IsSetTimeline() { - if err := oprot.WriteFieldBegin("timeline", thrift.STRUCT, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:timeline: %s", p, err) - } - if err := p.Timeline.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Timeline, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:timeline: %s", p, err) - } - } - return err -} - -func (p *TraceCombo) writeField4(oprot thrift.TProtocol) (err error) { - if p.IsSetSpanDepths() { - if err := oprot.WriteFieldBegin("span_depths", thrift.MAP, 4); err != nil { - return fmt.Errorf("%T write field begin error 4:span_depths: %s", p, err) - } - if err := oprot.WriteMapBegin(thrift.I64, thrift.I32, len(p.SpanDepths)); err != nil { - return fmt.Errorf("error writing map begin: %s", err) - } - for k, v := range p.SpanDepths { - if err := oprot.WriteI64(int64(k)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - if err := oprot.WriteI32(int32(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteMapEnd(); err != nil { - return fmt.Errorf("error writing map end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 4:span_depths: %s", p, err) - } - } - return err -} - -func (p *TraceCombo) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("TraceCombo(%+v)", *p) -} - -type QueryRequest struct { - ServiceName string `thrift:"service_name,1" json:"service_name"` - SpanName *string `thrift:"span_name,2" json:"span_name"` - Annotations []string `thrift:"annotations,3" json:"annotations"` - BinaryAnnotations []*zipkincore.BinaryAnnotation `thrift:"binary_annotations,4" json:"binary_annotations"` - EndTs int64 `thrift:"end_ts,5" json:"end_ts"` - Limit int32 `thrift:"limit,6" json:"limit"` - Order Order `thrift:"order,7" json:"order"` -} - -func NewQueryRequest() *QueryRequest { - return &QueryRequest{} -} - -func (p *QueryRequest) GetServiceName() string { - return p.ServiceName -} - -var QueryRequest_SpanName_DEFAULT string - -func (p *QueryRequest) GetSpanName() string { - if !p.IsSetSpanName() { - return QueryRequest_SpanName_DEFAULT - } - return *p.SpanName -} - -var QueryRequest_Annotations_DEFAULT []string - -func (p *QueryRequest) GetAnnotations() []string { - return p.Annotations -} - -var QueryRequest_BinaryAnnotations_DEFAULT []*zipkincore.BinaryAnnotation - -func (p *QueryRequest) GetBinaryAnnotations() []*zipkincore.BinaryAnnotation { - return p.BinaryAnnotations -} - -func (p *QueryRequest) GetEndTs() int64 { - return p.EndTs -} - -func (p *QueryRequest) GetLimit() int32 { - return p.Limit -} - -func (p *QueryRequest) GetOrder() Order { - return p.Order -} -func (p *QueryRequest) IsSetSpanName() bool { - return p.SpanName != nil -} - -func (p *QueryRequest) IsSetAnnotations() bool { - return p.Annotations != nil -} - -func (p *QueryRequest) IsSetBinaryAnnotations() bool { - return p.BinaryAnnotations != nil -} - -func (p *QueryRequest) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } - case 4: - if err := p.ReadField4(iprot); err != nil { - return err - } - case 5: - if err := p.ReadField5(iprot); err != nil { - return err - } - case 6: - if err := p.ReadField6(iprot); err != nil { - return err - } - case 7: - if err := p.ReadField7(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *QueryRequest) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.ServiceName = v - } - return nil -} - -func (p *QueryRequest) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.SpanName = &v - } - return nil -} - -func (p *QueryRequest) ReadField3(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]string, 0, size) - p.Annotations = tSlice - for i := 0; i < size; i++ { - var _elem7 string - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem7 = v - } - p.Annotations = append(p.Annotations, _elem7) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *QueryRequest) ReadField4(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]*zipkincore.BinaryAnnotation, 0, size) - p.BinaryAnnotations = tSlice - for i := 0; i < size; i++ { - _elem8 := &zipkincore.BinaryAnnotation{} - if err := _elem8.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem8, err) - } - p.BinaryAnnotations = append(p.BinaryAnnotations, _elem8) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *QueryRequest) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 5: %s", err) - } else { - p.EndTs = v - } - return nil -} - -func (p *QueryRequest) ReadField6(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 6: %s", err) - } else { - p.Limit = v - } - return nil -} - -func (p *QueryRequest) ReadField7(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 7: %s", err) - } else { - temp := Order(v) - p.Order = temp - } - return nil -} - -func (p *QueryRequest) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("QueryRequest"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *QueryRequest) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err) - } - if err := oprot.WriteString(string(p.ServiceName)); err != nil { - return fmt.Errorf("%T.service_name (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:service_name: %s", p, err) - } - return err -} - -func (p *QueryRequest) writeField2(oprot thrift.TProtocol) (err error) { - if p.IsSetSpanName() { - if err := oprot.WriteFieldBegin("span_name", thrift.STRING, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:span_name: %s", p, err) - } - if err := oprot.WriteString(string(*p.SpanName)); err != nil { - return fmt.Errorf("%T.span_name (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:span_name: %s", p, err) - } - } - return err -} - -func (p *QueryRequest) writeField3(oprot thrift.TProtocol) (err error) { - if p.IsSetAnnotations() { - if err := oprot.WriteFieldBegin("annotations", thrift.LIST, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:annotations: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRING, len(p.Annotations)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Annotations { - if err := oprot.WriteString(string(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:annotations: %s", p, err) - } - } - return err -} - -func (p *QueryRequest) writeField4(oprot thrift.TProtocol) (err error) { - if p.IsSetBinaryAnnotations() { - if err := oprot.WriteFieldBegin("binary_annotations", thrift.LIST, 4); err != nil { - return fmt.Errorf("%T write field begin error 4:binary_annotations: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.BinaryAnnotations)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.BinaryAnnotations { - if err := v.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", v, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 4:binary_annotations: %s", p, err) - } - } - return err -} - -func (p *QueryRequest) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("end_ts", thrift.I64, 5); err != nil { - return fmt.Errorf("%T write field begin error 5:end_ts: %s", p, err) - } - if err := oprot.WriteI64(int64(p.EndTs)); err != nil { - return fmt.Errorf("%T.end_ts (5) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 5:end_ts: %s", p, err) - } - return err -} - -func (p *QueryRequest) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("limit", thrift.I32, 6); err != nil { - return fmt.Errorf("%T write field begin error 6:limit: %s", p, err) - } - if err := oprot.WriteI32(int32(p.Limit)); err != nil { - return fmt.Errorf("%T.limit (6) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 6:limit: %s", p, err) - } - return err -} - -func (p *QueryRequest) writeField7(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("order", thrift.I32, 7); err != nil { - return fmt.Errorf("%T write field begin error 7:order: %s", p, err) - } - if err := oprot.WriteI32(int32(p.Order)); err != nil { - return fmt.Errorf("%T.order (7) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 7:order: %s", p, err) - } - return err -} - -func (p *QueryRequest) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("QueryRequest(%+v)", *p) -} - -type QueryResponse struct { - TraceIds []int64 `thrift:"trace_ids,1" json:"trace_ids"` - StartTs int64 `thrift:"start_ts,2" json:"start_ts"` - EndTs int64 `thrift:"end_ts,3" json:"end_ts"` -} - -func NewQueryResponse() *QueryResponse { - return &QueryResponse{} -} - -func (p *QueryResponse) GetTraceIds() []int64 { - return p.TraceIds -} - -func (p *QueryResponse) GetStartTs() int64 { - return p.StartTs -} - -func (p *QueryResponse) GetEndTs() int64 { - return p.EndTs -} -func (p *QueryResponse) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *QueryResponse) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]int64, 0, size) - p.TraceIds = tSlice - for i := 0; i < size; i++ { - var _elem9 int64 - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem9 = v - } - p.TraceIds = append(p.TraceIds, _elem9) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *QueryResponse) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.StartTs = v - } - return nil -} - -func (p *QueryResponse) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 3: %s", err) - } else { - p.EndTs = v - } - return nil -} - -func (p *QueryResponse) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("QueryResponse"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - 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 := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *QueryResponse) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("trace_ids", thrift.LIST, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:trace_ids: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.I64, len(p.TraceIds)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.TraceIds { - if err := oprot.WriteI64(int64(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:trace_ids: %s", p, err) - } - return err -} - -func (p *QueryResponse) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("start_ts", thrift.I64, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:start_ts: %s", p, err) - } - if err := oprot.WriteI64(int64(p.StartTs)); err != nil { - return fmt.Errorf("%T.start_ts (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:start_ts: %s", p, err) - } - return err -} - -func (p *QueryResponse) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("end_ts", thrift.I64, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:end_ts: %s", p, err) - } - if err := oprot.WriteI64(int64(p.EndTs)); err != nil { - return fmt.Errorf("%T.end_ts (3) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:end_ts: %s", p, err) - } - return err -} - -func (p *QueryResponse) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("QueryResponse(%+v)", *p) -} diff --git a/tracing/zipkin/_thrift/gen-go/zipkinquery/zipkin_query-remote/zipkin_query-remote.go b/tracing/zipkin/_thrift/gen-go/zipkinquery/zipkin_query-remote/zipkin_query-remote.go deleted file mode 100755 index 332a2f0f4..000000000 --- a/tracing/zipkin/_thrift/gen-go/zipkinquery/zipkin_query-remote/zipkin_query-remote.go +++ /dev/null @@ -1,602 +0,0 @@ -// Autogenerated by Thrift Compiler (0.9.2) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -package main - -import ( - "flag" - "fmt" - "github.com/apache/thrift/lib/go/thrift" - "math" - "net" - "net/url" - "os" - "strconv" - "strings" - "zipkinquery" -) - -func Usage() { - fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:") - flag.PrintDefaults() - fmt.Fprintln(os.Stderr, "\nFunctions:") - fmt.Fprintln(os.Stderr, " QueryResponse getTraceIds(QueryRequest request)") - fmt.Fprintln(os.Stderr, " getTraceIdsBySpanName(string service_name, string span_name, i64 end_ts, i32 limit, Order order)") - fmt.Fprintln(os.Stderr, " getTraceIdsByServiceName(string service_name, i64 end_ts, i32 limit, Order order)") - fmt.Fprintln(os.Stderr, " getTraceIdsByAnnotation(string service_name, string annotation, string value, i64 end_ts, i32 limit, Order order)") - fmt.Fprintln(os.Stderr, " tracesExist( trace_ids)") - fmt.Fprintln(os.Stderr, " getTracesByIds( trace_ids, adjust)") - fmt.Fprintln(os.Stderr, " getTraceTimelinesByIds( trace_ids, adjust)") - fmt.Fprintln(os.Stderr, " getTraceSummariesByIds( trace_ids, adjust)") - fmt.Fprintln(os.Stderr, " getTraceCombosByIds( trace_ids, adjust)") - fmt.Fprintln(os.Stderr, " getServiceNames()") - fmt.Fprintln(os.Stderr, " getSpanNames(string service_name)") - fmt.Fprintln(os.Stderr, " void setTraceTimeToLive(i64 trace_id, i32 ttl_seconds)") - fmt.Fprintln(os.Stderr, " i32 getTraceTimeToLive(i64 trace_id)") - fmt.Fprintln(os.Stderr, " i32 getDataTimeToLive()") - fmt.Fprintln(os.Stderr, " Dependencies getDependencies(i64 start_time, i64 end_time)") - fmt.Fprintln(os.Stderr, " getTopAnnotations(string service_name)") - fmt.Fprintln(os.Stderr, " getTopKeyValueAnnotations(string service_name)") - fmt.Fprintln(os.Stderr, " getSpanDurations(i64 time_stamp, string service_name, string rpc_name)") - fmt.Fprintln(os.Stderr, " getServiceNamesToTraceIds(i64 time_stamp, string service_name, string rpc_name)") - fmt.Fprintln(os.Stderr) - os.Exit(0) -} - -func main() { - flag.Usage = Usage - var host string - var port int - var protocol string - var urlString string - var framed bool - var useHttp bool - var parsedUrl url.URL - var trans thrift.TTransport - _ = strconv.Atoi - _ = math.Abs - flag.Usage = Usage - flag.StringVar(&host, "h", "localhost", "Specify host and port") - flag.IntVar(&port, "p", 9090, "Specify port") - flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)") - flag.StringVar(&urlString, "u", "", "Specify the url") - flag.BoolVar(&framed, "framed", false, "Use framed transport") - flag.BoolVar(&useHttp, "http", false, "Use http") - flag.Parse() - - if len(urlString) > 0 { - parsedUrl, err := url.Parse(urlString) - if err != nil { - fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) - flag.Usage() - } - host = parsedUrl.Host - useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" - } else if useHttp { - _, err := url.Parse(fmt.Sprint("http://", host, ":", port)) - if err != nil { - fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) - flag.Usage() - } - } - - cmd := flag.Arg(0) - var err error - if useHttp { - trans, err = thrift.NewTHttpClient(parsedUrl.String()) - } else { - portStr := fmt.Sprint(port) - if strings.Contains(host, ":") { - host, portStr, err = net.SplitHostPort(host) - if err != nil { - fmt.Fprintln(os.Stderr, "error with host:", err) - os.Exit(1) - } - } - trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr)) - if err != nil { - fmt.Fprintln(os.Stderr, "error resolving address:", err) - os.Exit(1) - } - if framed { - trans = thrift.NewTFramedTransport(trans) - } - } - if err != nil { - fmt.Fprintln(os.Stderr, "Error creating transport", err) - os.Exit(1) - } - defer trans.Close() - var protocolFactory thrift.TProtocolFactory - switch protocol { - case "compact": - protocolFactory = thrift.NewTCompactProtocolFactory() - break - case "simplejson": - protocolFactory = thrift.NewTSimpleJSONProtocolFactory() - break - case "json": - protocolFactory = thrift.NewTJSONProtocolFactory() - break - case "binary", "": - protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() - break - default: - fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol) - Usage() - os.Exit(1) - } - client := zipkinquery.NewZipkinQueryClientFactory(trans, protocolFactory) - if err := trans.Open(); err != nil { - fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err) - os.Exit(1) - } - - switch cmd { - case "getTraceIds": - if flag.NArg()-1 != 1 { - fmt.Fprintln(os.Stderr, "GetTraceIds requires 1 args") - flag.Usage() - } - arg77 := flag.Arg(1) - mbTrans78 := thrift.NewTMemoryBufferLen(len(arg77)) - defer mbTrans78.Close() - _, err79 := mbTrans78.WriteString(arg77) - if err79 != nil { - Usage() - return - } - factory80 := thrift.NewTSimpleJSONProtocolFactory() - jsProt81 := factory80.GetProtocol(mbTrans78) - argvalue0 := zipkinquery.NewQueryRequest() - err82 := argvalue0.Read(jsProt81) - if err82 != nil { - Usage() - return - } - value0 := argvalue0 - fmt.Print(client.GetTraceIds(value0)) - fmt.Print("\n") - break - case "getTraceIdsBySpanName": - if flag.NArg()-1 != 5 { - fmt.Fprintln(os.Stderr, "GetTraceIdsBySpanName requires 5 args") - flag.Usage() - } - argvalue0 := flag.Arg(1) - value0 := argvalue0 - argvalue1 := flag.Arg(2) - value1 := argvalue1 - argvalue2, err85 := (strconv.ParseInt(flag.Arg(3), 10, 64)) - if err85 != nil { - Usage() - return - } - value2 := argvalue2 - tmp3, err86 := (strconv.Atoi(flag.Arg(4))) - if err86 != nil { - Usage() - return - } - argvalue3 := int32(tmp3) - value3 := argvalue3 - tmp4, err := (strconv.Atoi(flag.Arg(5))) - if err != nil { - Usage() - return - } - argvalue4 := zipkinquery.Order(tmp4) - value4 := argvalue4 - fmt.Print(client.GetTraceIdsBySpanName(value0, value1, value2, value3, value4)) - fmt.Print("\n") - break - case "getTraceIdsByServiceName": - if flag.NArg()-1 != 4 { - fmt.Fprintln(os.Stderr, "GetTraceIdsByServiceName requires 4 args") - flag.Usage() - } - argvalue0 := flag.Arg(1) - value0 := argvalue0 - argvalue1, err88 := (strconv.ParseInt(flag.Arg(2), 10, 64)) - if err88 != nil { - Usage() - return - } - value1 := argvalue1 - tmp2, err89 := (strconv.Atoi(flag.Arg(3))) - if err89 != nil { - Usage() - return - } - argvalue2 := int32(tmp2) - value2 := argvalue2 - tmp3, err := (strconv.Atoi(flag.Arg(4))) - if err != nil { - Usage() - return - } - argvalue3 := zipkinquery.Order(tmp3) - value3 := argvalue3 - fmt.Print(client.GetTraceIdsByServiceName(value0, value1, value2, value3)) - fmt.Print("\n") - break - case "getTraceIdsByAnnotation": - if flag.NArg()-1 != 6 { - fmt.Fprintln(os.Stderr, "GetTraceIdsByAnnotation requires 6 args") - flag.Usage() - } - argvalue0 := flag.Arg(1) - value0 := argvalue0 - argvalue1 := flag.Arg(2) - value1 := argvalue1 - argvalue2 := []byte(flag.Arg(3)) - value2 := argvalue2 - argvalue3, err93 := (strconv.ParseInt(flag.Arg(4), 10, 64)) - if err93 != nil { - Usage() - return - } - value3 := argvalue3 - tmp4, err94 := (strconv.Atoi(flag.Arg(5))) - if err94 != nil { - Usage() - return - } - argvalue4 := int32(tmp4) - value4 := argvalue4 - tmp5, err := (strconv.Atoi(flag.Arg(6))) - if err != nil { - Usage() - return - } - argvalue5 := zipkinquery.Order(tmp5) - value5 := argvalue5 - fmt.Print(client.GetTraceIdsByAnnotation(value0, value1, value2, value3, value4, value5)) - fmt.Print("\n") - break - case "tracesExist": - if flag.NArg()-1 != 1 { - fmt.Fprintln(os.Stderr, "TracesExist requires 1 args") - flag.Usage() - } - arg95 := flag.Arg(1) - mbTrans96 := thrift.NewTMemoryBufferLen(len(arg95)) - defer mbTrans96.Close() - _, err97 := mbTrans96.WriteString(arg95) - if err97 != nil { - Usage() - return - } - factory98 := thrift.NewTSimpleJSONProtocolFactory() - jsProt99 := factory98.GetProtocol(mbTrans96) - containerStruct0 := zipkinquery.NewTracesExistArgs() - err100 := containerStruct0.ReadField1(jsProt99) - if err100 != nil { - Usage() - return - } - argvalue0 := containerStruct0.TraceIds - value0 := argvalue0 - fmt.Print(client.TracesExist(value0)) - fmt.Print("\n") - break - case "getTracesByIds": - if flag.NArg()-1 != 2 { - fmt.Fprintln(os.Stderr, "GetTracesByIds requires 2 args") - flag.Usage() - } - arg101 := flag.Arg(1) - mbTrans102 := thrift.NewTMemoryBufferLen(len(arg101)) - defer mbTrans102.Close() - _, err103 := mbTrans102.WriteString(arg101) - if err103 != nil { - Usage() - return - } - factory104 := thrift.NewTSimpleJSONProtocolFactory() - jsProt105 := factory104.GetProtocol(mbTrans102) - containerStruct0 := zipkinquery.NewGetTracesByIdsArgs() - err106 := containerStruct0.ReadField1(jsProt105) - if err106 != nil { - Usage() - return - } - argvalue0 := containerStruct0.TraceIds - value0 := argvalue0 - arg107 := flag.Arg(2) - mbTrans108 := thrift.NewTMemoryBufferLen(len(arg107)) - defer mbTrans108.Close() - _, err109 := mbTrans108.WriteString(arg107) - if err109 != nil { - Usage() - return - } - factory110 := thrift.NewTSimpleJSONProtocolFactory() - jsProt111 := factory110.GetProtocol(mbTrans108) - containerStruct1 := zipkinquery.NewGetTracesByIdsArgs() - err112 := containerStruct1.ReadField2(jsProt111) - if err112 != nil { - Usage() - return - } - argvalue1 := containerStruct1.Adjust - value1 := argvalue1 - fmt.Print(client.GetTracesByIds(value0, value1)) - fmt.Print("\n") - break - case "getTraceTimelinesByIds": - if flag.NArg()-1 != 2 { - fmt.Fprintln(os.Stderr, "GetTraceTimelinesByIds requires 2 args") - flag.Usage() - } - arg113 := flag.Arg(1) - mbTrans114 := thrift.NewTMemoryBufferLen(len(arg113)) - defer mbTrans114.Close() - _, err115 := mbTrans114.WriteString(arg113) - if err115 != nil { - Usage() - return - } - factory116 := thrift.NewTSimpleJSONProtocolFactory() - jsProt117 := factory116.GetProtocol(mbTrans114) - containerStruct0 := zipkinquery.NewGetTraceTimelinesByIdsArgs() - err118 := containerStruct0.ReadField1(jsProt117) - if err118 != nil { - Usage() - return - } - argvalue0 := containerStruct0.TraceIds - value0 := argvalue0 - arg119 := flag.Arg(2) - mbTrans120 := thrift.NewTMemoryBufferLen(len(arg119)) - defer mbTrans120.Close() - _, err121 := mbTrans120.WriteString(arg119) - if err121 != nil { - Usage() - return - } - factory122 := thrift.NewTSimpleJSONProtocolFactory() - jsProt123 := factory122.GetProtocol(mbTrans120) - containerStruct1 := zipkinquery.NewGetTraceTimelinesByIdsArgs() - err124 := containerStruct1.ReadField2(jsProt123) - if err124 != nil { - Usage() - return - } - argvalue1 := containerStruct1.Adjust - value1 := argvalue1 - fmt.Print(client.GetTraceTimelinesByIds(value0, value1)) - fmt.Print("\n") - break - case "getTraceSummariesByIds": - if flag.NArg()-1 != 2 { - fmt.Fprintln(os.Stderr, "GetTraceSummariesByIds requires 2 args") - flag.Usage() - } - arg125 := flag.Arg(1) - mbTrans126 := thrift.NewTMemoryBufferLen(len(arg125)) - defer mbTrans126.Close() - _, err127 := mbTrans126.WriteString(arg125) - if err127 != nil { - Usage() - return - } - factory128 := thrift.NewTSimpleJSONProtocolFactory() - jsProt129 := factory128.GetProtocol(mbTrans126) - containerStruct0 := zipkinquery.NewGetTraceSummariesByIdsArgs() - err130 := containerStruct0.ReadField1(jsProt129) - if err130 != nil { - Usage() - return - } - argvalue0 := containerStruct0.TraceIds - value0 := argvalue0 - arg131 := flag.Arg(2) - mbTrans132 := thrift.NewTMemoryBufferLen(len(arg131)) - defer mbTrans132.Close() - _, err133 := mbTrans132.WriteString(arg131) - if err133 != nil { - Usage() - return - } - factory134 := thrift.NewTSimpleJSONProtocolFactory() - jsProt135 := factory134.GetProtocol(mbTrans132) - containerStruct1 := zipkinquery.NewGetTraceSummariesByIdsArgs() - err136 := containerStruct1.ReadField2(jsProt135) - if err136 != nil { - Usage() - return - } - argvalue1 := containerStruct1.Adjust - value1 := argvalue1 - fmt.Print(client.GetTraceSummariesByIds(value0, value1)) - fmt.Print("\n") - break - case "getTraceCombosByIds": - if flag.NArg()-1 != 2 { - fmt.Fprintln(os.Stderr, "GetTraceCombosByIds requires 2 args") - flag.Usage() - } - arg137 := flag.Arg(1) - mbTrans138 := thrift.NewTMemoryBufferLen(len(arg137)) - defer mbTrans138.Close() - _, err139 := mbTrans138.WriteString(arg137) - if err139 != nil { - Usage() - return - } - factory140 := thrift.NewTSimpleJSONProtocolFactory() - jsProt141 := factory140.GetProtocol(mbTrans138) - containerStruct0 := zipkinquery.NewGetTraceCombosByIdsArgs() - err142 := containerStruct0.ReadField1(jsProt141) - if err142 != nil { - Usage() - return - } - argvalue0 := containerStruct0.TraceIds - value0 := argvalue0 - arg143 := flag.Arg(2) - mbTrans144 := thrift.NewTMemoryBufferLen(len(arg143)) - defer mbTrans144.Close() - _, err145 := mbTrans144.WriteString(arg143) - if err145 != nil { - Usage() - return - } - factory146 := thrift.NewTSimpleJSONProtocolFactory() - jsProt147 := factory146.GetProtocol(mbTrans144) - containerStruct1 := zipkinquery.NewGetTraceCombosByIdsArgs() - err148 := containerStruct1.ReadField2(jsProt147) - if err148 != nil { - Usage() - return - } - argvalue1 := containerStruct1.Adjust - value1 := argvalue1 - fmt.Print(client.GetTraceCombosByIds(value0, value1)) - fmt.Print("\n") - break - case "getServiceNames": - if flag.NArg()-1 != 0 { - fmt.Fprintln(os.Stderr, "GetServiceNames requires 0 args") - flag.Usage() - } - fmt.Print(client.GetServiceNames()) - fmt.Print("\n") - break - case "getSpanNames": - if flag.NArg()-1 != 1 { - fmt.Fprintln(os.Stderr, "GetSpanNames requires 1 args") - flag.Usage() - } - argvalue0 := flag.Arg(1) - value0 := argvalue0 - fmt.Print(client.GetSpanNames(value0)) - fmt.Print("\n") - break - case "setTraceTimeToLive": - if flag.NArg()-1 != 2 { - fmt.Fprintln(os.Stderr, "SetTraceTimeToLive requires 2 args") - flag.Usage() - } - argvalue0, err150 := (strconv.ParseInt(flag.Arg(1), 10, 64)) - if err150 != nil { - Usage() - return - } - value0 := argvalue0 - tmp1, err151 := (strconv.Atoi(flag.Arg(2))) - if err151 != nil { - Usage() - return - } - argvalue1 := int32(tmp1) - value1 := argvalue1 - fmt.Print(client.SetTraceTimeToLive(value0, value1)) - fmt.Print("\n") - break - case "getTraceTimeToLive": - if flag.NArg()-1 != 1 { - fmt.Fprintln(os.Stderr, "GetTraceTimeToLive requires 1 args") - flag.Usage() - } - argvalue0, err152 := (strconv.ParseInt(flag.Arg(1), 10, 64)) - if err152 != nil { - Usage() - return - } - value0 := argvalue0 - fmt.Print(client.GetTraceTimeToLive(value0)) - fmt.Print("\n") - break - case "getDataTimeToLive": - if flag.NArg()-1 != 0 { - fmt.Fprintln(os.Stderr, "GetDataTimeToLive requires 0 args") - flag.Usage() - } - fmt.Print(client.GetDataTimeToLive()) - fmt.Print("\n") - break - case "getDependencies": - if flag.NArg()-1 != 2 { - fmt.Fprintln(os.Stderr, "GetDependencies requires 2 args") - flag.Usage() - } - argvalue0, err153 := (strconv.ParseInt(flag.Arg(1), 10, 64)) - if err153 != nil { - Usage() - return - } - value0 := argvalue0 - argvalue1, err154 := (strconv.ParseInt(flag.Arg(2), 10, 64)) - if err154 != nil { - Usage() - return - } - value1 := argvalue1 - fmt.Print(client.GetDependencies(value0, value1)) - fmt.Print("\n") - break - case "getTopAnnotations": - if flag.NArg()-1 != 1 { - fmt.Fprintln(os.Stderr, "GetTopAnnotations requires 1 args") - flag.Usage() - } - argvalue0 := flag.Arg(1) - value0 := argvalue0 - fmt.Print(client.GetTopAnnotations(value0)) - fmt.Print("\n") - break - case "getTopKeyValueAnnotations": - if flag.NArg()-1 != 1 { - fmt.Fprintln(os.Stderr, "GetTopKeyValueAnnotations requires 1 args") - flag.Usage() - } - argvalue0 := flag.Arg(1) - value0 := argvalue0 - fmt.Print(client.GetTopKeyValueAnnotations(value0)) - fmt.Print("\n") - break - case "getSpanDurations": - if flag.NArg()-1 != 3 { - fmt.Fprintln(os.Stderr, "GetSpanDurations requires 3 args") - flag.Usage() - } - argvalue0, err157 := (strconv.ParseInt(flag.Arg(1), 10, 64)) - if err157 != nil { - Usage() - return - } - value0 := argvalue0 - argvalue1 := flag.Arg(2) - value1 := argvalue1 - argvalue2 := flag.Arg(3) - value2 := argvalue2 - fmt.Print(client.GetSpanDurations(value0, value1, value2)) - fmt.Print("\n") - break - case "getServiceNamesToTraceIds": - if flag.NArg()-1 != 3 { - fmt.Fprintln(os.Stderr, "GetServiceNamesToTraceIds requires 3 args") - flag.Usage() - } - argvalue0, err160 := (strconv.ParseInt(flag.Arg(1), 10, 64)) - if err160 != nil { - Usage() - return - } - value0 := argvalue0 - argvalue1 := flag.Arg(2) - value1 := argvalue1 - argvalue2 := flag.Arg(3) - value2 := argvalue2 - fmt.Print(client.GetServiceNamesToTraceIds(value0, value1, value2)) - fmt.Print("\n") - break - case "": - Usage() - break - default: - fmt.Fprintln(os.Stderr, "Invalid function ", cmd) - } -} diff --git a/tracing/zipkin/_thrift/gen-go/zipkinquery/zipkinquery.go b/tracing/zipkin/_thrift/gen-go/zipkinquery/zipkinquery.go deleted file mode 100644 index 6fbd56052..000000000 --- a/tracing/zipkin/_thrift/gen-go/zipkinquery/zipkinquery.go +++ /dev/null @@ -1,8183 +0,0 @@ -// Autogenerated by Thrift Compiler (0.9.2) -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -package zipkinquery - -import ( - "bytes" - "fmt" - "github.com/apache/thrift/lib/go/thrift" - "zipkincore" - "zipkindependencies" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = bytes.Equal - -var _ = zipkincore.GoUnusedProtection__ -var _ = zipkindependencies.GoUnusedProtection__ - -type ZipkinQuery interface { - // Parameters: - // - Request - GetTraceIds(request *QueryRequest) (r *QueryResponse, err error) - // Fetch trace ids by service and span name. - // Gets "limit" number of entries from before the "end_ts". - // - // Span name is optional. - // Timestamps are in microseconds. - // - // Parameters: - // - ServiceName - // - SpanName - // - EndTs - // - Limit - // - Order - GetTraceIdsBySpanName(service_name string, span_name string, end_ts int64, limit int32, order Order) (r []int64, err error) - // Fetch trace ids by service name. - // Gets "limit" number of entries from before the "end_ts". - // - // Timestamps are in microseconds. - // - // Parameters: - // - ServiceName - // - EndTs - // - Limit - // - Order - GetTraceIdsByServiceName(service_name string, end_ts int64, limit int32, order Order) (r []int64, err error) - // Fetch trace ids with a particular annotation. - // Gets "limit" number of entries from before the "end_ts". - // - // When requesting based on time based annotations only pass in the first parameter, "annotation" and leave out - // the second "value". If looking for a key-value binary annotation provide both, "annotation" is then the - // key in the key-value. - // - // Timestamps are in microseconds. - // - // Parameters: - // - ServiceName - // - Annotation - // - Value - // - EndTs - // - Limit - // - Order - GetTraceIdsByAnnotation(service_name string, annotation string, value []byte, end_ts int64, limit int32, order Order) (r []int64, err error) - // Get the traces that are in the database from the given list of trace ids. - // - // Parameters: - // - TraceIds - TracesExist(trace_ids []int64) (r map[int64]bool, err error) - // Get the full traces associated with the given trace ids. - // - // Second argument is a list of methods of adjusting the trace - // data before returning it. Can be empty. - // - // Parameters: - // - TraceIds - // - Adjust - GetTracesByIds(trace_ids []int64, adjust []Adjust) (r []*Trace, err error) - // Get the trace timelines associated with the given trace ids. - // This is a convenience method for users that just want to know - // the annotations and the (assumed) order they happened in. - // - // Second argument is a list of methods of adjusting the trace - // data before returning it. Can be empty. - // - // Note that if one of the trace ids does not have any data associated with it, it will not be - // represented in the output list. - // - // Parameters: - // - TraceIds - // - Adjust - GetTraceTimelinesByIds(trace_ids []int64, adjust []Adjust) (r []*TraceTimeline, err error) - // Fetch trace summaries for the given trace ids. - // - // Second argument is a list of methods of adjusting the trace - // data before returning it. Can be empty. - // - // Note that if one of the trace ids does not have any data associated with it, it will not be - // represented in the output list. - // - // Parameters: - // - TraceIds - // - Adjust - GetTraceSummariesByIds(trace_ids []int64, adjust []Adjust) (r []*TraceSummary, err error) - // Not content with just one of traces, summaries or timelines? Want it all? This is the method for you. - // - // Parameters: - // - TraceIds - // - Adjust - GetTraceCombosByIds(trace_ids []int64, adjust []Adjust) (r []*TraceCombo, err error) - // Fetch all the service names we have seen from now all the way back to the set ttl. - GetServiceNames() (r map[string]bool, err error) - // Get all the seen span names for a particular service, from now back until the set ttl. - // - // Parameters: - // - ServiceName - GetSpanNames(service_name string) (r map[string]bool, err error) - // Change the TTL of a trace. If we find an interesting trace we want to keep around for further - // investigation. - // - // Parameters: - // - TraceId - // - TtlSeconds - SetTraceTimeToLive(trace_id int64, ttl_seconds int32) (err error) - // Get the TTL in seconds of a specific trace. - // - // Parameters: - // - TraceId - GetTraceTimeToLive(trace_id int64) (r int32, err error) - // Get the data ttl. This is the number of seconds we keep the data around before deleting it. - GetDataTimeToLive() (r int32, err error) - // Get an aggregate representation of all services paired with every service they call in to. - // This includes information on call counts and mean/stdDev/etc of call durations. The two arguments - // specify epoch time in microseconds. The end time is optional and defaults to one day after the - // start time. - // - // Parameters: - // - StartTime - // - EndTime - GetDependencies(start_time int64, end_time int64) (r *zipkindependencies.Dependencies, err error) - // Parameters: - // - ServiceName - GetTopAnnotations(service_name string) (r []string, err error) - // Parameters: - // - ServiceName - GetTopKeyValueAnnotations(service_name string) (r []string, err error) - // Given a time stamp, server service name, and rpc name, fetch all of the client services calling in paired - // with the lists of every span duration (list) from the server to client. The lists of span durations - // include information on call counts and mean/stdDev/etc of call durations. - // - // The three arguments specify epoch time in microseconds, server side service name and rpc name. The return maps - // contains the key - client_service_name and value - list. - // - // Parameters: - // - TimeStamp - // - ServiceName - // - RpcName - GetSpanDurations(time_stamp int64, service_name string, rpc_name string) (r map[string][]int64, err error) - // Given a time stamp, server service name, and rpc name, fetch all of the client services calling in paired - // with the lists of every trace Ids (list) from the server to client. - // - // The three arguments specify epoch time in microseconds, server side service name and rpc name. The return maps - // contains the key - client_service_name and value - list. - // - // Parameters: - // - TimeStamp - // - ServiceName - // - RpcName - GetServiceNamesToTraceIds(time_stamp int64, service_name string, rpc_name string) (r map[string][]int64, err error) -} - -type ZipkinQueryClient struct { - Transport thrift.TTransport - ProtocolFactory thrift.TProtocolFactory - InputProtocol thrift.TProtocol - OutputProtocol thrift.TProtocol - SeqId int32 -} - -func NewZipkinQueryClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ZipkinQueryClient { - return &ZipkinQueryClient{Transport: t, - ProtocolFactory: f, - InputProtocol: f.GetProtocol(t), - OutputProtocol: f.GetProtocol(t), - SeqId: 0, - } -} - -func NewZipkinQueryClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ZipkinQueryClient { - return &ZipkinQueryClient{Transport: t, - ProtocolFactory: nil, - InputProtocol: iprot, - OutputProtocol: oprot, - SeqId: 0, - } -} - -// Parameters: -// - Request -func (p *ZipkinQueryClient) GetTraceIds(request *QueryRequest) (r *QueryResponse, err error) { - if err = p.sendGetTraceIds(request); err != nil { - return - } - return p.recvGetTraceIds() -} - -func (p *ZipkinQueryClient) sendGetTraceIds(request *QueryRequest) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("getTraceIds", thrift.CALL, p.SeqId); err != nil { - return - } - args := GetTraceIdsArgs{ - Request: request, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvGetTraceIds() (value *QueryResponse, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error10 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error11 error - error11, err = error10.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error11 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTraceIds failed: out of sequence response") - return - } - result := GetTraceIdsResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.Qe != nil { - err = result.Qe - return - } - value = result.GetSuccess() - return -} - -// Fetch trace ids by service and span name. -// Gets "limit" number of entries from before the "end_ts". -// -// Span name is optional. -// Timestamps are in microseconds. -// -// Parameters: -// - ServiceName -// - SpanName -// - EndTs -// - Limit -// - Order -func (p *ZipkinQueryClient) GetTraceIdsBySpanName(service_name string, span_name string, end_ts int64, limit int32, order Order) (r []int64, err error) { - if err = p.sendGetTraceIdsBySpanName(service_name, span_name, end_ts, limit, order); err != nil { - return - } - return p.recvGetTraceIdsBySpanName() -} - -func (p *ZipkinQueryClient) sendGetTraceIdsBySpanName(service_name string, span_name string, end_ts int64, limit int32, order Order) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("getTraceIdsBySpanName", thrift.CALL, p.SeqId); err != nil { - return - } - args := GetTraceIdsBySpanNameArgs{ - ServiceName: service_name, - SpanName: span_name, - EndTs: end_ts, - Limit: limit, - Order: order, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvGetTraceIdsBySpanName() (value []int64, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error12 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error13 error - error13, err = error12.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error13 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTraceIdsBySpanName failed: out of sequence response") - return - } - result := GetTraceIdsBySpanNameResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.Qe != nil { - err = result.Qe - return - } - value = result.GetSuccess() - return -} - -// Fetch trace ids by service name. -// Gets "limit" number of entries from before the "end_ts". -// -// Timestamps are in microseconds. -// -// Parameters: -// - ServiceName -// - EndTs -// - Limit -// - Order -func (p *ZipkinQueryClient) GetTraceIdsByServiceName(service_name string, end_ts int64, limit int32, order Order) (r []int64, err error) { - if err = p.sendGetTraceIdsByServiceName(service_name, end_ts, limit, order); err != nil { - return - } - return p.recvGetTraceIdsByServiceName() -} - -func (p *ZipkinQueryClient) sendGetTraceIdsByServiceName(service_name string, end_ts int64, limit int32, order Order) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("getTraceIdsByServiceName", thrift.CALL, p.SeqId); err != nil { - return - } - args := GetTraceIdsByServiceNameArgs{ - ServiceName: service_name, - EndTs: end_ts, - Limit: limit, - Order: order, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvGetTraceIdsByServiceName() (value []int64, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error14 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error15 error - error15, err = error14.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error15 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTraceIdsByServiceName failed: out of sequence response") - return - } - result := GetTraceIdsByServiceNameResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.Qe != nil { - err = result.Qe - return - } - value = result.GetSuccess() - return -} - -// Fetch trace ids with a particular annotation. -// Gets "limit" number of entries from before the "end_ts". -// -// When requesting based on time based annotations only pass in the first parameter, "annotation" and leave out -// the second "value". If looking for a key-value binary annotation provide both, "annotation" is then the -// key in the key-value. -// -// Timestamps are in microseconds. -// -// Parameters: -// - ServiceName -// - Annotation -// - Value -// - EndTs -// - Limit -// - Order -func (p *ZipkinQueryClient) GetTraceIdsByAnnotation(service_name string, annotation string, value []byte, end_ts int64, limit int32, order Order) (r []int64, err error) { - if err = p.sendGetTraceIdsByAnnotation(service_name, annotation, value, end_ts, limit, order); err != nil { - return - } - return p.recvGetTraceIdsByAnnotation() -} - -func (p *ZipkinQueryClient) sendGetTraceIdsByAnnotation(service_name string, annotation string, value []byte, end_ts int64, limit int32, order Order) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("getTraceIdsByAnnotation", thrift.CALL, p.SeqId); err != nil { - return - } - args := GetTraceIdsByAnnotationArgs{ - ServiceName: service_name, - Annotation: annotation, - Value: value, - EndTs: end_ts, - Limit: limit, - Order: order, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvGetTraceIdsByAnnotation() (value []int64, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error16 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error17 error - error17, err = error16.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error17 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTraceIdsByAnnotation failed: out of sequence response") - return - } - result := GetTraceIdsByAnnotationResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.Qe != nil { - err = result.Qe - return - } - value = result.GetSuccess() - return -} - -// Get the traces that are in the database from the given list of trace ids. -// -// Parameters: -// - TraceIds -func (p *ZipkinQueryClient) TracesExist(trace_ids []int64) (r map[int64]bool, err error) { - if err = p.sendTracesExist(trace_ids); err != nil { - return - } - return p.recvTracesExist() -} - -func (p *ZipkinQueryClient) sendTracesExist(trace_ids []int64) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("tracesExist", thrift.CALL, p.SeqId); err != nil { - return - } - args := TracesExistArgs{ - TraceIds: trace_ids, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvTracesExist() (value map[int64]bool, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error18 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error19 error - error19, err = error18.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error19 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "tracesExist failed: out of sequence response") - return - } - result := TracesExistResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.Qe != nil { - err = result.Qe - return - } - value = result.GetSuccess() - return -} - -// Get the full traces associated with the given trace ids. -// -// Second argument is a list of methods of adjusting the trace -// data before returning it. Can be empty. -// -// Parameters: -// - TraceIds -// - Adjust -func (p *ZipkinQueryClient) GetTracesByIds(trace_ids []int64, adjust []Adjust) (r []*Trace, err error) { - if err = p.sendGetTracesByIds(trace_ids, adjust); err != nil { - return - } - return p.recvGetTracesByIds() -} - -func (p *ZipkinQueryClient) sendGetTracesByIds(trace_ids []int64, adjust []Adjust) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("getTracesByIds", thrift.CALL, p.SeqId); err != nil { - return - } - args := GetTracesByIdsArgs{ - TraceIds: trace_ids, - Adjust: adjust, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvGetTracesByIds() (value []*Trace, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error20 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error21 error - error21, err = error20.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error21 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTracesByIds failed: out of sequence response") - return - } - result := GetTracesByIdsResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.Qe != nil { - err = result.Qe - return - } - value = result.GetSuccess() - return -} - -// Get the trace timelines associated with the given trace ids. -// This is a convenience method for users that just want to know -// the annotations and the (assumed) order they happened in. -// -// Second argument is a list of methods of adjusting the trace -// data before returning it. Can be empty. -// -// Note that if one of the trace ids does not have any data associated with it, it will not be -// represented in the output list. -// -// Parameters: -// - TraceIds -// - Adjust -func (p *ZipkinQueryClient) GetTraceTimelinesByIds(trace_ids []int64, adjust []Adjust) (r []*TraceTimeline, err error) { - if err = p.sendGetTraceTimelinesByIds(trace_ids, adjust); err != nil { - return - } - return p.recvGetTraceTimelinesByIds() -} - -func (p *ZipkinQueryClient) sendGetTraceTimelinesByIds(trace_ids []int64, adjust []Adjust) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("getTraceTimelinesByIds", thrift.CALL, p.SeqId); err != nil { - return - } - args := GetTraceTimelinesByIdsArgs{ - TraceIds: trace_ids, - Adjust: adjust, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvGetTraceTimelinesByIds() (value []*TraceTimeline, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error22 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error23 error - error23, err = error22.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error23 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTraceTimelinesByIds failed: out of sequence response") - return - } - result := GetTraceTimelinesByIdsResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.Qe != nil { - err = result.Qe - return - } - value = result.GetSuccess() - return -} - -// Fetch trace summaries for the given trace ids. -// -// Second argument is a list of methods of adjusting the trace -// data before returning it. Can be empty. -// -// Note that if one of the trace ids does not have any data associated with it, it will not be -// represented in the output list. -// -// Parameters: -// - TraceIds -// - Adjust -func (p *ZipkinQueryClient) GetTraceSummariesByIds(trace_ids []int64, adjust []Adjust) (r []*TraceSummary, err error) { - if err = p.sendGetTraceSummariesByIds(trace_ids, adjust); err != nil { - return - } - return p.recvGetTraceSummariesByIds() -} - -func (p *ZipkinQueryClient) sendGetTraceSummariesByIds(trace_ids []int64, adjust []Adjust) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("getTraceSummariesByIds", thrift.CALL, p.SeqId); err != nil { - return - } - args := GetTraceSummariesByIdsArgs{ - TraceIds: trace_ids, - Adjust: adjust, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvGetTraceSummariesByIds() (value []*TraceSummary, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error24 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error25 error - error25, err = error24.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error25 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTraceSummariesByIds failed: out of sequence response") - return - } - result := GetTraceSummariesByIdsResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.Qe != nil { - err = result.Qe - return - } - value = result.GetSuccess() - return -} - -// Not content with just one of traces, summaries or timelines? Want it all? This is the method for you. -// -// Parameters: -// - TraceIds -// - Adjust -func (p *ZipkinQueryClient) GetTraceCombosByIds(trace_ids []int64, adjust []Adjust) (r []*TraceCombo, err error) { - if err = p.sendGetTraceCombosByIds(trace_ids, adjust); err != nil { - return - } - return p.recvGetTraceCombosByIds() -} - -func (p *ZipkinQueryClient) sendGetTraceCombosByIds(trace_ids []int64, adjust []Adjust) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("getTraceCombosByIds", thrift.CALL, p.SeqId); err != nil { - return - } - args := GetTraceCombosByIdsArgs{ - TraceIds: trace_ids, - Adjust: adjust, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvGetTraceCombosByIds() (value []*TraceCombo, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error26 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error27 error - error27, err = error26.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error27 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTraceCombosByIds failed: out of sequence response") - return - } - result := GetTraceCombosByIdsResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.Qe != nil { - err = result.Qe - return - } - value = result.GetSuccess() - return -} - -// Fetch all the service names we have seen from now all the way back to the set ttl. -func (p *ZipkinQueryClient) GetServiceNames() (r map[string]bool, err error) { - if err = p.sendGetServiceNames(); err != nil { - return - } - return p.recvGetServiceNames() -} - -func (p *ZipkinQueryClient) sendGetServiceNames() (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("getServiceNames", thrift.CALL, p.SeqId); err != nil { - return - } - args := GetServiceNamesArgs{} - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvGetServiceNames() (value map[string]bool, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error28 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error29 error - error29, err = error28.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error29 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getServiceNames failed: out of sequence response") - return - } - result := GetServiceNamesResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.Qe != nil { - err = result.Qe - return - } - value = result.GetSuccess() - return -} - -// Get all the seen span names for a particular service, from now back until the set ttl. -// -// Parameters: -// - ServiceName -func (p *ZipkinQueryClient) GetSpanNames(service_name string) (r map[string]bool, err error) { - if err = p.sendGetSpanNames(service_name); err != nil { - return - } - return p.recvGetSpanNames() -} - -func (p *ZipkinQueryClient) sendGetSpanNames(service_name string) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("getSpanNames", thrift.CALL, p.SeqId); err != nil { - return - } - args := GetSpanNamesArgs{ - ServiceName: service_name, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvGetSpanNames() (value map[string]bool, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error30 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error31 error - error31, err = error30.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error31 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getSpanNames failed: out of sequence response") - return - } - result := GetSpanNamesResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.Qe != nil { - err = result.Qe - return - } - value = result.GetSuccess() - return -} - -// Change the TTL of a trace. If we find an interesting trace we want to keep around for further -// investigation. -// -// Parameters: -// - TraceId -// - TtlSeconds -func (p *ZipkinQueryClient) SetTraceTimeToLive(trace_id int64, ttl_seconds int32) (err error) { - if err = p.sendSetTraceTimeToLive(trace_id, ttl_seconds); err != nil { - return - } - return p.recvSetTraceTimeToLive() -} - -func (p *ZipkinQueryClient) sendSetTraceTimeToLive(trace_id int64, ttl_seconds int32) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("setTraceTimeToLive", thrift.CALL, p.SeqId); err != nil { - return - } - args := SetTraceTimeToLiveArgs{ - TraceId: trace_id, - TtlSeconds: ttl_seconds, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvSetTraceTimeToLive() (err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error32 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error33 error - error33, err = error32.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error33 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "setTraceTimeToLive failed: out of sequence response") - return - } - result := SetTraceTimeToLiveResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.Qe != nil { - err = result.Qe - return - } - return -} - -// Get the TTL in seconds of a specific trace. -// -// Parameters: -// - TraceId -func (p *ZipkinQueryClient) GetTraceTimeToLive(trace_id int64) (r int32, err error) { - if err = p.sendGetTraceTimeToLive(trace_id); err != nil { - return - } - return p.recvGetTraceTimeToLive() -} - -func (p *ZipkinQueryClient) sendGetTraceTimeToLive(trace_id int64) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("getTraceTimeToLive", thrift.CALL, p.SeqId); err != nil { - return - } - args := GetTraceTimeToLiveArgs{ - TraceId: trace_id, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvGetTraceTimeToLive() (value int32, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error34 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error35 error - error35, err = error34.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error35 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTraceTimeToLive failed: out of sequence response") - return - } - result := GetTraceTimeToLiveResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.Qe != nil { - err = result.Qe - return - } - value = result.GetSuccess() - return -} - -// Get the data ttl. This is the number of seconds we keep the data around before deleting it. -func (p *ZipkinQueryClient) GetDataTimeToLive() (r int32, err error) { - if err = p.sendGetDataTimeToLive(); err != nil { - return - } - return p.recvGetDataTimeToLive() -} - -func (p *ZipkinQueryClient) sendGetDataTimeToLive() (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("getDataTimeToLive", thrift.CALL, p.SeqId); err != nil { - return - } - args := GetDataTimeToLiveArgs{} - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvGetDataTimeToLive() (value int32, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error36 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error37 error - error37, err = error36.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error37 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getDataTimeToLive failed: out of sequence response") - return - } - result := GetDataTimeToLiveResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.Qe != nil { - err = result.Qe - return - } - value = result.GetSuccess() - return -} - -// Get an aggregate representation of all services paired with every service they call in to. -// This includes information on call counts and mean/stdDev/etc of call durations. The two arguments -// specify epoch time in microseconds. The end time is optional and defaults to one day after the -// start time. -// -// Parameters: -// - StartTime -// - EndTime -func (p *ZipkinQueryClient) GetDependencies(start_time int64, end_time int64) (r *zipkindependencies.Dependencies, err error) { - if err = p.sendGetDependencies(start_time, end_time); err != nil { - return - } - return p.recvGetDependencies() -} - -func (p *ZipkinQueryClient) sendGetDependencies(start_time int64, end_time int64) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("getDependencies", thrift.CALL, p.SeqId); err != nil { - return - } - args := GetDependenciesArgs{ - StartTime: start_time, - EndTime: end_time, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvGetDependencies() (value *zipkindependencies.Dependencies, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error38 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error39 error - error39, err = error38.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error39 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getDependencies failed: out of sequence response") - return - } - result := GetDependenciesResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.Qe != nil { - err = result.Qe - return - } - value = result.GetSuccess() - return -} - -// Parameters: -// - ServiceName -func (p *ZipkinQueryClient) GetTopAnnotations(service_name string) (r []string, err error) { - if err = p.sendGetTopAnnotations(service_name); err != nil { - return - } - return p.recvGetTopAnnotations() -} - -func (p *ZipkinQueryClient) sendGetTopAnnotations(service_name string) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("getTopAnnotations", thrift.CALL, p.SeqId); err != nil { - return - } - args := GetTopAnnotationsArgs{ - ServiceName: service_name, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvGetTopAnnotations() (value []string, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error40 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error41 error - error41, err = error40.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error41 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTopAnnotations failed: out of sequence response") - return - } - result := GetTopAnnotationsResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.Qe != nil { - err = result.Qe - return - } - value = result.GetSuccess() - return -} - -// Parameters: -// - ServiceName -func (p *ZipkinQueryClient) GetTopKeyValueAnnotations(service_name string) (r []string, err error) { - if err = p.sendGetTopKeyValueAnnotations(service_name); err != nil { - return - } - return p.recvGetTopKeyValueAnnotations() -} - -func (p *ZipkinQueryClient) sendGetTopKeyValueAnnotations(service_name string) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("getTopKeyValueAnnotations", thrift.CALL, p.SeqId); err != nil { - return - } - args := GetTopKeyValueAnnotationsArgs{ - ServiceName: service_name, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvGetTopKeyValueAnnotations() (value []string, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error42 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error43 error - error43, err = error42.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error43 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTopKeyValueAnnotations failed: out of sequence response") - return - } - result := GetTopKeyValueAnnotationsResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - if result.Qe != nil { - err = result.Qe - return - } - value = result.GetSuccess() - return -} - -// Given a time stamp, server service name, and rpc name, fetch all of the client services calling in paired -// with the lists of every span duration (list) from the server to client. The lists of span durations -// include information on call counts and mean/stdDev/etc of call durations. -// -// The three arguments specify epoch time in microseconds, server side service name and rpc name. The return maps -// contains the key - client_service_name and value - list. -// -// Parameters: -// - TimeStamp -// - ServiceName -// - RpcName -func (p *ZipkinQueryClient) GetSpanDurations(time_stamp int64, service_name string, rpc_name string) (r map[string][]int64, err error) { - if err = p.sendGetSpanDurations(time_stamp, service_name, rpc_name); err != nil { - return - } - return p.recvGetSpanDurations() -} - -func (p *ZipkinQueryClient) sendGetSpanDurations(time_stamp int64, service_name string, rpc_name string) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("getSpanDurations", thrift.CALL, p.SeqId); err != nil { - return - } - args := GetSpanDurationsArgs{ - TimeStamp: time_stamp, - ServiceName: service_name, - RpcName: rpc_name, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvGetSpanDurations() (value map[string][]int64, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error44 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error45 error - error45, err = error44.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error45 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getSpanDurations failed: out of sequence response") - return - } - result := GetSpanDurationsResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - value = result.GetSuccess() - return -} - -// Given a time stamp, server service name, and rpc name, fetch all of the client services calling in paired -// with the lists of every trace Ids (list) from the server to client. -// -// The three arguments specify epoch time in microseconds, server side service name and rpc name. The return maps -// contains the key - client_service_name and value - list. -// -// Parameters: -// - TimeStamp -// - ServiceName -// - RpcName -func (p *ZipkinQueryClient) GetServiceNamesToTraceIds(time_stamp int64, service_name string, rpc_name string) (r map[string][]int64, err error) { - if err = p.sendGetServiceNamesToTraceIds(time_stamp, service_name, rpc_name); err != nil { - return - } - return p.recvGetServiceNamesToTraceIds() -} - -func (p *ZipkinQueryClient) sendGetServiceNamesToTraceIds(time_stamp int64, service_name string, rpc_name string) (err error) { - oprot := p.OutputProtocol - if oprot == nil { - oprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.OutputProtocol = oprot - } - p.SeqId++ - if err = oprot.WriteMessageBegin("getServiceNamesToTraceIds", thrift.CALL, p.SeqId); err != nil { - return - } - args := GetServiceNamesToTraceIdsArgs{ - TimeStamp: time_stamp, - ServiceName: service_name, - RpcName: rpc_name, - } - if err = args.Write(oprot); err != nil { - return - } - if err = oprot.WriteMessageEnd(); err != nil { - return - } - return oprot.Flush() -} - -func (p *ZipkinQueryClient) recvGetServiceNamesToTraceIds() (value map[string][]int64, err error) { - iprot := p.InputProtocol - if iprot == nil { - iprot = p.ProtocolFactory.GetProtocol(p.Transport) - p.InputProtocol = iprot - } - _, mTypeId, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return - } - if mTypeId == thrift.EXCEPTION { - error46 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception") - var error47 error - error47, err = error46.Read(iprot) - if err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - err = error47 - return - } - if p.SeqId != seqId { - err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getServiceNamesToTraceIds failed: out of sequence response") - return - } - result := GetServiceNamesToTraceIdsResult{} - if err = result.Read(iprot); err != nil { - return - } - if err = iprot.ReadMessageEnd(); err != nil { - return - } - value = result.GetSuccess() - return -} - -type ZipkinQueryProcessor struct { - processorMap map[string]thrift.TProcessorFunction - handler ZipkinQuery -} - -func (p *ZipkinQueryProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { - p.processorMap[key] = processor -} - -func (p *ZipkinQueryProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { - processor, ok = p.processorMap[key] - return processor, ok -} - -func (p *ZipkinQueryProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { - return p.processorMap -} - -func NewZipkinQueryProcessor(handler ZipkinQuery) *ZipkinQueryProcessor { - - self48 := &ZipkinQueryProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} - self48.processorMap["getTraceIds"] = &zipkinQueryProcessorGetTraceIds{handler: handler} - self48.processorMap["getTraceIdsBySpanName"] = &zipkinQueryProcessorGetTraceIdsBySpanName{handler: handler} - self48.processorMap["getTraceIdsByServiceName"] = &zipkinQueryProcessorGetTraceIdsByServiceName{handler: handler} - self48.processorMap["getTraceIdsByAnnotation"] = &zipkinQueryProcessorGetTraceIdsByAnnotation{handler: handler} - self48.processorMap["tracesExist"] = &zipkinQueryProcessorTracesExist{handler: handler} - self48.processorMap["getTracesByIds"] = &zipkinQueryProcessorGetTracesByIds{handler: handler} - self48.processorMap["getTraceTimelinesByIds"] = &zipkinQueryProcessorGetTraceTimelinesByIds{handler: handler} - self48.processorMap["getTraceSummariesByIds"] = &zipkinQueryProcessorGetTraceSummariesByIds{handler: handler} - self48.processorMap["getTraceCombosByIds"] = &zipkinQueryProcessorGetTraceCombosByIds{handler: handler} - self48.processorMap["getServiceNames"] = &zipkinQueryProcessorGetServiceNames{handler: handler} - self48.processorMap["getSpanNames"] = &zipkinQueryProcessorGetSpanNames{handler: handler} - self48.processorMap["setTraceTimeToLive"] = &zipkinQueryProcessorSetTraceTimeToLive{handler: handler} - self48.processorMap["getTraceTimeToLive"] = &zipkinQueryProcessorGetTraceTimeToLive{handler: handler} - self48.processorMap["getDataTimeToLive"] = &zipkinQueryProcessorGetDataTimeToLive{handler: handler} - self48.processorMap["getDependencies"] = &zipkinQueryProcessorGetDependencies{handler: handler} - self48.processorMap["getTopAnnotations"] = &zipkinQueryProcessorGetTopAnnotations{handler: handler} - self48.processorMap["getTopKeyValueAnnotations"] = &zipkinQueryProcessorGetTopKeyValueAnnotations{handler: handler} - self48.processorMap["getSpanDurations"] = &zipkinQueryProcessorGetSpanDurations{handler: handler} - self48.processorMap["getServiceNamesToTraceIds"] = &zipkinQueryProcessorGetServiceNamesToTraceIds{handler: handler} - return self48 -} - -func (p *ZipkinQueryProcessor) Process(iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - name, _, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return false, err - } - if processor, ok := p.GetProcessorFunction(name); ok { - return processor.Process(seqId, iprot, oprot) - } - iprot.Skip(thrift.STRUCT) - iprot.ReadMessageEnd() - x49 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) - oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) - x49.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, x49 - -} - -type zipkinQueryProcessorGetTraceIds struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorGetTraceIds) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := GetTraceIdsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getTraceIds", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := GetTraceIdsResult{} - var retval *QueryResponse - var err2 error - if retval, err2 = p.handler.GetTraceIds(args.Request); err2 != nil { - switch v := err2.(type) { - case *QueryException: - result.Qe = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTraceIds: "+err2.Error()) - oprot.WriteMessageBegin("getTraceIds", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("getTraceIds", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorGetTraceIdsBySpanName struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorGetTraceIdsBySpanName) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := GetTraceIdsBySpanNameArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getTraceIdsBySpanName", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := GetTraceIdsBySpanNameResult{} - var retval []int64 - var err2 error - if retval, err2 = p.handler.GetTraceIdsBySpanName(args.ServiceName, args.SpanName, args.EndTs, args.Limit, args.Order); err2 != nil { - switch v := err2.(type) { - case *QueryException: - result.Qe = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTraceIdsBySpanName: "+err2.Error()) - oprot.WriteMessageBegin("getTraceIdsBySpanName", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("getTraceIdsBySpanName", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorGetTraceIdsByServiceName struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorGetTraceIdsByServiceName) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := GetTraceIdsByServiceNameArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getTraceIdsByServiceName", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := GetTraceIdsByServiceNameResult{} - var retval []int64 - var err2 error - if retval, err2 = p.handler.GetTraceIdsByServiceName(args.ServiceName, args.EndTs, args.Limit, args.Order); err2 != nil { - switch v := err2.(type) { - case *QueryException: - result.Qe = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTraceIdsByServiceName: "+err2.Error()) - oprot.WriteMessageBegin("getTraceIdsByServiceName", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("getTraceIdsByServiceName", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorGetTraceIdsByAnnotation struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorGetTraceIdsByAnnotation) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := GetTraceIdsByAnnotationArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getTraceIdsByAnnotation", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := GetTraceIdsByAnnotationResult{} - var retval []int64 - var err2 error - if retval, err2 = p.handler.GetTraceIdsByAnnotation(args.ServiceName, args.Annotation, args.Value, args.EndTs, args.Limit, args.Order); err2 != nil { - switch v := err2.(type) { - case *QueryException: - result.Qe = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTraceIdsByAnnotation: "+err2.Error()) - oprot.WriteMessageBegin("getTraceIdsByAnnotation", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("getTraceIdsByAnnotation", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorTracesExist struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorTracesExist) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := TracesExistArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("tracesExist", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := TracesExistResult{} - var retval map[int64]bool - var err2 error - if retval, err2 = p.handler.TracesExist(args.TraceIds); err2 != nil { - switch v := err2.(type) { - case *QueryException: - result.Qe = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing tracesExist: "+err2.Error()) - oprot.WriteMessageBegin("tracesExist", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("tracesExist", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorGetTracesByIds struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorGetTracesByIds) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := GetTracesByIdsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getTracesByIds", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := GetTracesByIdsResult{} - var retval []*Trace - var err2 error - if retval, err2 = p.handler.GetTracesByIds(args.TraceIds, args.Adjust); err2 != nil { - switch v := err2.(type) { - case *QueryException: - result.Qe = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTracesByIds: "+err2.Error()) - oprot.WriteMessageBegin("getTracesByIds", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("getTracesByIds", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorGetTraceTimelinesByIds struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorGetTraceTimelinesByIds) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := GetTraceTimelinesByIdsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getTraceTimelinesByIds", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := GetTraceTimelinesByIdsResult{} - var retval []*TraceTimeline - var err2 error - if retval, err2 = p.handler.GetTraceTimelinesByIds(args.TraceIds, args.Adjust); err2 != nil { - switch v := err2.(type) { - case *QueryException: - result.Qe = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTraceTimelinesByIds: "+err2.Error()) - oprot.WriteMessageBegin("getTraceTimelinesByIds", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("getTraceTimelinesByIds", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorGetTraceSummariesByIds struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorGetTraceSummariesByIds) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := GetTraceSummariesByIdsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getTraceSummariesByIds", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := GetTraceSummariesByIdsResult{} - var retval []*TraceSummary - var err2 error - if retval, err2 = p.handler.GetTraceSummariesByIds(args.TraceIds, args.Adjust); err2 != nil { - switch v := err2.(type) { - case *QueryException: - result.Qe = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTraceSummariesByIds: "+err2.Error()) - oprot.WriteMessageBegin("getTraceSummariesByIds", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("getTraceSummariesByIds", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorGetTraceCombosByIds struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorGetTraceCombosByIds) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := GetTraceCombosByIdsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getTraceCombosByIds", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := GetTraceCombosByIdsResult{} - var retval []*TraceCombo - var err2 error - if retval, err2 = p.handler.GetTraceCombosByIds(args.TraceIds, args.Adjust); err2 != nil { - switch v := err2.(type) { - case *QueryException: - result.Qe = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTraceCombosByIds: "+err2.Error()) - oprot.WriteMessageBegin("getTraceCombosByIds", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("getTraceCombosByIds", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorGetServiceNames struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorGetServiceNames) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := GetServiceNamesArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getServiceNames", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := GetServiceNamesResult{} - var retval map[string]bool - var err2 error - if retval, err2 = p.handler.GetServiceNames(); err2 != nil { - switch v := err2.(type) { - case *QueryException: - result.Qe = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getServiceNames: "+err2.Error()) - oprot.WriteMessageBegin("getServiceNames", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("getServiceNames", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorGetSpanNames struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorGetSpanNames) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := GetSpanNamesArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getSpanNames", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := GetSpanNamesResult{} - var retval map[string]bool - var err2 error - if retval, err2 = p.handler.GetSpanNames(args.ServiceName); err2 != nil { - switch v := err2.(type) { - case *QueryException: - result.Qe = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getSpanNames: "+err2.Error()) - oprot.WriteMessageBegin("getSpanNames", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("getSpanNames", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorSetTraceTimeToLive struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorSetTraceTimeToLive) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := SetTraceTimeToLiveArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("setTraceTimeToLive", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := SetTraceTimeToLiveResult{} - var err2 error - if err2 = p.handler.SetTraceTimeToLive(args.TraceId, args.TtlSeconds); err2 != nil { - switch v := err2.(type) { - case *QueryException: - result.Qe = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing setTraceTimeToLive: "+err2.Error()) - oprot.WriteMessageBegin("setTraceTimeToLive", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } - if err2 = oprot.WriteMessageBegin("setTraceTimeToLive", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorGetTraceTimeToLive struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorGetTraceTimeToLive) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := GetTraceTimeToLiveArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getTraceTimeToLive", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := GetTraceTimeToLiveResult{} - var retval int32 - var err2 error - if retval, err2 = p.handler.GetTraceTimeToLive(args.TraceId); err2 != nil { - switch v := err2.(type) { - case *QueryException: - result.Qe = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTraceTimeToLive: "+err2.Error()) - oprot.WriteMessageBegin("getTraceTimeToLive", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } else { - result.Success = &retval - } - if err2 = oprot.WriteMessageBegin("getTraceTimeToLive", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorGetDataTimeToLive struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorGetDataTimeToLive) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := GetDataTimeToLiveArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getDataTimeToLive", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := GetDataTimeToLiveResult{} - var retval int32 - var err2 error - if retval, err2 = p.handler.GetDataTimeToLive(); err2 != nil { - switch v := err2.(type) { - case *QueryException: - result.Qe = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getDataTimeToLive: "+err2.Error()) - oprot.WriteMessageBegin("getDataTimeToLive", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } else { - result.Success = &retval - } - if err2 = oprot.WriteMessageBegin("getDataTimeToLive", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorGetDependencies struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorGetDependencies) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := GetDependenciesArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getDependencies", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := GetDependenciesResult{} - var retval *zipkindependencies.Dependencies - var err2 error - if retval, err2 = p.handler.GetDependencies(args.StartTime, args.EndTime); err2 != nil { - switch v := err2.(type) { - case *QueryException: - result.Qe = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getDependencies: "+err2.Error()) - oprot.WriteMessageBegin("getDependencies", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("getDependencies", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorGetTopAnnotations struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorGetTopAnnotations) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := GetTopAnnotationsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getTopAnnotations", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := GetTopAnnotationsResult{} - var retval []string - var err2 error - if retval, err2 = p.handler.GetTopAnnotations(args.ServiceName); err2 != nil { - switch v := err2.(type) { - case *QueryException: - result.Qe = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTopAnnotations: "+err2.Error()) - oprot.WriteMessageBegin("getTopAnnotations", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("getTopAnnotations", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorGetTopKeyValueAnnotations struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorGetTopKeyValueAnnotations) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := GetTopKeyValueAnnotationsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getTopKeyValueAnnotations", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := GetTopKeyValueAnnotationsResult{} - var retval []string - var err2 error - if retval, err2 = p.handler.GetTopKeyValueAnnotations(args.ServiceName); err2 != nil { - switch v := err2.(type) { - case *QueryException: - result.Qe = v - default: - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTopKeyValueAnnotations: "+err2.Error()) - oprot.WriteMessageBegin("getTopKeyValueAnnotations", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("getTopKeyValueAnnotations", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorGetSpanDurations struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorGetSpanDurations) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := GetSpanDurationsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getSpanDurations", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := GetSpanDurationsResult{} - var retval map[string][]int64 - var err2 error - if retval, err2 = p.handler.GetSpanDurations(args.TimeStamp, args.ServiceName, args.RpcName); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getSpanDurations: "+err2.Error()) - oprot.WriteMessageBegin("getSpanDurations", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("getSpanDurations", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -type zipkinQueryProcessorGetServiceNamesToTraceIds struct { - handler ZipkinQuery -} - -func (p *zipkinQueryProcessorGetServiceNamesToTraceIds) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := GetServiceNamesToTraceIdsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("getServiceNamesToTraceIds", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return false, err - } - - iprot.ReadMessageEnd() - result := GetServiceNamesToTraceIdsResult{} - var retval map[string][]int64 - var err2 error - if retval, err2 = p.handler.GetServiceNamesToTraceIds(args.TimeStamp, args.ServiceName, args.RpcName); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getServiceNamesToTraceIds: "+err2.Error()) - oprot.WriteMessageBegin("getServiceNamesToTraceIds", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush() - return true, err2 - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("getServiceNamesToTraceIds", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} - -// HELPER FUNCTIONS AND STRUCTURES - -type GetTraceIdsArgs struct { - Request *QueryRequest `thrift:"request,1" json:"request"` -} - -func NewGetTraceIdsArgs() *GetTraceIdsArgs { - return &GetTraceIdsArgs{} -} - -var GetTraceIdsArgs_Request_DEFAULT *QueryRequest - -func (p *GetTraceIdsArgs) GetRequest() *QueryRequest { - if !p.IsSetRequest() { - return GetTraceIdsArgs_Request_DEFAULT - } - return p.Request -} -func (p *GetTraceIdsArgs) IsSetRequest() bool { - return p.Request != nil -} - -func (p *GetTraceIdsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTraceIdsArgs) ReadField1(iprot thrift.TProtocol) error { - p.Request = &QueryRequest{} - if err := p.Request.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Request, err) - } - return nil -} - -func (p *GetTraceIdsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTraceIds_args"); 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTraceIdsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("request", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:request: %s", p, err) - } - if err := p.Request.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Request, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:request: %s", p, err) - } - return err -} - -func (p *GetTraceIdsArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTraceIdsArgs(%+v)", *p) -} - -type GetTraceIdsResult struct { - Success *QueryResponse `thrift:"success,0" json:"success"` - Qe *QueryException `thrift:"qe,1" json:"qe"` -} - -func NewGetTraceIdsResult() *GetTraceIdsResult { - return &GetTraceIdsResult{} -} - -var GetTraceIdsResult_Success_DEFAULT *QueryResponse - -func (p *GetTraceIdsResult) GetSuccess() *QueryResponse { - if !p.IsSetSuccess() { - return GetTraceIdsResult_Success_DEFAULT - } - return p.Success -} - -var GetTraceIdsResult_Qe_DEFAULT *QueryException - -func (p *GetTraceIdsResult) GetQe() *QueryException { - if !p.IsSetQe() { - return GetTraceIdsResult_Qe_DEFAULT - } - return p.Qe -} -func (p *GetTraceIdsResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GetTraceIdsResult) IsSetQe() bool { - return p.Qe != nil -} - -func (p *GetTraceIdsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTraceIdsResult) ReadField0(iprot thrift.TProtocol) error { - p.Success = &QueryResponse{} - if err := p.Success.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Success, err) - } - return nil -} - -func (p *GetTraceIdsResult) ReadField1(iprot thrift.TProtocol) error { - p.Qe = &QueryException{} - if err := p.Qe.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Qe, err) - } - return nil -} - -func (p *GetTraceIdsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTraceIds_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTraceIdsResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := p.Success.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Success, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *GetTraceIdsResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetQe() { - if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:qe: %s", p, err) - } - if err := p.Qe.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Qe, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:qe: %s", p, err) - } - } - return err -} - -func (p *GetTraceIdsResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTraceIdsResult(%+v)", *p) -} - -type GetTraceIdsBySpanNameArgs struct { - ServiceName string `thrift:"service_name,1" json:"service_name"` - SpanName string `thrift:"span_name,2" json:"span_name"` - // unused field # 3 - EndTs int64 `thrift:"end_ts,4" json:"end_ts"` - Limit int32 `thrift:"limit,5" json:"limit"` - Order Order `thrift:"order,6" json:"order"` -} - -func NewGetTraceIdsBySpanNameArgs() *GetTraceIdsBySpanNameArgs { - return &GetTraceIdsBySpanNameArgs{} -} - -func (p *GetTraceIdsBySpanNameArgs) GetServiceName() string { - return p.ServiceName -} - -func (p *GetTraceIdsBySpanNameArgs) GetSpanName() string { - return p.SpanName -} - -func (p *GetTraceIdsBySpanNameArgs) GetEndTs() int64 { - return p.EndTs -} - -func (p *GetTraceIdsBySpanNameArgs) GetLimit() int32 { - return p.Limit -} - -func (p *GetTraceIdsBySpanNameArgs) GetOrder() Order { - return p.Order -} -func (p *GetTraceIdsBySpanNameArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - case 4: - if err := p.ReadField4(iprot); err != nil { - return err - } - case 5: - if err := p.ReadField5(iprot); err != nil { - return err - } - case 6: - if err := p.ReadField6(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTraceIdsBySpanNameArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.ServiceName = v - } - return nil -} - -func (p *GetTraceIdsBySpanNameArgs) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.SpanName = v - } - return nil -} - -func (p *GetTraceIdsBySpanNameArgs) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 4: %s", err) - } else { - p.EndTs = v - } - return nil -} - -func (p *GetTraceIdsBySpanNameArgs) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 5: %s", err) - } else { - p.Limit = v - } - return nil -} - -func (p *GetTraceIdsBySpanNameArgs) ReadField6(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 6: %s", err) - } else { - temp := Order(v) - p.Order = temp - } - return nil -} - -func (p *GetTraceIdsBySpanNameArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTraceIdsBySpanName_args"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := p.writeField2(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 := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTraceIdsBySpanNameArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err) - } - if err := oprot.WriteString(string(p.ServiceName)); err != nil { - return fmt.Errorf("%T.service_name (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:service_name: %s", p, err) - } - return err -} - -func (p *GetTraceIdsBySpanNameArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("span_name", thrift.STRING, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:span_name: %s", p, err) - } - if err := oprot.WriteString(string(p.SpanName)); err != nil { - return fmt.Errorf("%T.span_name (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:span_name: %s", p, err) - } - return err -} - -func (p *GetTraceIdsBySpanNameArgs) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("end_ts", thrift.I64, 4); err != nil { - return fmt.Errorf("%T write field begin error 4:end_ts: %s", p, err) - } - if err := oprot.WriteI64(int64(p.EndTs)); err != nil { - return fmt.Errorf("%T.end_ts (4) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 4:end_ts: %s", p, err) - } - return err -} - -func (p *GetTraceIdsBySpanNameArgs) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("limit", thrift.I32, 5); err != nil { - return fmt.Errorf("%T write field begin error 5:limit: %s", p, err) - } - if err := oprot.WriteI32(int32(p.Limit)); err != nil { - return fmt.Errorf("%T.limit (5) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 5:limit: %s", p, err) - } - return err -} - -func (p *GetTraceIdsBySpanNameArgs) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("order", thrift.I32, 6); err != nil { - return fmt.Errorf("%T write field begin error 6:order: %s", p, err) - } - if err := oprot.WriteI32(int32(p.Order)); err != nil { - return fmt.Errorf("%T.order (6) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 6:order: %s", p, err) - } - return err -} - -func (p *GetTraceIdsBySpanNameArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTraceIdsBySpanNameArgs(%+v)", *p) -} - -type GetTraceIdsBySpanNameResult struct { - Success []int64 `thrift:"success,0" json:"success"` - Qe *QueryException `thrift:"qe,1" json:"qe"` -} - -func NewGetTraceIdsBySpanNameResult() *GetTraceIdsBySpanNameResult { - return &GetTraceIdsBySpanNameResult{} -} - -var GetTraceIdsBySpanNameResult_Success_DEFAULT []int64 - -func (p *GetTraceIdsBySpanNameResult) GetSuccess() []int64 { - return p.Success -} - -var GetTraceIdsBySpanNameResult_Qe_DEFAULT *QueryException - -func (p *GetTraceIdsBySpanNameResult) GetQe() *QueryException { - if !p.IsSetQe() { - return GetTraceIdsBySpanNameResult_Qe_DEFAULT - } - return p.Qe -} -func (p *GetTraceIdsBySpanNameResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GetTraceIdsBySpanNameResult) IsSetQe() bool { - return p.Qe != nil -} - -func (p *GetTraceIdsBySpanNameResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTraceIdsBySpanNameResult) ReadField0(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]int64, 0, size) - p.Success = tSlice - for i := 0; i < size; i++ { - var _elem50 int64 - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem50 = v - } - p.Success = append(p.Success, _elem50) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *GetTraceIdsBySpanNameResult) ReadField1(iprot thrift.TProtocol) error { - p.Qe = &QueryException{} - if err := p.Qe.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Qe, err) - } - return nil -} - -func (p *GetTraceIdsBySpanNameResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTraceIdsBySpanName_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTraceIdsBySpanNameResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.I64, len(p.Success)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Success { - if err := oprot.WriteI64(int64(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *GetTraceIdsBySpanNameResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetQe() { - if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:qe: %s", p, err) - } - if err := p.Qe.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Qe, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:qe: %s", p, err) - } - } - return err -} - -func (p *GetTraceIdsBySpanNameResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTraceIdsBySpanNameResult(%+v)", *p) -} - -type GetTraceIdsByServiceNameArgs struct { - ServiceName string `thrift:"service_name,1" json:"service_name"` - // unused field # 2 - EndTs int64 `thrift:"end_ts,3" json:"end_ts"` - Limit int32 `thrift:"limit,4" json:"limit"` - Order Order `thrift:"order,5" json:"order"` -} - -func NewGetTraceIdsByServiceNameArgs() *GetTraceIdsByServiceNameArgs { - return &GetTraceIdsByServiceNameArgs{} -} - -func (p *GetTraceIdsByServiceNameArgs) GetServiceName() string { - return p.ServiceName -} - -func (p *GetTraceIdsByServiceNameArgs) GetEndTs() int64 { - return p.EndTs -} - -func (p *GetTraceIdsByServiceNameArgs) GetLimit() int32 { - return p.Limit -} - -func (p *GetTraceIdsByServiceNameArgs) GetOrder() Order { - return p.Order -} -func (p *GetTraceIdsByServiceNameArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } - case 4: - if err := p.ReadField4(iprot); err != nil { - return err - } - case 5: - if err := p.ReadField5(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTraceIdsByServiceNameArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.ServiceName = v - } - return nil -} - -func (p *GetTraceIdsByServiceNameArgs) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 3: %s", err) - } else { - p.EndTs = v - } - return nil -} - -func (p *GetTraceIdsByServiceNameArgs) ReadField4(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 4: %s", err) - } else { - p.Limit = v - } - return nil -} - -func (p *GetTraceIdsByServiceNameArgs) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 5: %s", err) - } else { - temp := Order(v) - p.Order = temp - } - return nil -} - -func (p *GetTraceIdsByServiceNameArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTraceIdsByServiceName_args"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - 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 := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTraceIdsByServiceNameArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err) - } - if err := oprot.WriteString(string(p.ServiceName)); err != nil { - return fmt.Errorf("%T.service_name (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:service_name: %s", p, err) - } - return err -} - -func (p *GetTraceIdsByServiceNameArgs) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("end_ts", thrift.I64, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:end_ts: %s", p, err) - } - if err := oprot.WriteI64(int64(p.EndTs)); err != nil { - return fmt.Errorf("%T.end_ts (3) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:end_ts: %s", p, err) - } - return err -} - -func (p *GetTraceIdsByServiceNameArgs) writeField4(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("limit", thrift.I32, 4); err != nil { - return fmt.Errorf("%T write field begin error 4:limit: %s", p, err) - } - if err := oprot.WriteI32(int32(p.Limit)); err != nil { - return fmt.Errorf("%T.limit (4) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 4:limit: %s", p, err) - } - return err -} - -func (p *GetTraceIdsByServiceNameArgs) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("order", thrift.I32, 5); err != nil { - return fmt.Errorf("%T write field begin error 5:order: %s", p, err) - } - if err := oprot.WriteI32(int32(p.Order)); err != nil { - return fmt.Errorf("%T.order (5) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 5:order: %s", p, err) - } - return err -} - -func (p *GetTraceIdsByServiceNameArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTraceIdsByServiceNameArgs(%+v)", *p) -} - -type GetTraceIdsByServiceNameResult struct { - Success []int64 `thrift:"success,0" json:"success"` - Qe *QueryException `thrift:"qe,1" json:"qe"` -} - -func NewGetTraceIdsByServiceNameResult() *GetTraceIdsByServiceNameResult { - return &GetTraceIdsByServiceNameResult{} -} - -var GetTraceIdsByServiceNameResult_Success_DEFAULT []int64 - -func (p *GetTraceIdsByServiceNameResult) GetSuccess() []int64 { - return p.Success -} - -var GetTraceIdsByServiceNameResult_Qe_DEFAULT *QueryException - -func (p *GetTraceIdsByServiceNameResult) GetQe() *QueryException { - if !p.IsSetQe() { - return GetTraceIdsByServiceNameResult_Qe_DEFAULT - } - return p.Qe -} -func (p *GetTraceIdsByServiceNameResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GetTraceIdsByServiceNameResult) IsSetQe() bool { - return p.Qe != nil -} - -func (p *GetTraceIdsByServiceNameResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTraceIdsByServiceNameResult) ReadField0(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]int64, 0, size) - p.Success = tSlice - for i := 0; i < size; i++ { - var _elem51 int64 - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem51 = v - } - p.Success = append(p.Success, _elem51) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *GetTraceIdsByServiceNameResult) ReadField1(iprot thrift.TProtocol) error { - p.Qe = &QueryException{} - if err := p.Qe.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Qe, err) - } - return nil -} - -func (p *GetTraceIdsByServiceNameResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTraceIdsByServiceName_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTraceIdsByServiceNameResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.I64, len(p.Success)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Success { - if err := oprot.WriteI64(int64(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *GetTraceIdsByServiceNameResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetQe() { - if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:qe: %s", p, err) - } - if err := p.Qe.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Qe, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:qe: %s", p, err) - } - } - return err -} - -func (p *GetTraceIdsByServiceNameResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTraceIdsByServiceNameResult(%+v)", *p) -} - -type GetTraceIdsByAnnotationArgs struct { - ServiceName string `thrift:"service_name,1" json:"service_name"` - Annotation string `thrift:"annotation,2" json:"annotation"` - Value []byte `thrift:"value,3" json:"value"` - // unused field # 4 - EndTs int64 `thrift:"end_ts,5" json:"end_ts"` - Limit int32 `thrift:"limit,6" json:"limit"` - Order Order `thrift:"order,7" json:"order"` -} - -func NewGetTraceIdsByAnnotationArgs() *GetTraceIdsByAnnotationArgs { - return &GetTraceIdsByAnnotationArgs{} -} - -func (p *GetTraceIdsByAnnotationArgs) GetServiceName() string { - return p.ServiceName -} - -func (p *GetTraceIdsByAnnotationArgs) GetAnnotation() string { - return p.Annotation -} - -func (p *GetTraceIdsByAnnotationArgs) GetValue() []byte { - return p.Value -} - -func (p *GetTraceIdsByAnnotationArgs) GetEndTs() int64 { - return p.EndTs -} - -func (p *GetTraceIdsByAnnotationArgs) GetLimit() int32 { - return p.Limit -} - -func (p *GetTraceIdsByAnnotationArgs) GetOrder() Order { - return p.Order -} -func (p *GetTraceIdsByAnnotationArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } - case 5: - if err := p.ReadField5(iprot); err != nil { - return err - } - case 6: - if err := p.ReadField6(iprot); err != nil { - return err - } - case 7: - if err := p.ReadField7(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTraceIdsByAnnotationArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.ServiceName = v - } - return nil -} - -func (p *GetTraceIdsByAnnotationArgs) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.Annotation = v - } - return nil -} - -func (p *GetTraceIdsByAnnotationArgs) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadBinary(); err != nil { - return fmt.Errorf("error reading field 3: %s", err) - } else { - p.Value = v - } - return nil -} - -func (p *GetTraceIdsByAnnotationArgs) ReadField5(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 5: %s", err) - } else { - p.EndTs = v - } - return nil -} - -func (p *GetTraceIdsByAnnotationArgs) ReadField6(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 6: %s", err) - } else { - p.Limit = v - } - return nil -} - -func (p *GetTraceIdsByAnnotationArgs) ReadField7(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 7: %s", err) - } else { - temp := Order(v) - p.Order = temp - } - return nil -} - -func (p *GetTraceIdsByAnnotationArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTraceIdsByAnnotation_args"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - 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.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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTraceIdsByAnnotationArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err) - } - if err := oprot.WriteString(string(p.ServiceName)); err != nil { - return fmt.Errorf("%T.service_name (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:service_name: %s", p, err) - } - return err -} - -func (p *GetTraceIdsByAnnotationArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("annotation", thrift.STRING, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:annotation: %s", p, err) - } - if err := oprot.WriteString(string(p.Annotation)); err != nil { - return fmt.Errorf("%T.annotation (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:annotation: %s", p, err) - } - return err -} - -func (p *GetTraceIdsByAnnotationArgs) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("value", thrift.STRING, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:value: %s", p, err) - } - if err := oprot.WriteBinary(p.Value); err != nil { - return fmt.Errorf("%T.value (3) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:value: %s", p, err) - } - return err -} - -func (p *GetTraceIdsByAnnotationArgs) writeField5(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("end_ts", thrift.I64, 5); err != nil { - return fmt.Errorf("%T write field begin error 5:end_ts: %s", p, err) - } - if err := oprot.WriteI64(int64(p.EndTs)); err != nil { - return fmt.Errorf("%T.end_ts (5) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 5:end_ts: %s", p, err) - } - return err -} - -func (p *GetTraceIdsByAnnotationArgs) writeField6(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("limit", thrift.I32, 6); err != nil { - return fmt.Errorf("%T write field begin error 6:limit: %s", p, err) - } - if err := oprot.WriteI32(int32(p.Limit)); err != nil { - return fmt.Errorf("%T.limit (6) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 6:limit: %s", p, err) - } - return err -} - -func (p *GetTraceIdsByAnnotationArgs) writeField7(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("order", thrift.I32, 7); err != nil { - return fmt.Errorf("%T write field begin error 7:order: %s", p, err) - } - if err := oprot.WriteI32(int32(p.Order)); err != nil { - return fmt.Errorf("%T.order (7) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 7:order: %s", p, err) - } - return err -} - -func (p *GetTraceIdsByAnnotationArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTraceIdsByAnnotationArgs(%+v)", *p) -} - -type GetTraceIdsByAnnotationResult struct { - Success []int64 `thrift:"success,0" json:"success"` - Qe *QueryException `thrift:"qe,1" json:"qe"` -} - -func NewGetTraceIdsByAnnotationResult() *GetTraceIdsByAnnotationResult { - return &GetTraceIdsByAnnotationResult{} -} - -var GetTraceIdsByAnnotationResult_Success_DEFAULT []int64 - -func (p *GetTraceIdsByAnnotationResult) GetSuccess() []int64 { - return p.Success -} - -var GetTraceIdsByAnnotationResult_Qe_DEFAULT *QueryException - -func (p *GetTraceIdsByAnnotationResult) GetQe() *QueryException { - if !p.IsSetQe() { - return GetTraceIdsByAnnotationResult_Qe_DEFAULT - } - return p.Qe -} -func (p *GetTraceIdsByAnnotationResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GetTraceIdsByAnnotationResult) IsSetQe() bool { - return p.Qe != nil -} - -func (p *GetTraceIdsByAnnotationResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTraceIdsByAnnotationResult) ReadField0(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]int64, 0, size) - p.Success = tSlice - for i := 0; i < size; i++ { - var _elem52 int64 - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem52 = v - } - p.Success = append(p.Success, _elem52) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *GetTraceIdsByAnnotationResult) ReadField1(iprot thrift.TProtocol) error { - p.Qe = &QueryException{} - if err := p.Qe.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Qe, err) - } - return nil -} - -func (p *GetTraceIdsByAnnotationResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTraceIdsByAnnotation_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTraceIdsByAnnotationResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.I64, len(p.Success)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Success { - if err := oprot.WriteI64(int64(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *GetTraceIdsByAnnotationResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetQe() { - if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:qe: %s", p, err) - } - if err := p.Qe.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Qe, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:qe: %s", p, err) - } - } - return err -} - -func (p *GetTraceIdsByAnnotationResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTraceIdsByAnnotationResult(%+v)", *p) -} - -type TracesExistArgs struct { - TraceIds []int64 `thrift:"trace_ids,1" json:"trace_ids"` -} - -func NewTracesExistArgs() *TracesExistArgs { - return &TracesExistArgs{} -} - -func (p *TracesExistArgs) GetTraceIds() []int64 { - return p.TraceIds -} -func (p *TracesExistArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *TracesExistArgs) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]int64, 0, size) - p.TraceIds = tSlice - for i := 0; i < size; i++ { - var _elem53 int64 - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem53 = v - } - p.TraceIds = append(p.TraceIds, _elem53) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *TracesExistArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("tracesExist_args"); 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *TracesExistArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("trace_ids", thrift.LIST, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:trace_ids: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.I64, len(p.TraceIds)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.TraceIds { - if err := oprot.WriteI64(int64(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:trace_ids: %s", p, err) - } - return err -} - -func (p *TracesExistArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("TracesExistArgs(%+v)", *p) -} - -type TracesExistResult struct { - Success map[int64]bool `thrift:"success,0" json:"success"` - Qe *QueryException `thrift:"qe,1" json:"qe"` -} - -func NewTracesExistResult() *TracesExistResult { - return &TracesExistResult{} -} - -var TracesExistResult_Success_DEFAULT map[int64]bool - -func (p *TracesExistResult) GetSuccess() map[int64]bool { - return p.Success -} - -var TracesExistResult_Qe_DEFAULT *QueryException - -func (p *TracesExistResult) GetQe() *QueryException { - if !p.IsSetQe() { - return TracesExistResult_Qe_DEFAULT - } - return p.Qe -} -func (p *TracesExistResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *TracesExistResult) IsSetQe() bool { - return p.Qe != nil -} - -func (p *TracesExistResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *TracesExistResult) ReadField0(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() - if err != nil { - return fmt.Errorf("error reading set begin: %s", err) - } - tSet := make(map[int64]bool, size) - p.Success = tSet - for i := 0; i < size; i++ { - var _elem54 int64 - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem54 = v - } - p.Success[_elem54] = true - } - if err := iprot.ReadSetEnd(); err != nil { - return fmt.Errorf("error reading set end: %s", err) - } - return nil -} - -func (p *TracesExistResult) ReadField1(iprot thrift.TProtocol) error { - p.Qe = &QueryException{} - if err := p.Qe.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Qe, err) - } - return nil -} - -func (p *TracesExistResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("tracesExist_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *TracesExistResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.SET, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := oprot.WriteSetBegin(thrift.I64, len(p.Success)); err != nil { - return fmt.Errorf("error writing set begin: %s", err) - } - for v, _ := range p.Success { - if err := oprot.WriteI64(int64(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteSetEnd(); err != nil { - return fmt.Errorf("error writing set end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *TracesExistResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetQe() { - if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:qe: %s", p, err) - } - if err := p.Qe.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Qe, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:qe: %s", p, err) - } - } - return err -} - -func (p *TracesExistResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("TracesExistResult(%+v)", *p) -} - -type GetTracesByIdsArgs struct { - TraceIds []int64 `thrift:"trace_ids,1" json:"trace_ids"` - Adjust []Adjust `thrift:"adjust,2" json:"adjust"` -} - -func NewGetTracesByIdsArgs() *GetTracesByIdsArgs { - return &GetTracesByIdsArgs{} -} - -func (p *GetTracesByIdsArgs) GetTraceIds() []int64 { - return p.TraceIds -} - -func (p *GetTracesByIdsArgs) GetAdjust() []Adjust { - return p.Adjust -} -func (p *GetTracesByIdsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTracesByIdsArgs) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]int64, 0, size) - p.TraceIds = tSlice - for i := 0; i < size; i++ { - var _elem55 int64 - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem55 = v - } - p.TraceIds = append(p.TraceIds, _elem55) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *GetTracesByIdsArgs) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]Adjust, 0, size) - p.Adjust = tSlice - for i := 0; i < size; i++ { - var _elem56 Adjust - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - temp := Adjust(v) - _elem56 = temp - } - p.Adjust = append(p.Adjust, _elem56) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *GetTracesByIdsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTracesByIds_args"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := p.writeField2(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTracesByIdsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("trace_ids", thrift.LIST, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:trace_ids: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.I64, len(p.TraceIds)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.TraceIds { - if err := oprot.WriteI64(int64(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:trace_ids: %s", p, err) - } - return err -} - -func (p *GetTracesByIdsArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("adjust", thrift.LIST, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:adjust: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.I32, len(p.Adjust)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Adjust { - if err := oprot.WriteI32(int32(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:adjust: %s", p, err) - } - return err -} - -func (p *GetTracesByIdsArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTracesByIdsArgs(%+v)", *p) -} - -type GetTracesByIdsResult struct { - Success []*Trace `thrift:"success,0" json:"success"` - Qe *QueryException `thrift:"qe,1" json:"qe"` -} - -func NewGetTracesByIdsResult() *GetTracesByIdsResult { - return &GetTracesByIdsResult{} -} - -var GetTracesByIdsResult_Success_DEFAULT []*Trace - -func (p *GetTracesByIdsResult) GetSuccess() []*Trace { - return p.Success -} - -var GetTracesByIdsResult_Qe_DEFAULT *QueryException - -func (p *GetTracesByIdsResult) GetQe() *QueryException { - if !p.IsSetQe() { - return GetTracesByIdsResult_Qe_DEFAULT - } - return p.Qe -} -func (p *GetTracesByIdsResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GetTracesByIdsResult) IsSetQe() bool { - return p.Qe != nil -} - -func (p *GetTracesByIdsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTracesByIdsResult) ReadField0(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]*Trace, 0, size) - p.Success = tSlice - for i := 0; i < size; i++ { - _elem57 := &Trace{} - if err := _elem57.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem57, err) - } - p.Success = append(p.Success, _elem57) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *GetTracesByIdsResult) ReadField1(iprot thrift.TProtocol) error { - p.Qe = &QueryException{} - if err := p.Qe.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Qe, err) - } - return nil -} - -func (p *GetTracesByIdsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTracesByIds_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTracesByIdsResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Success)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Success { - if err := v.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", v, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *GetTracesByIdsResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetQe() { - if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:qe: %s", p, err) - } - if err := p.Qe.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Qe, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:qe: %s", p, err) - } - } - return err -} - -func (p *GetTracesByIdsResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTracesByIdsResult(%+v)", *p) -} - -type GetTraceTimelinesByIdsArgs struct { - TraceIds []int64 `thrift:"trace_ids,1" json:"trace_ids"` - Adjust []Adjust `thrift:"adjust,2" json:"adjust"` -} - -func NewGetTraceTimelinesByIdsArgs() *GetTraceTimelinesByIdsArgs { - return &GetTraceTimelinesByIdsArgs{} -} - -func (p *GetTraceTimelinesByIdsArgs) GetTraceIds() []int64 { - return p.TraceIds -} - -func (p *GetTraceTimelinesByIdsArgs) GetAdjust() []Adjust { - return p.Adjust -} -func (p *GetTraceTimelinesByIdsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTraceTimelinesByIdsArgs) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]int64, 0, size) - p.TraceIds = tSlice - for i := 0; i < size; i++ { - var _elem58 int64 - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem58 = v - } - p.TraceIds = append(p.TraceIds, _elem58) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *GetTraceTimelinesByIdsArgs) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]Adjust, 0, size) - p.Adjust = tSlice - for i := 0; i < size; i++ { - var _elem59 Adjust - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - temp := Adjust(v) - _elem59 = temp - } - p.Adjust = append(p.Adjust, _elem59) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *GetTraceTimelinesByIdsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTraceTimelinesByIds_args"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := p.writeField2(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTraceTimelinesByIdsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("trace_ids", thrift.LIST, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:trace_ids: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.I64, len(p.TraceIds)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.TraceIds { - if err := oprot.WriteI64(int64(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:trace_ids: %s", p, err) - } - return err -} - -func (p *GetTraceTimelinesByIdsArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("adjust", thrift.LIST, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:adjust: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.I32, len(p.Adjust)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Adjust { - if err := oprot.WriteI32(int32(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:adjust: %s", p, err) - } - return err -} - -func (p *GetTraceTimelinesByIdsArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTraceTimelinesByIdsArgs(%+v)", *p) -} - -type GetTraceTimelinesByIdsResult struct { - Success []*TraceTimeline `thrift:"success,0" json:"success"` - Qe *QueryException `thrift:"qe,1" json:"qe"` -} - -func NewGetTraceTimelinesByIdsResult() *GetTraceTimelinesByIdsResult { - return &GetTraceTimelinesByIdsResult{} -} - -var GetTraceTimelinesByIdsResult_Success_DEFAULT []*TraceTimeline - -func (p *GetTraceTimelinesByIdsResult) GetSuccess() []*TraceTimeline { - return p.Success -} - -var GetTraceTimelinesByIdsResult_Qe_DEFAULT *QueryException - -func (p *GetTraceTimelinesByIdsResult) GetQe() *QueryException { - if !p.IsSetQe() { - return GetTraceTimelinesByIdsResult_Qe_DEFAULT - } - return p.Qe -} -func (p *GetTraceTimelinesByIdsResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GetTraceTimelinesByIdsResult) IsSetQe() bool { - return p.Qe != nil -} - -func (p *GetTraceTimelinesByIdsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTraceTimelinesByIdsResult) ReadField0(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]*TraceTimeline, 0, size) - p.Success = tSlice - for i := 0; i < size; i++ { - _elem60 := &TraceTimeline{} - if err := _elem60.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem60, err) - } - p.Success = append(p.Success, _elem60) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *GetTraceTimelinesByIdsResult) ReadField1(iprot thrift.TProtocol) error { - p.Qe = &QueryException{} - if err := p.Qe.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Qe, err) - } - return nil -} - -func (p *GetTraceTimelinesByIdsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTraceTimelinesByIds_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTraceTimelinesByIdsResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Success)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Success { - if err := v.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", v, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *GetTraceTimelinesByIdsResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetQe() { - if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:qe: %s", p, err) - } - if err := p.Qe.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Qe, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:qe: %s", p, err) - } - } - return err -} - -func (p *GetTraceTimelinesByIdsResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTraceTimelinesByIdsResult(%+v)", *p) -} - -type GetTraceSummariesByIdsArgs struct { - TraceIds []int64 `thrift:"trace_ids,1" json:"trace_ids"` - Adjust []Adjust `thrift:"adjust,2" json:"adjust"` -} - -func NewGetTraceSummariesByIdsArgs() *GetTraceSummariesByIdsArgs { - return &GetTraceSummariesByIdsArgs{} -} - -func (p *GetTraceSummariesByIdsArgs) GetTraceIds() []int64 { - return p.TraceIds -} - -func (p *GetTraceSummariesByIdsArgs) GetAdjust() []Adjust { - return p.Adjust -} -func (p *GetTraceSummariesByIdsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTraceSummariesByIdsArgs) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]int64, 0, size) - p.TraceIds = tSlice - for i := 0; i < size; i++ { - var _elem61 int64 - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem61 = v - } - p.TraceIds = append(p.TraceIds, _elem61) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *GetTraceSummariesByIdsArgs) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]Adjust, 0, size) - p.Adjust = tSlice - for i := 0; i < size; i++ { - var _elem62 Adjust - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - temp := Adjust(v) - _elem62 = temp - } - p.Adjust = append(p.Adjust, _elem62) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *GetTraceSummariesByIdsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTraceSummariesByIds_args"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := p.writeField2(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTraceSummariesByIdsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("trace_ids", thrift.LIST, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:trace_ids: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.I64, len(p.TraceIds)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.TraceIds { - if err := oprot.WriteI64(int64(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:trace_ids: %s", p, err) - } - return err -} - -func (p *GetTraceSummariesByIdsArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("adjust", thrift.LIST, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:adjust: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.I32, len(p.Adjust)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Adjust { - if err := oprot.WriteI32(int32(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:adjust: %s", p, err) - } - return err -} - -func (p *GetTraceSummariesByIdsArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTraceSummariesByIdsArgs(%+v)", *p) -} - -type GetTraceSummariesByIdsResult struct { - Success []*TraceSummary `thrift:"success,0" json:"success"` - Qe *QueryException `thrift:"qe,1" json:"qe"` -} - -func NewGetTraceSummariesByIdsResult() *GetTraceSummariesByIdsResult { - return &GetTraceSummariesByIdsResult{} -} - -var GetTraceSummariesByIdsResult_Success_DEFAULT []*TraceSummary - -func (p *GetTraceSummariesByIdsResult) GetSuccess() []*TraceSummary { - return p.Success -} - -var GetTraceSummariesByIdsResult_Qe_DEFAULT *QueryException - -func (p *GetTraceSummariesByIdsResult) GetQe() *QueryException { - if !p.IsSetQe() { - return GetTraceSummariesByIdsResult_Qe_DEFAULT - } - return p.Qe -} -func (p *GetTraceSummariesByIdsResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GetTraceSummariesByIdsResult) IsSetQe() bool { - return p.Qe != nil -} - -func (p *GetTraceSummariesByIdsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTraceSummariesByIdsResult) ReadField0(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]*TraceSummary, 0, size) - p.Success = tSlice - for i := 0; i < size; i++ { - _elem63 := &TraceSummary{} - if err := _elem63.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem63, err) - } - p.Success = append(p.Success, _elem63) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *GetTraceSummariesByIdsResult) ReadField1(iprot thrift.TProtocol) error { - p.Qe = &QueryException{} - if err := p.Qe.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Qe, err) - } - return nil -} - -func (p *GetTraceSummariesByIdsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTraceSummariesByIds_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTraceSummariesByIdsResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Success)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Success { - if err := v.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", v, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *GetTraceSummariesByIdsResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetQe() { - if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:qe: %s", p, err) - } - if err := p.Qe.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Qe, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:qe: %s", p, err) - } - } - return err -} - -func (p *GetTraceSummariesByIdsResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTraceSummariesByIdsResult(%+v)", *p) -} - -type GetTraceCombosByIdsArgs struct { - TraceIds []int64 `thrift:"trace_ids,1" json:"trace_ids"` - Adjust []Adjust `thrift:"adjust,2" json:"adjust"` -} - -func NewGetTraceCombosByIdsArgs() *GetTraceCombosByIdsArgs { - return &GetTraceCombosByIdsArgs{} -} - -func (p *GetTraceCombosByIdsArgs) GetTraceIds() []int64 { - return p.TraceIds -} - -func (p *GetTraceCombosByIdsArgs) GetAdjust() []Adjust { - return p.Adjust -} -func (p *GetTraceCombosByIdsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTraceCombosByIdsArgs) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]int64, 0, size) - p.TraceIds = tSlice - for i := 0; i < size; i++ { - var _elem64 int64 - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem64 = v - } - p.TraceIds = append(p.TraceIds, _elem64) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *GetTraceCombosByIdsArgs) ReadField2(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]Adjust, 0, size) - p.Adjust = tSlice - for i := 0; i < size; i++ { - var _elem65 Adjust - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - temp := Adjust(v) - _elem65 = temp - } - p.Adjust = append(p.Adjust, _elem65) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *GetTraceCombosByIdsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTraceCombosByIds_args"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := p.writeField2(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTraceCombosByIdsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("trace_ids", thrift.LIST, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:trace_ids: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.I64, len(p.TraceIds)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.TraceIds { - if err := oprot.WriteI64(int64(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:trace_ids: %s", p, err) - } - return err -} - -func (p *GetTraceCombosByIdsArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("adjust", thrift.LIST, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:adjust: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.I32, len(p.Adjust)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Adjust { - if err := oprot.WriteI32(int32(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:adjust: %s", p, err) - } - return err -} - -func (p *GetTraceCombosByIdsArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTraceCombosByIdsArgs(%+v)", *p) -} - -type GetTraceCombosByIdsResult struct { - Success []*TraceCombo `thrift:"success,0" json:"success"` - Qe *QueryException `thrift:"qe,1" json:"qe"` -} - -func NewGetTraceCombosByIdsResult() *GetTraceCombosByIdsResult { - return &GetTraceCombosByIdsResult{} -} - -var GetTraceCombosByIdsResult_Success_DEFAULT []*TraceCombo - -func (p *GetTraceCombosByIdsResult) GetSuccess() []*TraceCombo { - return p.Success -} - -var GetTraceCombosByIdsResult_Qe_DEFAULT *QueryException - -func (p *GetTraceCombosByIdsResult) GetQe() *QueryException { - if !p.IsSetQe() { - return GetTraceCombosByIdsResult_Qe_DEFAULT - } - return p.Qe -} -func (p *GetTraceCombosByIdsResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GetTraceCombosByIdsResult) IsSetQe() bool { - return p.Qe != nil -} - -func (p *GetTraceCombosByIdsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTraceCombosByIdsResult) ReadField0(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]*TraceCombo, 0, size) - p.Success = tSlice - for i := 0; i < size; i++ { - _elem66 := &TraceCombo{} - if err := _elem66.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", _elem66, err) - } - p.Success = append(p.Success, _elem66) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *GetTraceCombosByIdsResult) ReadField1(iprot thrift.TProtocol) error { - p.Qe = &QueryException{} - if err := p.Qe.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Qe, err) - } - return nil -} - -func (p *GetTraceCombosByIdsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTraceCombosByIds_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTraceCombosByIdsResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Success)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Success { - if err := v.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", v, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *GetTraceCombosByIdsResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetQe() { - if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:qe: %s", p, err) - } - if err := p.Qe.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Qe, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:qe: %s", p, err) - } - } - return err -} - -func (p *GetTraceCombosByIdsResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTraceCombosByIdsResult(%+v)", *p) -} - -type GetServiceNamesArgs struct { -} - -func NewGetServiceNamesArgs() *GetServiceNamesArgs { - return &GetServiceNamesArgs{} -} - -func (p *GetServiceNamesArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetServiceNamesArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getServiceNames_args"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetServiceNamesArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetServiceNamesArgs(%+v)", *p) -} - -type GetServiceNamesResult struct { - Success map[string]bool `thrift:"success,0" json:"success"` - Qe *QueryException `thrift:"qe,1" json:"qe"` -} - -func NewGetServiceNamesResult() *GetServiceNamesResult { - return &GetServiceNamesResult{} -} - -var GetServiceNamesResult_Success_DEFAULT map[string]bool - -func (p *GetServiceNamesResult) GetSuccess() map[string]bool { - return p.Success -} - -var GetServiceNamesResult_Qe_DEFAULT *QueryException - -func (p *GetServiceNamesResult) GetQe() *QueryException { - if !p.IsSetQe() { - return GetServiceNamesResult_Qe_DEFAULT - } - return p.Qe -} -func (p *GetServiceNamesResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GetServiceNamesResult) IsSetQe() bool { - return p.Qe != nil -} - -func (p *GetServiceNamesResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetServiceNamesResult) ReadField0(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() - if err != nil { - return fmt.Errorf("error reading set begin: %s", err) - } - tSet := make(map[string]bool, size) - p.Success = tSet - for i := 0; i < size; i++ { - var _elem67 string - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem67 = v - } - p.Success[_elem67] = true - } - if err := iprot.ReadSetEnd(); err != nil { - return fmt.Errorf("error reading set end: %s", err) - } - return nil -} - -func (p *GetServiceNamesResult) ReadField1(iprot thrift.TProtocol) error { - p.Qe = &QueryException{} - if err := p.Qe.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Qe, err) - } - return nil -} - -func (p *GetServiceNamesResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getServiceNames_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetServiceNamesResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.SET, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := oprot.WriteSetBegin(thrift.STRING, len(p.Success)); err != nil { - return fmt.Errorf("error writing set begin: %s", err) - } - for v, _ := range p.Success { - if err := oprot.WriteString(string(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteSetEnd(); err != nil { - return fmt.Errorf("error writing set end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *GetServiceNamesResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetQe() { - if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:qe: %s", p, err) - } - if err := p.Qe.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Qe, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:qe: %s", p, err) - } - } - return err -} - -func (p *GetServiceNamesResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetServiceNamesResult(%+v)", *p) -} - -type GetSpanNamesArgs struct { - ServiceName string `thrift:"service_name,1" json:"service_name"` -} - -func NewGetSpanNamesArgs() *GetSpanNamesArgs { - return &GetSpanNamesArgs{} -} - -func (p *GetSpanNamesArgs) GetServiceName() string { - return p.ServiceName -} -func (p *GetSpanNamesArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetSpanNamesArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.ServiceName = v - } - return nil -} - -func (p *GetSpanNamesArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getSpanNames_args"); 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetSpanNamesArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err) - } - if err := oprot.WriteString(string(p.ServiceName)); err != nil { - return fmt.Errorf("%T.service_name (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:service_name: %s", p, err) - } - return err -} - -func (p *GetSpanNamesArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetSpanNamesArgs(%+v)", *p) -} - -type GetSpanNamesResult struct { - Success map[string]bool `thrift:"success,0" json:"success"` - Qe *QueryException `thrift:"qe,1" json:"qe"` -} - -func NewGetSpanNamesResult() *GetSpanNamesResult { - return &GetSpanNamesResult{} -} - -var GetSpanNamesResult_Success_DEFAULT map[string]bool - -func (p *GetSpanNamesResult) GetSuccess() map[string]bool { - return p.Success -} - -var GetSpanNamesResult_Qe_DEFAULT *QueryException - -func (p *GetSpanNamesResult) GetQe() *QueryException { - if !p.IsSetQe() { - return GetSpanNamesResult_Qe_DEFAULT - } - return p.Qe -} -func (p *GetSpanNamesResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GetSpanNamesResult) IsSetQe() bool { - return p.Qe != nil -} - -func (p *GetSpanNamesResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetSpanNamesResult) ReadField0(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadSetBegin() - if err != nil { - return fmt.Errorf("error reading set begin: %s", err) - } - tSet := make(map[string]bool, size) - p.Success = tSet - for i := 0; i < size; i++ { - var _elem68 string - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem68 = v - } - p.Success[_elem68] = true - } - if err := iprot.ReadSetEnd(); err != nil { - return fmt.Errorf("error reading set end: %s", err) - } - return nil -} - -func (p *GetSpanNamesResult) ReadField1(iprot thrift.TProtocol) error { - p.Qe = &QueryException{} - if err := p.Qe.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Qe, err) - } - return nil -} - -func (p *GetSpanNamesResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getSpanNames_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetSpanNamesResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.SET, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := oprot.WriteSetBegin(thrift.STRING, len(p.Success)); err != nil { - return fmt.Errorf("error writing set begin: %s", err) - } - for v, _ := range p.Success { - if err := oprot.WriteString(string(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteSetEnd(); err != nil { - return fmt.Errorf("error writing set end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *GetSpanNamesResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetQe() { - if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:qe: %s", p, err) - } - if err := p.Qe.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Qe, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:qe: %s", p, err) - } - } - return err -} - -func (p *GetSpanNamesResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetSpanNamesResult(%+v)", *p) -} - -type SetTraceTimeToLiveArgs struct { - TraceId int64 `thrift:"trace_id,1" json:"trace_id"` - TtlSeconds int32 `thrift:"ttl_seconds,2" json:"ttl_seconds"` -} - -func NewSetTraceTimeToLiveArgs() *SetTraceTimeToLiveArgs { - return &SetTraceTimeToLiveArgs{} -} - -func (p *SetTraceTimeToLiveArgs) GetTraceId() int64 { - return p.TraceId -} - -func (p *SetTraceTimeToLiveArgs) GetTtlSeconds() int32 { - return p.TtlSeconds -} -func (p *SetTraceTimeToLiveArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *SetTraceTimeToLiveArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.TraceId = v - } - return nil -} - -func (p *SetTraceTimeToLiveArgs) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.TtlSeconds = v - } - return nil -} - -func (p *SetTraceTimeToLiveArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("setTraceTimeToLive_args"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := p.writeField2(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *SetTraceTimeToLiveArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("trace_id", thrift.I64, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:trace_id: %s", p, err) - } - if err := oprot.WriteI64(int64(p.TraceId)); err != nil { - return fmt.Errorf("%T.trace_id (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:trace_id: %s", p, err) - } - return err -} - -func (p *SetTraceTimeToLiveArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("ttl_seconds", thrift.I32, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:ttl_seconds: %s", p, err) - } - if err := oprot.WriteI32(int32(p.TtlSeconds)); err != nil { - return fmt.Errorf("%T.ttl_seconds (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:ttl_seconds: %s", p, err) - } - return err -} - -func (p *SetTraceTimeToLiveArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("SetTraceTimeToLiveArgs(%+v)", *p) -} - -type SetTraceTimeToLiveResult struct { - Qe *QueryException `thrift:"qe,1" json:"qe"` -} - -func NewSetTraceTimeToLiveResult() *SetTraceTimeToLiveResult { - return &SetTraceTimeToLiveResult{} -} - -var SetTraceTimeToLiveResult_Qe_DEFAULT *QueryException - -func (p *SetTraceTimeToLiveResult) GetQe() *QueryException { - if !p.IsSetQe() { - return SetTraceTimeToLiveResult_Qe_DEFAULT - } - return p.Qe -} -func (p *SetTraceTimeToLiveResult) IsSetQe() bool { - return p.Qe != nil -} - -func (p *SetTraceTimeToLiveResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *SetTraceTimeToLiveResult) ReadField1(iprot thrift.TProtocol) error { - p.Qe = &QueryException{} - if err := p.Qe.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Qe, err) - } - return nil -} - -func (p *SetTraceTimeToLiveResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("setTraceTimeToLive_result"); 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *SetTraceTimeToLiveResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetQe() { - if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:qe: %s", p, err) - } - if err := p.Qe.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Qe, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:qe: %s", p, err) - } - } - return err -} - -func (p *SetTraceTimeToLiveResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("SetTraceTimeToLiveResult(%+v)", *p) -} - -type GetTraceTimeToLiveArgs struct { - TraceId int64 `thrift:"trace_id,1" json:"trace_id"` -} - -func NewGetTraceTimeToLiveArgs() *GetTraceTimeToLiveArgs { - return &GetTraceTimeToLiveArgs{} -} - -func (p *GetTraceTimeToLiveArgs) GetTraceId() int64 { - return p.TraceId -} -func (p *GetTraceTimeToLiveArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTraceTimeToLiveArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.TraceId = v - } - return nil -} - -func (p *GetTraceTimeToLiveArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTraceTimeToLive_args"); 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTraceTimeToLiveArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("trace_id", thrift.I64, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:trace_id: %s", p, err) - } - if err := oprot.WriteI64(int64(p.TraceId)); err != nil { - return fmt.Errorf("%T.trace_id (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:trace_id: %s", p, err) - } - return err -} - -func (p *GetTraceTimeToLiveArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTraceTimeToLiveArgs(%+v)", *p) -} - -type GetTraceTimeToLiveResult struct { - Success *int32 `thrift:"success,0" json:"success"` - Qe *QueryException `thrift:"qe,1" json:"qe"` -} - -func NewGetTraceTimeToLiveResult() *GetTraceTimeToLiveResult { - return &GetTraceTimeToLiveResult{} -} - -var GetTraceTimeToLiveResult_Success_DEFAULT int32 - -func (p *GetTraceTimeToLiveResult) GetSuccess() int32 { - if !p.IsSetSuccess() { - return GetTraceTimeToLiveResult_Success_DEFAULT - } - return *p.Success -} - -var GetTraceTimeToLiveResult_Qe_DEFAULT *QueryException - -func (p *GetTraceTimeToLiveResult) GetQe() *QueryException { - if !p.IsSetQe() { - return GetTraceTimeToLiveResult_Qe_DEFAULT - } - return p.Qe -} -func (p *GetTraceTimeToLiveResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GetTraceTimeToLiveResult) IsSetQe() bool { - return p.Qe != nil -} - -func (p *GetTraceTimeToLiveResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTraceTimeToLiveResult) ReadField0(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - p.Success = &v - } - return nil -} - -func (p *GetTraceTimeToLiveResult) ReadField1(iprot thrift.TProtocol) error { - p.Qe = &QueryException{} - if err := p.Qe.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Qe, err) - } - return nil -} - -func (p *GetTraceTimeToLiveResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTraceTimeToLive_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTraceTimeToLiveResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.I32, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := oprot.WriteI32(int32(*p.Success)); err != nil { - return fmt.Errorf("%T.success (0) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *GetTraceTimeToLiveResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetQe() { - if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:qe: %s", p, err) - } - if err := p.Qe.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Qe, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:qe: %s", p, err) - } - } - return err -} - -func (p *GetTraceTimeToLiveResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTraceTimeToLiveResult(%+v)", *p) -} - -type GetDataTimeToLiveArgs struct { -} - -func NewGetDataTimeToLiveArgs() *GetDataTimeToLiveArgs { - return &GetDataTimeToLiveArgs{} -} - -func (p *GetDataTimeToLiveArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetDataTimeToLiveArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getDataTimeToLive_args"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetDataTimeToLiveArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetDataTimeToLiveArgs(%+v)", *p) -} - -type GetDataTimeToLiveResult struct { - Success *int32 `thrift:"success,0" json:"success"` - Qe *QueryException `thrift:"qe,1" json:"qe"` -} - -func NewGetDataTimeToLiveResult() *GetDataTimeToLiveResult { - return &GetDataTimeToLiveResult{} -} - -var GetDataTimeToLiveResult_Success_DEFAULT int32 - -func (p *GetDataTimeToLiveResult) GetSuccess() int32 { - if !p.IsSetSuccess() { - return GetDataTimeToLiveResult_Success_DEFAULT - } - return *p.Success -} - -var GetDataTimeToLiveResult_Qe_DEFAULT *QueryException - -func (p *GetDataTimeToLiveResult) GetQe() *QueryException { - if !p.IsSetQe() { - return GetDataTimeToLiveResult_Qe_DEFAULT - } - return p.Qe -} -func (p *GetDataTimeToLiveResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GetDataTimeToLiveResult) IsSetQe() bool { - return p.Qe != nil -} - -func (p *GetDataTimeToLiveResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetDataTimeToLiveResult) ReadField0(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - p.Success = &v - } - return nil -} - -func (p *GetDataTimeToLiveResult) ReadField1(iprot thrift.TProtocol) error { - p.Qe = &QueryException{} - if err := p.Qe.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Qe, err) - } - return nil -} - -func (p *GetDataTimeToLiveResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getDataTimeToLive_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetDataTimeToLiveResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.I32, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := oprot.WriteI32(int32(*p.Success)); err != nil { - return fmt.Errorf("%T.success (0) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *GetDataTimeToLiveResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetQe() { - if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:qe: %s", p, err) - } - if err := p.Qe.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Qe, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:qe: %s", p, err) - } - } - return err -} - -func (p *GetDataTimeToLiveResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetDataTimeToLiveResult(%+v)", *p) -} - -type GetDependenciesArgs struct { - StartTime int64 `thrift:"start_time,1" json:"start_time"` - EndTime int64 `thrift:"end_time,2" json:"end_time"` -} - -func NewGetDependenciesArgs() *GetDependenciesArgs { - return &GetDependenciesArgs{} -} - -func (p *GetDependenciesArgs) GetStartTime() int64 { - return p.StartTime -} - -func (p *GetDependenciesArgs) GetEndTime() int64 { - return p.EndTime -} -func (p *GetDependenciesArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetDependenciesArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.StartTime = v - } - return nil -} - -func (p *GetDependenciesArgs) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.EndTime = v - } - return nil -} - -func (p *GetDependenciesArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getDependencies_args"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := p.writeField2(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetDependenciesArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("start_time", thrift.I64, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:start_time: %s", p, err) - } - if err := oprot.WriteI64(int64(p.StartTime)); err != nil { - return fmt.Errorf("%T.start_time (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:start_time: %s", p, err) - } - return err -} - -func (p *GetDependenciesArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("end_time", thrift.I64, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:end_time: %s", p, err) - } - if err := oprot.WriteI64(int64(p.EndTime)); err != nil { - return fmt.Errorf("%T.end_time (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:end_time: %s", p, err) - } - return err -} - -func (p *GetDependenciesArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetDependenciesArgs(%+v)", *p) -} - -type GetDependenciesResult struct { - Success *zipkindependencies.Dependencies `thrift:"success,0" json:"success"` - Qe *QueryException `thrift:"qe,1" json:"qe"` -} - -func NewGetDependenciesResult() *GetDependenciesResult { - return &GetDependenciesResult{} -} - -var GetDependenciesResult_Success_DEFAULT *zipkindependencies.Dependencies - -func (p *GetDependenciesResult) GetSuccess() *zipkindependencies.Dependencies { - if !p.IsSetSuccess() { - return GetDependenciesResult_Success_DEFAULT - } - return p.Success -} - -var GetDependenciesResult_Qe_DEFAULT *QueryException - -func (p *GetDependenciesResult) GetQe() *QueryException { - if !p.IsSetQe() { - return GetDependenciesResult_Qe_DEFAULT - } - return p.Qe -} -func (p *GetDependenciesResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GetDependenciesResult) IsSetQe() bool { - return p.Qe != nil -} - -func (p *GetDependenciesResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetDependenciesResult) ReadField0(iprot thrift.TProtocol) error { - p.Success = &zipkindependencies.Dependencies{} - if err := p.Success.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Success, err) - } - return nil -} - -func (p *GetDependenciesResult) ReadField1(iprot thrift.TProtocol) error { - p.Qe = &QueryException{} - if err := p.Qe.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Qe, err) - } - return nil -} - -func (p *GetDependenciesResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getDependencies_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetDependenciesResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := p.Success.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Success, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *GetDependenciesResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetQe() { - if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:qe: %s", p, err) - } - if err := p.Qe.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Qe, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:qe: %s", p, err) - } - } - return err -} - -func (p *GetDependenciesResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetDependenciesResult(%+v)", *p) -} - -type GetTopAnnotationsArgs struct { - ServiceName string `thrift:"service_name,1" json:"service_name"` -} - -func NewGetTopAnnotationsArgs() *GetTopAnnotationsArgs { - return &GetTopAnnotationsArgs{} -} - -func (p *GetTopAnnotationsArgs) GetServiceName() string { - return p.ServiceName -} -func (p *GetTopAnnotationsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTopAnnotationsArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.ServiceName = v - } - return nil -} - -func (p *GetTopAnnotationsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTopAnnotations_args"); 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTopAnnotationsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err) - } - if err := oprot.WriteString(string(p.ServiceName)); err != nil { - return fmt.Errorf("%T.service_name (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:service_name: %s", p, err) - } - return err -} - -func (p *GetTopAnnotationsArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTopAnnotationsArgs(%+v)", *p) -} - -type GetTopAnnotationsResult struct { - Success []string `thrift:"success,0" json:"success"` - Qe *QueryException `thrift:"qe,1" json:"qe"` -} - -func NewGetTopAnnotationsResult() *GetTopAnnotationsResult { - return &GetTopAnnotationsResult{} -} - -var GetTopAnnotationsResult_Success_DEFAULT []string - -func (p *GetTopAnnotationsResult) GetSuccess() []string { - return p.Success -} - -var GetTopAnnotationsResult_Qe_DEFAULT *QueryException - -func (p *GetTopAnnotationsResult) GetQe() *QueryException { - if !p.IsSetQe() { - return GetTopAnnotationsResult_Qe_DEFAULT - } - return p.Qe -} -func (p *GetTopAnnotationsResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GetTopAnnotationsResult) IsSetQe() bool { - return p.Qe != nil -} - -func (p *GetTopAnnotationsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTopAnnotationsResult) ReadField0(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]string, 0, size) - p.Success = tSlice - for i := 0; i < size; i++ { - var _elem69 string - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem69 = v - } - p.Success = append(p.Success, _elem69) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *GetTopAnnotationsResult) ReadField1(iprot thrift.TProtocol) error { - p.Qe = &QueryException{} - if err := p.Qe.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Qe, err) - } - return nil -} - -func (p *GetTopAnnotationsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTopAnnotations_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTopAnnotationsResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRING, len(p.Success)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Success { - if err := oprot.WriteString(string(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *GetTopAnnotationsResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetQe() { - if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:qe: %s", p, err) - } - if err := p.Qe.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Qe, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:qe: %s", p, err) - } - } - return err -} - -func (p *GetTopAnnotationsResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTopAnnotationsResult(%+v)", *p) -} - -type GetTopKeyValueAnnotationsArgs struct { - ServiceName string `thrift:"service_name,1" json:"service_name"` -} - -func NewGetTopKeyValueAnnotationsArgs() *GetTopKeyValueAnnotationsArgs { - return &GetTopKeyValueAnnotationsArgs{} -} - -func (p *GetTopKeyValueAnnotationsArgs) GetServiceName() string { - return p.ServiceName -} -func (p *GetTopKeyValueAnnotationsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTopKeyValueAnnotationsArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.ServiceName = v - } - return nil -} - -func (p *GetTopKeyValueAnnotationsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTopKeyValueAnnotations_args"); 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 { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTopKeyValueAnnotationsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err) - } - if err := oprot.WriteString(string(p.ServiceName)); err != nil { - return fmt.Errorf("%T.service_name (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:service_name: %s", p, err) - } - return err -} - -func (p *GetTopKeyValueAnnotationsArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTopKeyValueAnnotationsArgs(%+v)", *p) -} - -type GetTopKeyValueAnnotationsResult struct { - Success []string `thrift:"success,0" json:"success"` - Qe *QueryException `thrift:"qe,1" json:"qe"` -} - -func NewGetTopKeyValueAnnotationsResult() *GetTopKeyValueAnnotationsResult { - return &GetTopKeyValueAnnotationsResult{} -} - -var GetTopKeyValueAnnotationsResult_Success_DEFAULT []string - -func (p *GetTopKeyValueAnnotationsResult) GetSuccess() []string { - return p.Success -} - -var GetTopKeyValueAnnotationsResult_Qe_DEFAULT *QueryException - -func (p *GetTopKeyValueAnnotationsResult) GetQe() *QueryException { - if !p.IsSetQe() { - return GetTopKeyValueAnnotationsResult_Qe_DEFAULT - } - return p.Qe -} -func (p *GetTopKeyValueAnnotationsResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GetTopKeyValueAnnotationsResult) IsSetQe() bool { - return p.Qe != nil -} - -func (p *GetTopKeyValueAnnotationsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetTopKeyValueAnnotationsResult) ReadField0(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]string, 0, size) - p.Success = tSlice - for i := 0; i < size; i++ { - var _elem70 string - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem70 = v - } - p.Success = append(p.Success, _elem70) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - return nil -} - -func (p *GetTopKeyValueAnnotationsResult) ReadField1(iprot thrift.TProtocol) error { - p.Qe = &QueryException{} - if err := p.Qe.Read(iprot); err != nil { - return fmt.Errorf("%T error reading struct: %s", p.Qe, err) - } - return nil -} - -func (p *GetTopKeyValueAnnotationsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getTopKeyValueAnnotations_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := p.writeField1(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetTopKeyValueAnnotationsResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.STRING, len(p.Success)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range p.Success { - if err := oprot.WriteString(string(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *GetTopKeyValueAnnotationsResult) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetQe() { - if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:qe: %s", p, err) - } - if err := p.Qe.Write(oprot); err != nil { - return fmt.Errorf("%T error writing struct: %s", p.Qe, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:qe: %s", p, err) - } - } - return err -} - -func (p *GetTopKeyValueAnnotationsResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetTopKeyValueAnnotationsResult(%+v)", *p) -} - -type GetSpanDurationsArgs struct { - TimeStamp int64 `thrift:"time_stamp,1" json:"time_stamp"` - ServiceName string `thrift:"service_name,2" json:"service_name"` - RpcName string `thrift:"rpc_name,3" json:"rpc_name"` -} - -func NewGetSpanDurationsArgs() *GetSpanDurationsArgs { - return &GetSpanDurationsArgs{} -} - -func (p *GetSpanDurationsArgs) GetTimeStamp() int64 { - return p.TimeStamp -} - -func (p *GetSpanDurationsArgs) GetServiceName() string { - return p.ServiceName -} - -func (p *GetSpanDurationsArgs) GetRpcName() string { - return p.RpcName -} -func (p *GetSpanDurationsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetSpanDurationsArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.TimeStamp = v - } - return nil -} - -func (p *GetSpanDurationsArgs) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.ServiceName = v - } - return nil -} - -func (p *GetSpanDurationsArgs) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 3: %s", err) - } else { - p.RpcName = v - } - return nil -} - -func (p *GetSpanDurationsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getSpanDurations_args"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - 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 := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetSpanDurationsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("time_stamp", thrift.I64, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:time_stamp: %s", p, err) - } - if err := oprot.WriteI64(int64(p.TimeStamp)); err != nil { - return fmt.Errorf("%T.time_stamp (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:time_stamp: %s", p, err) - } - return err -} - -func (p *GetSpanDurationsArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:service_name: %s", p, err) - } - if err := oprot.WriteString(string(p.ServiceName)); err != nil { - return fmt.Errorf("%T.service_name (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:service_name: %s", p, err) - } - return err -} - -func (p *GetSpanDurationsArgs) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("rpc_name", thrift.STRING, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:rpc_name: %s", p, err) - } - if err := oprot.WriteString(string(p.RpcName)); err != nil { - return fmt.Errorf("%T.rpc_name (3) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:rpc_name: %s", p, err) - } - return err -} - -func (p *GetSpanDurationsArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetSpanDurationsArgs(%+v)", *p) -} - -type GetSpanDurationsResult struct { - Success map[string][]int64 `thrift:"success,0" json:"success"` -} - -func NewGetSpanDurationsResult() *GetSpanDurationsResult { - return &GetSpanDurationsResult{} -} - -var GetSpanDurationsResult_Success_DEFAULT map[string][]int64 - -func (p *GetSpanDurationsResult) GetSuccess() map[string][]int64 { - return p.Success -} -func (p *GetSpanDurationsResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GetSpanDurationsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetSpanDurationsResult) ReadField0(iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin() - if err != nil { - return fmt.Errorf("error reading map begin: %s", err) - } - tMap := make(map[string][]int64, size) - p.Success = tMap - for i := 0; i < size; i++ { - var _key71 string - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _key71 = v - } - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]int64, 0, size) - _val72 := tSlice - for i := 0; i < size; i++ { - var _elem73 int64 - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem73 = v - } - _val72 = append(_val72, _elem73) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - p.Success[_key71] = _val72 - } - if err := iprot.ReadMapEnd(); err != nil { - return fmt.Errorf("error reading map end: %s", err) - } - return nil -} - -func (p *GetSpanDurationsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getSpanDurations_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetSpanDurationsResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.MAP, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := oprot.WriteMapBegin(thrift.STRING, thrift.LIST, len(p.Success)); err != nil { - return fmt.Errorf("error writing map begin: %s", err) - } - for k, v := range p.Success { - if err := oprot.WriteString(string(k)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.I64, len(v)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range v { - if err := oprot.WriteI64(int64(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - } - if err := oprot.WriteMapEnd(); err != nil { - return fmt.Errorf("error writing map end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *GetSpanDurationsResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetSpanDurationsResult(%+v)", *p) -} - -type GetServiceNamesToTraceIdsArgs struct { - TimeStamp int64 `thrift:"time_stamp,1" json:"time_stamp"` - ServiceName string `thrift:"service_name,2" json:"service_name"` - RpcName string `thrift:"rpc_name,3" json:"rpc_name"` -} - -func NewGetServiceNamesToTraceIdsArgs() *GetServiceNamesToTraceIdsArgs { - return &GetServiceNamesToTraceIdsArgs{} -} - -func (p *GetServiceNamesToTraceIdsArgs) GetTimeStamp() int64 { - return p.TimeStamp -} - -func (p *GetServiceNamesToTraceIdsArgs) GetServiceName() string { - return p.ServiceName -} - -func (p *GetServiceNamesToTraceIdsArgs) GetRpcName() string { - return p.RpcName -} -func (p *GetServiceNamesToTraceIdsArgs) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if err := p.ReadField1(iprot); err != nil { - return err - } - case 2: - if err := p.ReadField2(iprot); err != nil { - return err - } - case 3: - if err := p.ReadField3(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetServiceNamesToTraceIdsArgs) ReadField1(iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 1: %s", err) - } else { - p.TimeStamp = v - } - return nil -} - -func (p *GetServiceNamesToTraceIdsArgs) ReadField2(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 2: %s", err) - } else { - p.ServiceName = v - } - return nil -} - -func (p *GetServiceNamesToTraceIdsArgs) ReadField3(iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 3: %s", err) - } else { - p.RpcName = v - } - return nil -} - -func (p *GetServiceNamesToTraceIdsArgs) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getServiceNamesToTraceIds_args"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - 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 := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetServiceNamesToTraceIdsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("time_stamp", thrift.I64, 1); err != nil { - return fmt.Errorf("%T write field begin error 1:time_stamp: %s", p, err) - } - if err := oprot.WriteI64(int64(p.TimeStamp)); err != nil { - return fmt.Errorf("%T.time_stamp (1) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 1:time_stamp: %s", p, err) - } - return err -} - -func (p *GetServiceNamesToTraceIdsArgs) writeField2(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 2); err != nil { - return fmt.Errorf("%T write field begin error 2:service_name: %s", p, err) - } - if err := oprot.WriteString(string(p.ServiceName)); err != nil { - return fmt.Errorf("%T.service_name (2) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 2:service_name: %s", p, err) - } - return err -} - -func (p *GetServiceNamesToTraceIdsArgs) writeField3(oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin("rpc_name", thrift.STRING, 3); err != nil { - return fmt.Errorf("%T write field begin error 3:rpc_name: %s", p, err) - } - if err := oprot.WriteString(string(p.RpcName)); err != nil { - return fmt.Errorf("%T.rpc_name (3) field write error: %s", p, err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 3:rpc_name: %s", p, err) - } - return err -} - -func (p *GetServiceNamesToTraceIdsArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetServiceNamesToTraceIdsArgs(%+v)", *p) -} - -type GetServiceNamesToTraceIdsResult struct { - Success map[string][]int64 `thrift:"success,0" json:"success"` -} - -func NewGetServiceNamesToTraceIdsResult() *GetServiceNamesToTraceIdsResult { - return &GetServiceNamesToTraceIdsResult{} -} - -var GetServiceNamesToTraceIdsResult_Success_DEFAULT map[string][]int64 - -func (p *GetServiceNamesToTraceIdsResult) GetSuccess() map[string][]int64 { - return p.Success -} -func (p *GetServiceNamesToTraceIdsResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *GetServiceNamesToTraceIdsResult) Read(iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(); err != nil { - return fmt.Errorf("%T read error: %s", p, err) - } - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() - if err != nil { - return fmt.Errorf("%T field %d read error: %s", p, fieldId, err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if err := p.ReadField0(iprot); err != nil { - return err - } - default: - if err := iprot.Skip(fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(); err != nil { - return fmt.Errorf("%T read struct end error: %s", p, err) - } - return nil -} - -func (p *GetServiceNamesToTraceIdsResult) ReadField0(iprot thrift.TProtocol) error { - _, _, size, err := iprot.ReadMapBegin() - if err != nil { - return fmt.Errorf("error reading map begin: %s", err) - } - tMap := make(map[string][]int64, size) - p.Success = tMap - for i := 0; i < size; i++ { - var _key74 string - if v, err := iprot.ReadString(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _key74 = v - } - _, size, err := iprot.ReadListBegin() - if err != nil { - return fmt.Errorf("error reading list begin: %s", err) - } - tSlice := make([]int64, 0, size) - _val75 := tSlice - for i := 0; i < size; i++ { - var _elem76 int64 - if v, err := iprot.ReadI64(); err != nil { - return fmt.Errorf("error reading field 0: %s", err) - } else { - _elem76 = v - } - _val75 = append(_val75, _elem76) - } - if err := iprot.ReadListEnd(); err != nil { - return fmt.Errorf("error reading list end: %s", err) - } - p.Success[_key74] = _val75 - } - if err := iprot.ReadMapEnd(); err != nil { - return fmt.Errorf("error reading map end: %s", err) - } - return nil -} - -func (p *GetServiceNamesToTraceIdsResult) Write(oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin("getServiceNamesToTraceIds_result"); err != nil { - return fmt.Errorf("%T write struct begin error: %s", p, err) - } - if err := p.writeField0(oprot); err != nil { - return err - } - if err := oprot.WriteFieldStop(); err != nil { - return fmt.Errorf("write field stop error: %s", err) - } - if err := oprot.WriteStructEnd(); err != nil { - return fmt.Errorf("write struct stop error: %s", err) - } - return nil -} - -func (p *GetServiceNamesToTraceIdsResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin("success", thrift.MAP, 0); err != nil { - return fmt.Errorf("%T write field begin error 0:success: %s", p, err) - } - if err := oprot.WriteMapBegin(thrift.STRING, thrift.LIST, len(p.Success)); err != nil { - return fmt.Errorf("error writing map begin: %s", err) - } - for k, v := range p.Success { - if err := oprot.WriteString(string(k)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - if err := oprot.WriteListBegin(thrift.I64, len(v)); err != nil { - return fmt.Errorf("error writing list begin: %s", err) - } - for _, v := range v { - if err := oprot.WriteI64(int64(v)); err != nil { - return fmt.Errorf("%T. (0) field write error: %s", p, err) - } - } - if err := oprot.WriteListEnd(); err != nil { - return fmt.Errorf("error writing list end: %s", err) - } - } - if err := oprot.WriteMapEnd(); err != nil { - return fmt.Errorf("error writing map end: %s", err) - } - if err := oprot.WriteFieldEnd(); err != nil { - return fmt.Errorf("%T write field end error 0:success: %s", p, err) - } - } - return err -} - -func (p *GetServiceNamesToTraceIdsResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetServiceNamesToTraceIdsResult(%+v)", *p) -} diff --git a/tracing/zipkin/_thrift/scribe.thrift b/tracing/zipkin/_thrift/scribe.thrift deleted file mode 100644 index 12e21ce1e..000000000 --- a/tracing/zipkin/_thrift/scribe.thrift +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2012 Twitter Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -namespace java com.twitter.zipkin.thriftjava -#@namespace scala com.twitter.zipkin.thriftscala - -enum ResultCode -{ - OK, - TRY_LATER -} - -struct LogEntry -{ - 1: string category, - 2: string message -} - -service Scribe -{ - ResultCode Log(1: list messages); -} diff --git a/tracing/zipkin/_thrift/zipkinCollector.thrift b/tracing/zipkin/_thrift/zipkinCollector.thrift deleted file mode 100644 index aba6d9da1..000000000 --- a/tracing/zipkin/_thrift/zipkinCollector.thrift +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2012 Twitter Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -namespace java com.twitter.zipkin.thriftjava -#@namespace scala com.twitter.zipkin.thriftscala -namespace rb Zipkin - -include "scribe.thrift" -include "zipkinDependencies.thrift" - -exception AdjustableRateException { - 1: string msg -} - -exception StoreAggregatesException { - 1: string msg -} - -service ZipkinCollector extends scribe.Scribe { - - /** Aggregates methods */ - void storeTopAnnotations(1: string service_name, 2: list annotations) throws (1: StoreAggregatesException e); - void storeTopKeyValueAnnotations(1: string service_name, 2: list annotations) throws (1: StoreAggregatesException e); - void storeDependencies(1: zipkinDependencies.Dependencies dependencies) throws (1: StoreAggregatesException e); -} diff --git a/tracing/zipkin/_thrift/zipkinCore.thrift b/tracing/zipkin/_thrift/zipkinCore.thrift deleted file mode 100644 index 50ea914f0..000000000 --- a/tracing/zipkin/_thrift/zipkinCore.thrift +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright 2012 Twitter Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -namespace java com.twitter.zipkin.thriftjava -#@namespace scala com.twitter.zipkin.thriftscala -namespace rb Zipkin - -#************** Collection related structs ************** - -# these are the annotations we always expect to find in a span -const string CLIENT_SEND = "cs" -const string CLIENT_RECV = "cr" -const string SERVER_SEND = "ss" -const string SERVER_RECV = "sr" - -# this represents a host and port in a network -struct Endpoint { - 1: i32 ipv4, - 2: i16 port # beware that this will give us negative ports. some conversion needed - 3: string service_name # which service did this operation happen on? -} - -# some event took place, either one by the framework or by the user -struct Annotation { - 1: i64 timestamp # microseconds from epoch - 2: string value # what happened at the timestamp? - 3: optional Endpoint host # host this happened on - 4: optional i32 duration # how long did the operation take? microseconds -} - -enum AnnotationType { BOOL, BYTES, I16, I32, I64, DOUBLE, STRING } - -struct BinaryAnnotation { - 1: string key, - 2: binary value, - 3: AnnotationType annotation_type, - 4: optional Endpoint host -} - -struct Span { - 1: i64 trace_id # unique trace id, use for all spans in trace - 3: string name, # span name, rpc method for example - 4: i64 id, # unique span id, only used for this span - 5: optional i64 parent_id, # parent span id - 6: list annotations, # list of all annotations/events that occured - 8: list binary_annotations # any binary annotations - 9: optional bool debug = 0 # if true, we DEMAND that this span passes all samplers -} - diff --git a/tracing/zipkin/_thrift/zipkinDependencies.thrift b/tracing/zipkin/_thrift/zipkinDependencies.thrift deleted file mode 100644 index b12cdda54..000000000 --- a/tracing/zipkin/_thrift/zipkinDependencies.thrift +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2013 Twitter Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -namespace java com.twitter.zipkin.thriftjava -#@namespace scala com.twitter.zipkin.thriftscala -namespace rb Zipkin - -#********* Zipkin Aggregate Dependency Related Structs *********** - - -# This is a 1-to-1 translation of algebird Moments structure for holding -# count/mean/variance(stdDev)/skewness/etc about a set of values. It's -# used below to represent span time duration ranges. -struct Moments { - 1: i64 m0, # count - 2: double m1, # mean - 3: double m2, # variance * count - 4: double m3, - 5: double m4 -} - -struct DependencyLink { - 1: string parent, # parent service name (caller) - 2: string child, # child service name (callee) - 3: Moments duration_moments - # histogram? -} - -struct Dependencies { - 1: i64 start_time # microseconds from epoch - 2: i64 end_time # microseconds from epoch - 3: list links # our data -} diff --git a/tracing/zipkin/_thrift/zipkinQuery.thrift b/tracing/zipkin/_thrift/zipkinQuery.thrift deleted file mode 100644 index 13ede1594..000000000 --- a/tracing/zipkin/_thrift/zipkinQuery.thrift +++ /dev/null @@ -1,252 +0,0 @@ -# Copyright 2012 Twitter Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -namespace java com.twitter.zipkin.thriftjava -#@namespace scala com.twitter.zipkin.thriftscala -namespace rb Zipkin - -include "zipkinCore.thrift" -include "zipkinDependencies.thrift" - -struct Trace { - 1: list spans -} - -exception QueryException { - 1: string msg -} - -struct SpanTimestamp { - 1: string name - 2: i64 start_timestamp - 3: i64 end_timestamp -} - -/** - * This sums up a single Trace to make it easy for a client to get an overview of what happened. - */ -struct TraceSummary { - 1: i64 trace_id # the trace - 2: i64 start_timestamp # start timestamp of the trace, in microseconds - 3: i64 end_timestamp # end timestamp of the trace, in microseconds - 4: i32 duration_micro # how long did the entire trace take? in microseconds - # 5: map service_counts # which services were involved? - 6: list endpoints # which endpoints were involved? - 7: list span_timestamps -} - -/** - * A modified version of the Annotation struct that brings in more information - */ -struct TimelineAnnotation { - 1: i64 timestamp # microseconds from epoch - 2: string value # what happened at the timestamp? - 3: zipkinCore.Endpoint host # host this happened on - 4: i64 span_id # which span does this annotation belong to? - 5: optional i64 parent_id # parent span id - 6: string service_name # which service did this annotation happen on? - 7: string span_name # span name, rpc method for example -} - -/** - * This sums up a single Trace to make it easy for a client to get an overview of what happened. - */ -struct TraceTimeline { - 1: i64 trace_id # the trace - 2: i64 root_most_span_id # either the true root span or the closest we can find - 6: list annotations # annotations as they happened - 7: list binary_annotations # all the binary annotations -} - -/** - * Returns a combination of trace, summary and timeline. - */ -struct TraceCombo { - 1: Trace trace - 2: optional TraceSummary summary # not set if no spans in trace - 3: optional TraceTimeline timeline # not set if no spans in trace - 4: optional map span_depths # not set if no spans in trace -} - -enum Order { TIMESTAMP_DESC, TIMESTAMP_ASC, DURATION_ASC, DURATION_DESC, NONE } - -/** - * The raw data in our storage might have various problems. How should we adjust it before - * returning it to the user? - * - * Time skew adjuster tries to make sure that even though servers might have slightly - * different clocks the annotations in the returned data are adjusted so that they are - * in the correct order. - */ -enum Adjust { NOTHING, TIME_SKEW } - -struct QueryRequest { - 1: string service_name - 2: optional string span_name - 3: optional list annotations - 4: optional list binary_annotations - 5: i64 end_ts - 6: i32 limit - 7: Order order -} - -struct QueryResponse { - 1: list trace_ids - 2: i64 start_ts - 3: i64 end_ts -} - -service ZipkinQuery { - - #************** Index lookups ************** - - QueryResponse getTraceIds(1: QueryRequest request) throws (1: QueryException qe); - - /** - * Fetch trace ids by service and span name. - * Gets "limit" number of entries from before the "end_ts". - * - * Span name is optional. - * Timestamps are in microseconds. - */ - list getTraceIdsBySpanName(1: string service_name, 2: string span_name, - 4: i64 end_ts, 5: i32 limit, 6: Order order) throws (1: QueryException qe); - - /** - * Fetch trace ids by service name. - * Gets "limit" number of entries from before the "end_ts". - * - * Timestamps are in microseconds. - */ - list getTraceIdsByServiceName(1: string service_name, - 3: i64 end_ts, 4: i32 limit, 5: Order order) throws (1: QueryException qe); - - /** - * Fetch trace ids with a particular annotation. - * Gets "limit" number of entries from before the "end_ts". - * - * When requesting based on time based annotations only pass in the first parameter, "annotation" and leave out - * the second "value". If looking for a key-value binary annotation provide both, "annotation" is then the - * key in the key-value. - * - * Timestamps are in microseconds. - */ - list getTraceIdsByAnnotation(1: string service_name, 2: string annotation, 3: binary value, - 5: i64 end_ts, 6: i32 limit, 7: Order order) throws (1: QueryException qe); - - - #************** Fetch traces from id ************** - - /** - * Get the traces that are in the database from the given list of trace ids. - */ - - set tracesExist(1: list trace_ids) throws (1: QueryException qe); - - /** - * Get the full traces associated with the given trace ids. - * - * Second argument is a list of methods of adjusting the trace - * data before returning it. Can be empty. - */ - list getTracesByIds(1: list trace_ids, 2: list adjust) throws (1: QueryException qe); - - /** - * Get the trace timelines associated with the given trace ids. - * This is a convenience method for users that just want to know - * the annotations and the (assumed) order they happened in. - * - * Second argument is a list of methods of adjusting the trace - * data before returning it. Can be empty. - * - * Note that if one of the trace ids does not have any data associated with it, it will not be - * represented in the output list. - */ - list getTraceTimelinesByIds(1: list trace_ids, 2: list adjust) throws (1: QueryException qe); - - /** - * Fetch trace summaries for the given trace ids. - * - * Second argument is a list of methods of adjusting the trace - * data before returning it. Can be empty. - * - * Note that if one of the trace ids does not have any data associated with it, it will not be - * represented in the output list. - */ - list getTraceSummariesByIds(1: list trace_ids, 2: list adjust) throws (1: QueryException qe); - - /** - * Not content with just one of traces, summaries or timelines? Want it all? This is the method for you. - */ - list getTraceCombosByIds(1: list trace_ids, 2: list adjust) throws (1: QueryException qe); - - #************** Misc metadata ************** - - /** - * Fetch all the service names we have seen from now all the way back to the set ttl. - */ - set getServiceNames() throws (1: QueryException qe); - - /** - * Get all the seen span names for a particular service, from now back until the set ttl. - */ - set getSpanNames(1: string service_name) throws (1: QueryException qe); - - #************** TTL related ************** - - /** - * Change the TTL of a trace. If we find an interesting trace we want to keep around for further - * investigation. - */ - void setTraceTimeToLive(1: i64 trace_id, 2: i32 ttl_seconds) throws (1: QueryException qe); - - /** - * Get the TTL in seconds of a specific trace. - */ - i32 getTraceTimeToLive(1: i64 trace_id) throws (1: QueryException qe); - - /** - * Get the data ttl. This is the number of seconds we keep the data around before deleting it. - */ - i32 getDataTimeToLive() throws (1: QueryException qe); - - /** - * Get an aggregate representation of all services paired with every service they call in to. - * This includes information on call counts and mean/stdDev/etc of call durations. The two arguments - * specify epoch time in microseconds. The end time is optional and defaults to one day after the - * start time. - */ - zipkinDependencies.Dependencies getDependencies(1: optional i64 start_time, 2: optional i64 end_time) throws (1: QueryException qe); - - list getTopAnnotations(1: string service_name) throws (1: QueryException qe); - list getTopKeyValueAnnotations(1: string service_name) throws (1: QueryException qe); - - /** - * Given a time stamp, server service name, and rpc name, fetch all of the client services calling in paired - * with the lists of every span duration (list) from the server to client. The lists of span durations - * include information on call counts and mean/stdDev/etc of call durations. - * - * The three arguments specify epoch time in microseconds, server side service name and rpc name. The return maps - * contains the key - client_service_name and value - list. - */ - map> getSpanDurations(1: i64 time_stamp, 2: string service_name, 3: string rpc_name); - - /** - * Given a time stamp, server service name, and rpc name, fetch all of the client services calling in paired - * with the lists of every trace Ids (list) from the server to client. - * - * The three arguments specify epoch time in microseconds, server side service name and rpc name. The return maps - * contains the key - client_service_name and value - list. - */ - map> getServiceNamesToTraceIds(1: i64 time_stamp, 2: string service_name, 3: string rpc_name); -} diff --git a/tracing/zipkin/collector.go b/tracing/zipkin/collector.go deleted file mode 100644 index b7064adb5..000000000 --- a/tracing/zipkin/collector.go +++ /dev/null @@ -1,80 +0,0 @@ -package zipkin - -import "strings" - -// Collector represents a Zipkin trace collector, which is probably a set of -// remote endpoints. -type Collector interface { - Collect(*Span) error - ShouldSample(*Span) bool - Close() error -} - -// NopCollector implements Collector but performs no work. -type NopCollector struct{} - -// Collect implements Collector. -func (NopCollector) Collect(*Span) error { return nil } - -// ShouldSample implements Collector. -func (n NopCollector) ShouldSample(span *Span) bool { return false } - -// Close implements Collector. -func (NopCollector) Close() error { return nil } - -// MultiCollector implements Collector by sending spans to all collectors. -type MultiCollector []Collector - -// Collect implements Collector. -func (c MultiCollector) Collect(s *Span) error { - return c.aggregateErrors(func(coll Collector) error { return coll.Collect(s) }) -} - -// ShouldSample implements Collector. -func (c MultiCollector) ShouldSample(s *Span) bool { return false } - -// Close implements Collector. -func (c MultiCollector) Close() error { - return c.aggregateErrors(func(coll Collector) error { return coll.Close() }) -} - -func (c MultiCollector) aggregateErrors(f func(c Collector) error) error { - var e *collectionError - for i, collector := range c { - if err := f(collector); err != nil { - if e == nil { - e = &collectionError{ - errs: make([]error, len(c)), - } - } - e.errs[i] = err - } - } - return e -} - -// CollectionError represents an array of errors returned by one or more -// failed Collector methods. -type CollectionError interface { - Error() string - GetErrors() []error -} - -type collectionError struct { - errs []error -} - -func (c *collectionError) Error() string { - errs := []string{} - for _, err := range c.errs { - if err != nil { - errs = append(errs, err.Error()) - } - } - return strings.Join(errs, "; ") -} - -// GetErrors implements CollectionError -func (c *collectionError) GetErrors() []error { - return c.errs -} diff --git a/tracing/zipkin/collector_test.go b/tracing/zipkin/collector_test.go deleted file mode 100644 index 0a1402d9c..000000000 --- a/tracing/zipkin/collector_test.go +++ /dev/null @@ -1,99 +0,0 @@ -package zipkin_test - -import ( - "fmt" - "testing" - - "github.com/go-kit/kit/tracing/zipkin" -) - -var s = zipkin.NewSpan("203.0.113.10:1234", "service1", "avg", 123, 456, 0) - -func TestNopCollector(t *testing.T) { - c := zipkin.NopCollector{} - if err := c.Collect(s); err != nil { - t.Error(err) - } - if err := c.Close(); err != nil { - t.Error(err) - } -} - -type stubCollector struct { - errid int - collected bool - closed bool -} - -func (c *stubCollector) Collect(*zipkin.Span) error { - c.collected = true - if c.errid != 0 { - return fmt.Errorf("error %d", c.errid) - } - return nil -} - -func (c *stubCollector) ShouldSample(*zipkin.Span) bool { return true } - -func (c *stubCollector) Close() error { - c.closed = true - if c.errid != 0 { - return fmt.Errorf("error %d", c.errid) - } - return nil -} - -func TestMultiCollector(t *testing.T) { - cs := zipkin.MultiCollector{ - &stubCollector{errid: 1}, - &stubCollector{}, - &stubCollector{errid: 2}, - } - err := cs.Collect(s) - if err == nil { - t.Fatal("wanted error, got none") - } - if want, have := "error 1; error 2", err.Error(); want != have { - t.Errorf("want %q, have %q", want, have) - } - collectionError := err.(zipkin.CollectionError).GetErrors() - if want, have := 3, len(collectionError); want != have { - t.Fatalf("want %d, have %d", want, have) - } - if want, have := cs[0].Collect(s).Error(), collectionError[0].Error(); want != have { - t.Errorf("want %q, have %q", want, have) - } - if want, have := cs[1].Collect(s), collectionError[1]; want != have { - t.Errorf("want %q, have %q", want, have) - } - if want, have := cs[2].Collect(s).Error(), collectionError[2].Error(); want != have { - t.Errorf("want %q, have %q", want, have) - } - - for _, c := range cs { - if !c.(*stubCollector).collected { - t.Error("collect not called") - } - } -} - -func TestMultiCollectorClose(t *testing.T) { - cs := zipkin.MultiCollector{ - &stubCollector{errid: 1}, - &stubCollector{}, - &stubCollector{errid: 2}, - } - err := cs.Close() - if err == nil { - t.Fatal("wanted error, got none") - } - if want, have := "error 1; error 2", err.Error(); want != have { - t.Errorf("want %q, have %q", want, have) - } - - for _, c := range cs { - if !c.(*stubCollector).closed { - t.Error("close not called") - } - } -} diff --git a/tracing/zipkin/_docker/docker-compose-zipkin.yml b/tracing/zipkin/docker-compose-zipkin.yml similarity index 100% rename from tracing/zipkin/_docker/docker-compose-zipkin.yml rename to tracing/zipkin/docker-compose-zipkin.yml diff --git a/tracing/zipkin/kafka.go b/tracing/zipkin/kafka.go deleted file mode 100644 index 7c0d613cb..000000000 --- a/tracing/zipkin/kafka.go +++ /dev/null @@ -1,118 +0,0 @@ -package zipkin - -import ( - "math/rand" - - "github.com/apache/thrift/lib/go/thrift" - "gopkg.in/Shopify/sarama.v1" - - "github.com/go-kit/kit/log" -) - -// defaultKafkaTopic sets the standard Kafka topic our Collector will publish -// on. The default topic for zipkin-receiver-kafka is "zipkin", see: -// https://github.com/openzipkin/zipkin/tree/master/zipkin-receiver-kafka -const defaultKafkaTopic = "zipkin" - -// KafkaCollector implements Collector by publishing spans to a Kafka -// broker. -type KafkaCollector struct { - producer sarama.AsyncProducer - logger log.Logger - topic string - shouldSample Sampler -} - -// KafkaOption sets a parameter for the KafkaCollector -type KafkaOption func(c *KafkaCollector) - -// KafkaLogger sets the logger used to report errors in the collection -// process. By default, a no-op logger is used, i.e. no errors are logged -// anywhere. It's important to set this option. -func KafkaLogger(logger log.Logger) KafkaOption { - return func(c *KafkaCollector) { c.logger = logger } -} - -// KafkaProducer sets the producer used to produce to Kafka. -func KafkaProducer(p sarama.AsyncProducer) KafkaOption { - return func(c *KafkaCollector) { c.producer = p } -} - -// KafkaTopic sets the kafka topic to attach the collector producer on. -func KafkaTopic(t string) KafkaOption { - return func(c *KafkaCollector) { c.topic = t } -} - -// KafkaSampleRate sets the sample rate used to determine if a trace will be -// sent to the collector. By default, the sample rate is 1.0, i.e. all traces -// are sent. -func KafkaSampleRate(sr Sampler) KafkaOption { - return func(c *KafkaCollector) { c.shouldSample = sr } -} - -// NewKafkaCollector returns a new Kafka-backed Collector. addrs should be a -// slice of TCP endpoints of the form "host:port". -func NewKafkaCollector(addrs []string, options ...KafkaOption) (Collector, error) { - c := &KafkaCollector{ - logger: log.NewNopLogger(), - topic: defaultKafkaTopic, - shouldSample: SampleRate(1.0, rand.Int63()), - } - - for _, option := range options { - option(c) - } - - if c.producer == nil { - p, err := sarama.NewAsyncProducer(addrs, nil) - if err != nil { - return nil, err - } - c.producer = p - } - - go c.logErrors() - - return c, nil -} - -func (c *KafkaCollector) logErrors() { - for pe := range c.producer.Errors() { - c.logger.Log("msg", pe.Msg, "err", pe.Err, "result", "failed to produce msg") - } -} - -// Collect implements Collector. -func (c *KafkaCollector) Collect(s *Span) error { - if c.ShouldSample(s) || s.debug { - c.producer.Input() <- &sarama.ProducerMessage{ - Topic: c.topic, - Key: nil, - Value: sarama.ByteEncoder(kafkaSerialize(s)), - } - } - return nil -} - -// ShouldSample implements Collector. -func (c *KafkaCollector) ShouldSample(s *Span) bool { - if !s.sampled && s.runSampler { - s.runSampler = false - s.sampled = c.shouldSample(s.TraceID()) - } - return s.sampled -} - -// Close implements Collector. -func (c *KafkaCollector) Close() error { - return c.producer.Close() -} - -func kafkaSerialize(s *Span) []byte { - t := thrift.NewTMemoryBuffer() - p := thrift.NewTBinaryProtocolTransport(t) - if err := s.Encode().Write(p); err != nil { - panic(err) - } - return t.Buffer.Bytes() -} diff --git a/tracing/zipkin/kafka_test.go b/tracing/zipkin/kafka_test.go deleted file mode 100644 index ad96c90dc..000000000 --- a/tracing/zipkin/kafka_test.go +++ /dev/null @@ -1,192 +0,0 @@ -package zipkin_test - -import ( - "errors" - "testing" - "time" - - "github.com/apache/thrift/lib/go/thrift" - "gopkg.in/Shopify/sarama.v1" - - "github.com/go-kit/kit/log" - "github.com/go-kit/kit/tracing/zipkin" - "github.com/go-kit/kit/tracing/zipkin/_thrift/gen-go/zipkincore" -) - -type stubProducer struct { - in chan *sarama.ProducerMessage - err chan *sarama.ProducerError - kdown bool - closed bool -} - -func (p *stubProducer) AsyncClose() {} -func (p *stubProducer) Close() error { - if p.kdown { - return errors.New("Kafka is down") - } - p.closed = true - return nil -} -func (p *stubProducer) Input() chan<- *sarama.ProducerMessage { return p.in } -func (p *stubProducer) Successes() <-chan *sarama.ProducerMessage { return nil } -func (p *stubProducer) Errors() <-chan *sarama.ProducerError { return p.err } - -func newStubProducer(kdown bool) *stubProducer { - return &stubProducer{ - make(chan *sarama.ProducerMessage), - make(chan *sarama.ProducerError), - kdown, - false, - } -} - -var spans = []*zipkin.Span{ - zipkin.NewSpan("203.0.113.10:1234", "service1", "avg", 123, 456, 0), - zipkin.NewSpan("203.0.113.10:1234", "service2", "sum", 123, 789, 456), - zipkin.NewSpan("203.0.113.10:1234", "service2", "div", 123, 101112, 456), -} - -func TestKafkaProduce(t *testing.T) { - p := newStubProducer(false) - c, err := zipkin.NewKafkaCollector( - []string{"192.0.2.10:9092"}, zipkin.KafkaProducer(p), - ) - if err != nil { - t.Fatal(err) - } - - for _, want := range spans { - m := collectSpan(t, c, p, want) - testMetadata(t, m) - got := deserializeSpan(t, m.Value) - testEqual(t, want, got) - } -} - -func TestKafkaClose(t *testing.T) { - p := newStubProducer(false) - c, err := zipkin.NewKafkaCollector( - []string{"192.0.2.10:9092"}, zipkin.KafkaProducer(p), - ) - if err != nil { - t.Fatal(err) - } - if err = c.Close(); err != nil { - t.Fatal(err) - } - if !p.closed { - t.Fatal("producer not closed") - } -} - -func TestKafkaCloseError(t *testing.T) { - p := newStubProducer(true) - c, err := zipkin.NewKafkaCollector( - []string{"192.0.2.10:9092"}, zipkin.KafkaProducer(p), - ) - if err != nil { - t.Fatal(err) - } - if err = c.Close(); err == nil { - t.Error("no error on close") - } -} - -func TestKafkaErrors(t *testing.T) { - p := newStubProducer(true) - errs := make(chan []interface{}, len(spans)) - lg := log.Logger(log.LoggerFunc(func(keyvals ...interface{}) error { - for i := 0; i < len(keyvals); i += 2 { - if keyvals[i] == "result" && keyvals[i+1] == "failed to produce msg" { - errs <- keyvals - } - } - return nil - })) - c, err := zipkin.NewKafkaCollector( - []string{"192.0.2.10:9092"}, - zipkin.KafkaProducer(p), - zipkin.KafkaLogger(lg), - ) - if err != nil { - t.Fatal(err) - } - for _, want := range spans { - _ = collectSpan(t, c, p, want) - } - - for i := 0; i < len(spans); i++ { - select { - case <-errs: - case <-time.After(100 * time.Millisecond): - t.Fatalf("errors not logged. got %d, wanted %d", i, len(spans)) - } - } -} - -func collectSpan(t *testing.T, c zipkin.Collector, p *stubProducer, s *zipkin.Span) *sarama.ProducerMessage { - var m *sarama.ProducerMessage - rcvd := make(chan bool, 1) - go func() { - select { - case m = <-p.in: - rcvd <- true - if p.kdown { - p.err <- &sarama.ProducerError{m, errors.New("kafka is down")} - } - case <-time.After(100 * time.Millisecond): - rcvd <- false - } - }() - - if err := c.Collect(s); err != nil { - t.Errorf("error during collection: %v", err) - } - if !<-rcvd { - t.Fatal("span message was not produced") - } - return m -} - -func testMetadata(t *testing.T, m *sarama.ProducerMessage) { - if m.Topic != "zipkin" { - t.Errorf("produced to topic %q, want %q", m.Topic, "zipkin") - } - if m.Key != nil { - t.Errorf("produced with key %q, want nil", m.Key) - } -} - -func deserializeSpan(t *testing.T, e sarama.Encoder) *zipkincore.Span { - bytes, err := e.Encode() - if err != nil { - t.Errorf("error in encoding: %v", err) - } - s := zipkincore.NewSpan() - mb := thrift.NewTMemoryBufferLen(len(bytes)) - mb.Write(bytes) - mb.Flush() - pt := thrift.NewTBinaryProtocolTransport(mb) - err = s.Read(pt) - if err != nil { - t.Errorf("error in decoding: %v", err) - } - return s -} - -func testEqual(t *testing.T, want *zipkin.Span, got *zipkincore.Span) { - if got.TraceId != want.TraceID() { - t.Errorf("trace_id %d, want %d", got.TraceId, want.TraceID()) - } - if got.Id != want.SpanID() { - t.Errorf("id %d, want %d", got.Id, want.SpanID()) - } - if got.ParentId == nil { - if want.ParentSpanID() != 0 { - t.Errorf("parent_id %d, want %d", got.ParentId, want.ParentSpanID()) - } - } else if *got.ParentId != want.ParentSpanID() { - t.Errorf("parent_id %d, want %d", got.ParentId, want.ParentSpanID()) - } -} diff --git a/tracing/zipkin/sample.go b/tracing/zipkin/sample.go deleted file mode 100644 index 1d5221add..000000000 --- a/tracing/zipkin/sample.go +++ /dev/null @@ -1,26 +0,0 @@ -package zipkin - -import "math" - -// Sampler functions return if a Zipkin span should be sampled, based on its -// traceID. -type Sampler func(id int64) bool - -// SampleRate returns a sampler function using a particular sample rate and a -// sample salt to identify if a Zipkin span based on its spanID should be -// collected. -func SampleRate(rate float64, salt int64) Sampler { - if rate <= 0 { - return func(_ int64) bool { - return false - } - } - if rate >= 1.0 { - return func(_ int64) bool { - return true - } - } - return func(id int64) bool { - return int64(math.Abs(float64(id^salt)))%10000 < int64(rate*10000) - } -} diff --git a/tracing/zipkin/sample_test.go b/tracing/zipkin/sample_test.go deleted file mode 100644 index 98103c655..000000000 --- a/tracing/zipkin/sample_test.go +++ /dev/null @@ -1,36 +0,0 @@ -package zipkin_test - -import ( - "testing" - - "github.com/go-kit/kit/tracing/zipkin" -) - -func TestSampleRate(t *testing.T) { - type triple struct { - id, salt int64 - rate float64 - } - for input, want := range map[triple]bool{ - triple{123, 456, 1.0}: true, - triple{123, 456, 999}: true, - triple{123, 456, 0.0}: false, - triple{123, 456, -42}: false, - triple{1229998, 0, 0.01}: false, - triple{1229999, 0, 0.01}: false, - triple{1230000, 0, 0.01}: true, - triple{1230001, 0, 0.01}: true, - triple{1230098, 0, 0.01}: true, - triple{1230099, 0, 0.01}: true, - triple{1230100, 0, 0.01}: false, - triple{1230101, 0, 0.01}: false, - triple{1, 9999999, 0.01}: false, - triple{999, 0, 0.99}: true, - triple{9999, 0, 0.99}: false, - } { - sampler := zipkin.SampleRate(input.rate, input.salt) - if have := sampler(input.id); want != have { - t.Errorf("%#+v: want %v, have %v", input, want, have) - } - } -} diff --git a/tracing/zipkin/scribe.go b/tracing/zipkin/scribe.go deleted file mode 100644 index e11f71d65..000000000 --- a/tracing/zipkin/scribe.go +++ /dev/null @@ -1,205 +0,0 @@ -package zipkin - -import ( - "encoding/base64" - "fmt" - "math/rand" - "net" - "time" - - "github.com/apache/thrift/lib/go/thrift" - - "github.com/go-kit/kit/log" - "github.com/go-kit/kit/tracing/zipkin/_thrift/gen-go/scribe" -) - -const defaultScribeCategory = "zipkin" - -// defaultBatchInterval in seconds -const defaultBatchInterval = 1 - -// ScribeCollector implements Collector by forwarding spans to a Scribe -// service, in batches. -type ScribeCollector struct { - client scribe.Scribe - factory func() (scribe.Scribe, error) - spanc chan *Span - sendc chan struct{} - batch []*scribe.LogEntry - nextSend time.Time - batchInterval time.Duration - batchSize int - shouldSample Sampler - logger log.Logger - category string - quit chan struct{} -} - -// NewScribeCollector returns a new Scribe-backed Collector. addr should be a -// TCP endpoint of the form "host:port". timeout is passed to the Thrift dial -// function NewTSocketFromAddrTimeout. batchSize and batchInterval control the -// maximum size and interval of a batch of spans; as soon as either limit is -// reached, the batch is sent. The logger is used to log errors, such as batch -// send failures; users should provide an appropriate context, if desired. -func NewScribeCollector(addr string, timeout time.Duration, options ...ScribeOption) (Collector, error) { - factory := scribeClientFactory(addr, timeout) - client, err := factory() - if err != nil { - return nil, err - } - c := &ScribeCollector{ - client: client, - factory: factory, - spanc: make(chan *Span), - sendc: make(chan struct{}), - batch: []*scribe.LogEntry{}, - batchInterval: defaultBatchInterval * time.Second, - batchSize: 100, - shouldSample: SampleRate(1.0, rand.Int63()), - logger: log.NewNopLogger(), - category: defaultScribeCategory, - quit: make(chan struct{}), - } - for _, option := range options { - option(c) - } - c.nextSend = time.Now().Add(c.batchInterval) - go c.loop() - return c, nil -} - -// Collect implements Collector. -func (c *ScribeCollector) Collect(s *Span) error { - if c.ShouldSample(s) || s.debug { - c.spanc <- s - } - return nil // accepted -} - -// ShouldSample implements Collector. -func (c *ScribeCollector) ShouldSample(s *Span) bool { - if !s.sampled && s.runSampler { - s.runSampler = false - s.sampled = c.shouldSample(s.TraceID()) - } - return s.sampled -} - -// Close implements Collector. -func (c *ScribeCollector) Close() error { - close(c.quit) - return nil -} - -func (c *ScribeCollector) loop() { - tickc := time.Tick(c.batchInterval / 10) - - for { - select { - case span := <-c.spanc: - c.batch = append(c.batch, &scribe.LogEntry{ - Category: c.category, - Message: scribeSerialize(span), - }) - if len(c.batch) >= c.batchSize { - go c.sendNow() - } - - case <-tickc: - if time.Now().After(c.nextSend) { - go c.sendNow() - } - - case <-c.sendc: - c.nextSend = time.Now().Add(c.batchInterval) - if err := c.send(c.batch); err != nil { - c.logger.Log("err", err.Error()) - } - c.batch = c.batch[:0] - case <-c.quit: - return - } - } -} - -func (c *ScribeCollector) sendNow() { - c.sendc <- struct{}{} -} - -func (c *ScribeCollector) send(batch []*scribe.LogEntry) error { - if c.client == nil { - var err error - if c.client, err = c.factory(); err != nil { - return fmt.Errorf("during reconnect: %v", err) - } - } - if rc, err := c.client.Log(c.batch); err != nil { - c.client = nil - return fmt.Errorf("during Log: %v", err) - } else if rc != scribe.ResultCode_OK { - // probably transient error; don't reset client - return fmt.Errorf("remote returned %s", rc) - } - return nil -} - -// ScribeOption sets a parameter for the StdlibAdapter. -type ScribeOption func(s *ScribeCollector) - -// ScribeBatchSize sets the maximum batch size, after which a collect will be -// triggered. The default batch size is 100 traces. -func ScribeBatchSize(n int) ScribeOption { - return func(s *ScribeCollector) { s.batchSize = n } -} - -// ScribeBatchInterval sets the maximum duration we will buffer traces before -// emitting them to the collector. The default batch interval is 1 second. -func ScribeBatchInterval(d time.Duration) ScribeOption { - return func(s *ScribeCollector) { s.batchInterval = d } -} - -// ScribeSampleRate sets the sample rate used to determine if a trace will be -// sent to the collector. By default, the sample rate is 1.0, i.e. all traces -// are sent. -func ScribeSampleRate(sr Sampler) ScribeOption { - return func(s *ScribeCollector) { s.shouldSample = sr } -} - -// ScribeLogger sets the logger used to report errors in the collection -// process. By default, a no-op logger is used, i.e. no errors are logged -// anywhere. It's important to set this option in a production service. -func ScribeLogger(logger log.Logger) ScribeOption { - return func(s *ScribeCollector) { s.logger = logger } -} - -// ScribeCategory sets the Scribe category used to transmit the spans. -func ScribeCategory(category string) ScribeOption { - return func(s *ScribeCollector) { s.category = category } -} - -func scribeClientFactory(addr string, timeout time.Duration) func() (scribe.Scribe, error) { - return func() (scribe.Scribe, error) { - a, err := net.ResolveTCPAddr("tcp", addr) - if err != nil { - return nil, err - } - socket := thrift.NewTSocketFromAddrTimeout(a, timeout) - transport := thrift.NewTFramedTransport(socket) - if err := transport.Open(); err != nil { - socket.Close() - return nil, err - } - proto := thrift.NewTBinaryProtocolTransport(transport) - client := scribe.NewScribeClientProtocol(transport, proto, proto) - return client, nil - } -} - -func scribeSerialize(s *Span) string { - t := thrift.NewTMemoryBuffer() - p := thrift.NewTBinaryProtocolTransport(t) - if err := s.Encode().Write(p); err != nil { - panic(err) - } - return base64.StdEncoding.EncodeToString(t.Buffer.Bytes()) -} diff --git a/tracing/zipkin/scribe_test.go b/tracing/zipkin/scribe_test.go deleted file mode 100644 index d4802708c..000000000 --- a/tracing/zipkin/scribe_test.go +++ /dev/null @@ -1,197 +0,0 @@ -package zipkin_test - -import ( - "encoding/base64" - "fmt" - "math/rand" - "net" - "sync" - "testing" - "time" - - "github.com/apache/thrift/lib/go/thrift" - - "github.com/go-kit/kit/tracing/zipkin" - "github.com/go-kit/kit/tracing/zipkin/_thrift/gen-go/scribe" - "github.com/go-kit/kit/tracing/zipkin/_thrift/gen-go/zipkincore" -) - -func TestScribeCollector(t *testing.T) { - server := newScribeServer(t) - - timeout := time.Second - batchInterval := time.Millisecond - c, err := zipkin.NewScribeCollector(server.addr(), timeout, zipkin.ScribeBatchSize(0), zipkin.ScribeBatchInterval(batchInterval)) - if err != nil { - t.Fatal(err) - } - - var ( - serviceName = "service" - methodName = "method" - traceID = int64(123) - spanID = int64(456) - parentSpanID = int64(0) - value = "foo" - ) - - span := zipkin.NewSpan("1.2.3.4:1234", serviceName, methodName, traceID, spanID, parentSpanID) - span.Annotate("foo") - if err := c.Collect(span); err != nil { - t.Errorf("error during collection: %v", err) - } - - // Need to yield to the select loop to accept the send request, and then - // yield again to the send operation to write to the socket. I think the - // best way to do that is just give it some time. - - deadline := time.Now().Add(1 * time.Second) - for { - if time.Now().After(deadline) { - t.Fatalf("never received a span") - } - if want, have := 1, len(server.spans()); want != have { - time.Sleep(time.Millisecond) - continue - } - break - } - - gotSpan := server.spans()[0] - if want, have := methodName, gotSpan.GetName(); want != have { - t.Errorf("want %q, have %q", want, have) - } - if want, have := traceID, gotSpan.GetTraceId(); want != have { - t.Errorf("want %d, have %d", want, have) - } - if want, have := spanID, gotSpan.GetId(); want != have { - t.Errorf("want %d, have %d", want, have) - } - if want, have := parentSpanID, gotSpan.GetParentId(); want != have { - t.Errorf("want %d, have %d", want, have) - } - - if want, have := 1, len(gotSpan.GetAnnotations()); want != have { - t.Fatalf("want %d, have %d", want, have) - } - - gotAnnotation := gotSpan.GetAnnotations()[0] - if want, have := value, gotAnnotation.GetValue(); want != have { - t.Errorf("want %q, have %q", want, have) - } -} - -type scribeServer struct { - t *testing.T - transport *thrift.TServerSocket - address string - server *thrift.TSimpleServer - handler *scribeHandler -} - -func newScribeServer(t *testing.T) *scribeServer { - protocolFactory := thrift.NewTBinaryProtocolFactoryDefault() - transportFactory := thrift.NewTFramedTransportFactory(thrift.NewTTransportFactory()) - - var port int - var transport *thrift.TServerSocket - var err error - for i := 0; i < 10; i++ { - port = 10000 + rand.Intn(10000) - transport, err = thrift.NewTServerSocket(fmt.Sprintf(":%d", port)) - if err != nil { - t.Logf("port %d: %v", port, err) - continue - } - break - } - if err != nil { - t.Fatal(err) - } - - handler := newScribeHandler(t) - server := thrift.NewTSimpleServer4( - scribe.NewScribeProcessor(handler), - transport, - transportFactory, - protocolFactory, - ) - - go server.Serve() - - deadline := time.Now().Add(time.Second) - for !canConnect(port) { - if time.Now().After(deadline) { - t.Fatal("server never started") - } - time.Sleep(time.Millisecond) - } - - return &scribeServer{ - transport: transport, - address: fmt.Sprintf("127.0.0.1:%d", port), - handler: handler, - } -} - -func (s *scribeServer) addr() string { - return s.address -} - -func (s *scribeServer) spans() []*zipkincore.Span { - return s.handler.spans() -} - -type scribeHandler struct { - t *testing.T - sync.RWMutex - entries []*scribe.LogEntry -} - -func newScribeHandler(t *testing.T) *scribeHandler { - return &scribeHandler{t: t} -} - -func (h *scribeHandler) Log(messages []*scribe.LogEntry) (scribe.ResultCode, error) { - h.Lock() - defer h.Unlock() - for _, m := range messages { - h.entries = append(h.entries, m) - } - return scribe.ResultCode_OK, nil -} - -func (h *scribeHandler) spans() []*zipkincore.Span { - h.RLock() - defer h.RUnlock() - spans := []*zipkincore.Span{} - for _, m := range h.entries { - decoded, err := base64.StdEncoding.DecodeString(m.GetMessage()) - if err != nil { - h.t.Error(err) - continue - } - buffer := thrift.NewTMemoryBuffer() - if _, err := buffer.Write(decoded); err != nil { - h.t.Error(err) - continue - } - transport := thrift.NewTBinaryProtocolTransport(buffer) - zs := &zipkincore.Span{} - if err := zs.Read(transport); err != nil { - h.t.Error(err) - continue - } - spans = append(spans, zs) - } - return spans -} - -func canConnect(port int) bool { - c, err := net.Dial("tcp", fmt.Sprintf("127.0.0.1:%d", port)) - if err != nil { - return false - } - c.Close() - return true -} diff --git a/tracing/zipkin/span.go b/tracing/zipkin/span.go deleted file mode 100644 index c75938f74..000000000 --- a/tracing/zipkin/span.go +++ /dev/null @@ -1,347 +0,0 @@ -package zipkin - -import ( - "encoding/binary" - "fmt" - "math" - "net" - "strconv" - "time" - - "golang.org/x/net/context" - - "github.com/go-kit/kit/tracing/zipkin/_thrift/gen-go/zipkincore" -) - -// A Span is a named collection of annotations. It represents meaningful -// information about a single method call, i.e. a single request against a -// service. Clients should annotate the span, and submit it when the request -// that generated it is complete. -type Span struct { - host *zipkincore.Endpoint - methodName string - - traceID int64 - spanID int64 - parentSpanID int64 - - annotations []annotation - binaryAnnotations []binaryAnnotation - - debug bool - sampled bool - runSampler bool -} - -// NewSpan returns a new Span, which can be annotated and collected by a -// collector. Spans are passed through the request context to each middleware -// under the SpanContextKey. -func NewSpan(hostport, serviceName, methodName string, traceID, spanID, parentSpanID int64) *Span { - return &Span{ - host: makeEndpoint(hostport, serviceName), - methodName: methodName, - traceID: traceID, - spanID: spanID, - parentSpanID: parentSpanID, - runSampler: true, - } -} - -// makeEndpoint takes the hostport and service name that represent this Zipkin -// service, and returns an endpoint that's embedded into the Zipkin core Span -// type. It will return a nil endpoint if the input parameters are malformed. -func makeEndpoint(hostport, serviceName string) *zipkincore.Endpoint { - host, port, err := net.SplitHostPort(hostport) - if err != nil { - return nil - } - portInt, err := strconv.ParseInt(port, 10, 16) - if err != nil { - return nil - } - addrs, err := net.LookupIP(host) - if err != nil { - return nil - } - // we need the first IPv4 address. - var addr net.IP - for i := range addrs { - addr = addrs[i].To4() - if addr != nil { - break - } - } - if addr == nil { - // none of the returned addresses is IPv4. - return nil - } - endpoint := zipkincore.NewEndpoint() - endpoint.Ipv4 = (int32)(binary.BigEndian.Uint32(addr)) - endpoint.Port = int16(portInt) - endpoint.ServiceName = serviceName - return endpoint -} - -// MakeNewSpanFunc returns a function that generates a new Zipkin span. -func MakeNewSpanFunc(hostport, serviceName, methodName string) NewSpanFunc { - return func(traceID, spanID, parentSpanID int64) *Span { - return NewSpan(hostport, serviceName, methodName, traceID, spanID, parentSpanID) - } -} - -// NewSpanFunc takes trace, span, & parent span IDs to produce a Span object. -type NewSpanFunc func(traceID, spanID, parentSpanID int64) *Span - -// TraceID returns the ID of the trace that this span is a member of. -func (s *Span) TraceID() int64 { return s.traceID } - -// SpanID returns the ID of this span. -func (s *Span) SpanID() int64 { return s.spanID } - -// ParentSpanID returns the ID of the span which invoked this span. -// It may be zero. -func (s *Span) ParentSpanID() int64 { return s.parentSpanID } - -// Sample forces sampling of this span. -func (s *Span) Sample() { - s.sampled = true -} - -// SetDebug forces debug mode on this span. -func (s *Span) SetDebug() { - s.debug = true -} - -// Annotate annotates the span with the given value. -func (s *Span) Annotate(value string) { - s.annotations = append(s.annotations, annotation{ - timestamp: time.Now(), - value: value, - host: s.host, - }) -} - -// AnnotateBinary annotates the span with a key and a value that will be []byte -// encoded. -func (s *Span) AnnotateBinary(key string, value interface{}) { - var a zipkincore.AnnotationType - var b []byte - // We are not using zipkincore.AnnotationType_I16 for types that could fit - // as reporting on it seems to be broken on the zipkin web interface - // (however, we can properly extract the number from zipkin storage - // directly). int64 has issues with negative numbers but seems ok for - // positive numbers needing more than 32 bit. - switch v := value.(type) { - case bool: - a = zipkincore.AnnotationType_BOOL - b = []byte("\x00") - if v { - b = []byte("\x01") - } - case []byte: - a = zipkincore.AnnotationType_BYTES - b = v - case byte: - a = zipkincore.AnnotationType_I32 - b = make([]byte, 4) - binary.BigEndian.PutUint32(b, uint32(v)) - case int8: - a = zipkincore.AnnotationType_I32 - b = make([]byte, 4) - binary.BigEndian.PutUint32(b, uint32(v)) - case int16: - a = zipkincore.AnnotationType_I32 - b = make([]byte, 4) - binary.BigEndian.PutUint32(b, uint32(v)) - case uint16: - a = zipkincore.AnnotationType_I32 - b = make([]byte, 4) - binary.BigEndian.PutUint32(b, uint32(v)) - case int32: - a = zipkincore.AnnotationType_I32 - b = make([]byte, 4) - binary.BigEndian.PutUint32(b, uint32(v)) - case uint32: - a = zipkincore.AnnotationType_I32 - b = make([]byte, 4) - binary.BigEndian.PutUint32(b, uint32(v)) - case int64: - a = zipkincore.AnnotationType_I64 - b = make([]byte, 8) - binary.BigEndian.PutUint64(b, uint64(v)) - case int: - a = zipkincore.AnnotationType_I32 - b = make([]byte, 8) - binary.BigEndian.PutUint32(b, uint32(v)) - case uint: - a = zipkincore.AnnotationType_I32 - b = make([]byte, 8) - binary.BigEndian.PutUint32(b, uint32(v)) - case uint64: - a = zipkincore.AnnotationType_I64 - b = make([]byte, 8) - binary.BigEndian.PutUint64(b, uint64(v)) - case float32: - a = zipkincore.AnnotationType_DOUBLE - b = make([]byte, 8) - bits := math.Float64bits(float64(v)) - binary.BigEndian.PutUint64(b, bits) - case float64: - a = zipkincore.AnnotationType_DOUBLE - b = make([]byte, 8) - bits := math.Float64bits(v) - binary.BigEndian.PutUint64(b, bits) - case string: - a = zipkincore.AnnotationType_STRING - b = []byte(v) - default: - // we have no handler for type's value, but let's get a string - // representation of it. - a = zipkincore.AnnotationType_STRING - b = []byte(fmt.Sprintf("%+v", value)) - } - s.binaryAnnotations = append(s.binaryAnnotations, binaryAnnotation{ - key: key, - value: b, - annotationType: a, - host: s.host, - }) -} - -// AnnotateString annotates the span with a key and a string value. -// Deprecated: use AnnotateBinary instead. -func (s *Span) AnnotateString(key, value string) { - s.binaryAnnotations = append(s.binaryAnnotations, binaryAnnotation{ - key: key, - value: []byte(value), - annotationType: zipkincore.AnnotationType_STRING, - host: s.host, - }) -} - -// SpanOption sets an optional parameter for Spans. -type SpanOption func(s *Span) - -// ServerAddr will create a ServerAddr annotation with its own zipkin Endpoint -// when used with NewChildSpan. This is typically used when the NewChildSpan is -// used to annotate non Zipkin aware resources like databases and caches. -func ServerAddr(hostport, serviceName string) SpanOption { - return func(s *Span) { - e := makeEndpoint(hostport, serviceName) - if e != nil { - host := s.host - s.host = e // set temporary Endpoint - s.AnnotateBinary(ServerAddress, true) // use - s.host = host // reset - } - } -} - -// Host will update the default zipkin Endpoint of the Span it is used with. -func Host(hostport, serviceName string) SpanOption { - return func(s *Span) { - e := makeEndpoint(hostport, serviceName) - if e != nil { - s.host = e // update - } - } -} - -// Debug will set the Span to debug mode forcing Samplers to pass the Span. -func Debug(debug bool) SpanOption { - return func(s *Span) { - s.debug = debug - } -} - -// CollectFunc will collect the span created with NewChildSpan. -type CollectFunc func() - -// NewChildSpan returns a new child Span of a parent Span extracted from the -// passed context. It can be used to annotate resources like databases, caches, -// etc. and treat them as if they are a regular service. For tracing client -// endpoints use AnnotateClient instead. -func NewChildSpan(ctx context.Context, collector Collector, methodName string, options ...SpanOption) (*Span, CollectFunc) { - span, ok := FromContext(ctx) - if !ok { - return nil, func() {} - } - childSpan := &Span{ - host: span.host, - methodName: methodName, - traceID: span.traceID, - spanID: newID(), - parentSpanID: span.spanID, - debug: span.debug, - sampled: span.sampled, - runSampler: span.runSampler, - } - childSpan.Annotate(ClientSend) - for _, option := range options { - option(childSpan) - } - collectFunc := func() { - if childSpan != nil { - childSpan.Annotate(ClientReceive) - collector.Collect(childSpan) - childSpan = nil - } - } - return childSpan, collectFunc -} - -// IsSampled returns if the span is set to be sampled. -func (s *Span) IsSampled() bool { - return s.sampled -} - -// Encode creates a Thrift Span from the gokit Span. -func (s *Span) Encode() *zipkincore.Span { - // TODO lots of garbage here. We can improve by preallocating e.g. the - // Thrift stuff into an encoder struct, owned by the ScribeCollector. - zs := zipkincore.Span{ - TraceId: s.traceID, - Name: s.methodName, - Id: s.spanID, - Debug: s.debug, - } - - if s.parentSpanID != 0 { - zs.ParentId = new(int64) - (*zs.ParentId) = s.parentSpanID - } - - zs.Annotations = make([]*zipkincore.Annotation, len(s.annotations)) - for i, a := range s.annotations { - zs.Annotations[i] = &zipkincore.Annotation{ - Timestamp: a.timestamp.UnixNano() / 1e3, - Value: a.value, - Host: a.host, - } - } - - zs.BinaryAnnotations = make([]*zipkincore.BinaryAnnotation, len(s.binaryAnnotations)) - for i, a := range s.binaryAnnotations { - zs.BinaryAnnotations[i] = &zipkincore.BinaryAnnotation{ - Key: a.key, - Value: a.value, - AnnotationType: a.annotationType, - Host: a.host, - } - } - - return &zs -} - -type annotation struct { - timestamp time.Time - value string - host *zipkincore.Endpoint -} - -type binaryAnnotation struct { - key string - value []byte - annotationType zipkincore.AnnotationType - host *zipkincore.Endpoint -} diff --git a/tracing/zipkin/span_test.go b/tracing/zipkin/span_test.go deleted file mode 100644 index 0918c6dd8..000000000 --- a/tracing/zipkin/span_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package zipkin_test - -import ( - "bytes" - "testing" - - "github.com/go-kit/kit/tracing/zipkin" -) - -func TestAnnotateBinaryEncodesKeyValueAsBytes(t *testing.T) { - key := "awesome-bytes-test" - value := []byte("this is neat") - - span := &zipkin.Span{} - span.AnnotateBinary(key, value) - - encodedSpan := span.Encode() - annotations := encodedSpan.GetBinaryAnnotations() - - if len(annotations) == 0 { - t.Error("want non-zero length slice, have empty slice") - } - - if want, have := key, annotations[0].Key; want != have { - t.Errorf("want %q, got %q", want, have) - } - - if want, have := value, annotations[0].Value; bytes.Compare(want, have) != 0 { - t.Errorf("want %s, got %s", want, have) - } -} - -func TestAnnotateStringEncodesKeyValueAsBytes(t *testing.T) { - key := "awesome-string-test" - value := "this is neat" - - span := &zipkin.Span{} - span.AnnotateString(key, value) - - encodedSpan := span.Encode() - annotations := encodedSpan.GetBinaryAnnotations() - - if len(annotations) == 0 { - t.Error("want non-zero length slice, have empty slice") - } - - if want, have := key, annotations[0].Key; want != have { - t.Errorf("want %q, got %q", want, have) - } - - if want, have := value, annotations[0].Value; bytes.Compare([]byte(want), have) != 0 { - t.Errorf("want %s, got %s", want, have) - } -} diff --git a/tracing/zipkin/zipkin.go b/tracing/zipkin/zipkin.go deleted file mode 100644 index cd11c1b03..000000000 --- a/tracing/zipkin/zipkin.go +++ /dev/null @@ -1,332 +0,0 @@ -package zipkin - -import ( - "math/rand" - "net/http" - "strconv" - - "golang.org/x/net/context" - "google.golang.org/grpc/metadata" - - "github.com/go-kit/kit/endpoint" - "github.com/go-kit/kit/log" -) - -// In Zipkin, "spans are considered to start and stop with the client." The -// client is responsible for creating a new span ID for each outgoing request, -// copying its span ID to the parent span ID, and maintaining the same trace -// ID. The server-receive and server-send annotations can be considered value -// added information and aren't strictly necessary. -// -// Further reading: -// • http://www.slideshare.net/johanoskarsson/zipkin-runtime-open-house -// • https://groups.google.com/forum/#!topic/zipkin-user/KilwtSA0g1k -// • https://gist.github.com/yoavaa/3478d3a0df666f21a98c - -const ( - // SpanContextKey holds the key used to store Zipkin spans in the context. - SpanContextKey = "Zipkin-Span" - - // https://github.com/racker/tryfer#headers - traceIDHTTPHeader = "X-B3-TraceId" - spanIDHTTPHeader = "X-B3-SpanId" - parentSpanIDHTTPHeader = "X-B3-ParentSpanId" - sampledHTTPHeader = "X-B3-Sampled" - - // gRPC keys are always lowercase - traceIDGRPCKey = "x-b3-traceid" - spanIDGRPCKey = "x-b3-spanid" - parentSpanIDGRPCKey = "x-b3-parentspanid" - sampledGRPCKey = "x-b3-sampled" - - // ClientSend is the annotation value used to mark a client sending a - // request to a server. - ClientSend = "cs" - - // ServerReceive is the annotation value used to mark a server's receipt - // of a request from a client. - ServerReceive = "sr" - - // ServerSend is the annotation value used to mark a server's completion - // of a request and response to a client. - ServerSend = "ss" - - // ClientReceive is the annotation value used to mark a client's receipt - // of a completed request from a server. - ClientReceive = "cr" - - // ServerAddress allows to annotate the server endpoint in case the server - // side trace is not instrumented as with resources like caches and - // databases. - ServerAddress = "sa" - - // ClientAddress allows to annotate the client origin in case the client was - // forwarded by a proxy which does not instrument itself. - ClientAddress = "ca" -) - -// AnnotateServer returns a server.Middleware that extracts a span from the -// context, adds server-receive and server-send annotations at the boundaries, -// and submits the span to the collector. If no span is found in the context, -// a new span is generated and inserted. -func AnnotateServer(newSpan NewSpanFunc, c Collector) endpoint.Middleware { - return func(next endpoint.Endpoint) endpoint.Endpoint { - return func(ctx context.Context, request interface{}) (interface{}, error) { - span, ok := FromContext(ctx) - if !ok { - traceID := newID() - span = newSpan(traceID, traceID, 0) - ctx = context.WithValue(ctx, SpanContextKey, span) - } - c.ShouldSample(span) - span.Annotate(ServerReceive) - defer func() { span.Annotate(ServerSend); c.Collect(span) }() - return next(ctx, request) - } - } -} - -// AnnotateClient returns a middleware that extracts a parent span from the -// context, produces a client (child) span from it, adds client-send and -// client-receive annotations at the boundaries, and submits the span to the -// collector. If no span is found in the context, a new span is generated and -// inserted. -func AnnotateClient(newSpan NewSpanFunc, c Collector) endpoint.Middleware { - return func(next endpoint.Endpoint) endpoint.Endpoint { - return func(ctx context.Context, request interface{}) (interface{}, error) { - var clientSpan *Span - parentSpan, ok := FromContext(ctx) - if ok { - clientSpan = newSpan(parentSpan.TraceID(), newID(), parentSpan.SpanID()) - clientSpan.runSampler = false - clientSpan.sampled = c.ShouldSample(parentSpan) - } else { - // Abnormal operation. Traces should always start server side. - // We create a root span but annotate with a warning. - traceID := newID() - clientSpan = newSpan(traceID, traceID, 0) - c.ShouldSample(clientSpan) - clientSpan.AnnotateBinary("warning", "missing server side trace") - } - ctx = context.WithValue(ctx, SpanContextKey, clientSpan) // set - defer func() { ctx = context.WithValue(ctx, SpanContextKey, parentSpan) }() // reset - clientSpan.Annotate(ClientSend) - defer func() { clientSpan.Annotate(ClientReceive); c.Collect(clientSpan) }() - return next(ctx, request) - } - } -} - -// ToContext returns a function that satisfies transport/http.BeforeFunc. It -// takes a Zipkin span from the incoming HTTP request, and saves it in the -// request context. It's designed to be wired into a server's HTTP transport -// Before stack. The logger is used to report errors. -func ToContext(newSpan NewSpanFunc, logger log.Logger) func(ctx context.Context, r *http.Request) context.Context { - return func(ctx context.Context, r *http.Request) context.Context { - span := fromHTTP(newSpan, r, logger) - if span == nil { - return ctx - } - return context.WithValue(ctx, SpanContextKey, span) - } -} - -// ToGRPCContext returns a function that satisfies transport/grpc.BeforeFunc. It -// takes a Zipkin span from the incoming GRPC request, and saves it in the -// request context. It's designed to be wired into a server's GRPC transport -// Before stack. The logger is used to report errors. -func ToGRPCContext(newSpan NewSpanFunc, logger log.Logger) func(ctx context.Context, md *metadata.MD) context.Context { - return func(ctx context.Context, md *metadata.MD) context.Context { - span := fromGRPC(newSpan, *md, logger) - if span == nil { - return ctx - } - return context.WithValue(ctx, SpanContextKey, span) - } -} - -// ToRequest returns a function that satisfies transport/http.BeforeFunc. It -// takes a Zipkin span from the context, and injects it into the HTTP request. -// It's designed to be wired into a client's HTTP transport Before stack. It's -// expected that AnnotateClient has already ensured the span in the context is -// a child/client span. -func ToRequest(newSpan NewSpanFunc) func(ctx context.Context, r *http.Request) context.Context { - return func(ctx context.Context, r *http.Request) context.Context { - span, ok := FromContext(ctx) - if !ok { - return ctx - } - if id := span.TraceID(); id > 0 { - r.Header.Set(traceIDHTTPHeader, strconv.FormatInt(id, 16)) - } - if id := span.SpanID(); id > 0 { - r.Header.Set(spanIDHTTPHeader, strconv.FormatInt(id, 16)) - } - if id := span.ParentSpanID(); id > 0 { - r.Header.Set(parentSpanIDHTTPHeader, strconv.FormatInt(id, 16)) - } - if span.IsSampled() { - r.Header.Set(sampledHTTPHeader, "1") - } else { - r.Header.Set(sampledHTTPHeader, "0") - } - return ctx - } -} - -// ToGRPCRequest returns a function that satisfies transport/grpc.BeforeFunc. It -// takes a Zipkin span from the context, and injects it into the GRPC context. -// It's designed to be wired into a client's GRPC transport Before stack. It's -// expected that AnnotateClient has already ensured the span in the context is -// a child/client span. -func ToGRPCRequest(newSpan NewSpanFunc) func(ctx context.Context, md *metadata.MD) context.Context { - return func(ctx context.Context, md *metadata.MD) context.Context { - span, ok := FromContext(ctx) - if !ok { - return ctx - } - if id := span.TraceID(); id > 0 { - (*md)[traceIDGRPCKey] = append((*md)[traceIDGRPCKey], strconv.FormatInt(id, 16)) - } - if id := span.SpanID(); id > 0 { - (*md)[spanIDGRPCKey] = append((*md)[spanIDGRPCKey], strconv.FormatInt(id, 16)) - } - if id := span.ParentSpanID(); id > 0 { - (*md)[parentSpanIDGRPCKey] = append((*md)[parentSpanIDGRPCKey], strconv.FormatInt(id, 16)) - } - if span.IsSampled() { - (*md)[sampledGRPCKey] = append((*md)[sampledGRPCKey], "1") - } else { - (*md)[sampledGRPCKey] = append((*md)[sampledGRPCKey], "0") - } - return ctx - } -} - -func fromHTTP(newSpan NewSpanFunc, r *http.Request, logger log.Logger) *Span { - traceIDStr := r.Header.Get(traceIDHTTPHeader) - if traceIDStr == "" { - return nil - } - traceID, err := strconv.ParseInt(traceIDStr, 16, 64) - if err != nil { - logger.Log("msg", "invalid trace id found, ignoring trace", "err", err) - return nil - } - spanIDStr := r.Header.Get(spanIDHTTPHeader) - if spanIDStr == "" { - logger.Log("msg", "trace ID without span ID") // abnormal - spanIDStr = strconv.FormatInt(newID(), 64) // deal with it - } - spanID, err := strconv.ParseInt(spanIDStr, 16, 64) - if err != nil { - logger.Log(spanIDHTTPHeader, spanIDStr, "err", err) // abnormal - spanID = newID() // deal with it - } - parentSpanIDStr := r.Header.Get(parentSpanIDHTTPHeader) - if parentSpanIDStr == "" { - parentSpanIDStr = "0" // normal - } - parentSpanID, err := strconv.ParseInt(parentSpanIDStr, 16, 64) - if err != nil { - logger.Log(parentSpanIDHTTPHeader, parentSpanIDStr, "err", err) // abnormal - parentSpanID = 0 // the only way to deal with it - } - span := newSpan(traceID, spanID, parentSpanID) - switch r.Header.Get(sampledHTTPHeader) { - case "0": - span.runSampler = false - span.sampled = false - case "1": - span.runSampler = false - span.sampled = true - default: - // we don't know if the upstream trace was sampled. use our sampler - span.runSampler = true - } - return span -} - -func fromGRPC(newSpan NewSpanFunc, md metadata.MD, logger log.Logger) *Span { - traceIDSlc := md[traceIDGRPCKey] - pos := len(traceIDSlc) - 1 - if pos < 0 { - return nil - } - traceID, err := strconv.ParseInt(traceIDSlc[pos], 16, 64) - if err != nil { - logger.Log("msg", "invalid trace id found, ignoring trace", "err", err) - return nil - } - spanIDSlc := md[spanIDGRPCKey] - pos = len(spanIDSlc) - 1 - if pos < 0 { - spanIDSlc = make([]string, 1) - pos = 0 - } - if spanIDSlc[pos] == "" { - logger.Log("msg", "trace ID without span ID") // abnormal - spanIDSlc[pos] = strconv.FormatInt(newID(), 64) // deal with it - } - spanID, err := strconv.ParseInt(spanIDSlc[pos], 16, 64) - if err != nil { - logger.Log(spanIDHTTPHeader, spanIDSlc, "err", err) // abnormal - spanID = newID() // deal with it - } - parentSpanIDSlc := md[parentSpanIDGRPCKey] - pos = len(parentSpanIDSlc) - 1 - if pos < 0 { - parentSpanIDSlc = make([]string, 1) - pos = 0 - } - if parentSpanIDSlc[pos] == "" { - parentSpanIDSlc[pos] = "0" // normal - } - parentSpanID, err := strconv.ParseInt(parentSpanIDSlc[pos], 16, 64) - if err != nil { - logger.Log(parentSpanIDHTTPHeader, parentSpanIDSlc, "err", err) // abnormal - parentSpanID = 0 // the only way to deal with it - } - span := newSpan(traceID, spanID, parentSpanID) - var sampledHdr string - sampledSlc := md[sampledGRPCKey] - pos = len(sampledSlc) - 1 - if pos >= 0 { - sampledHdr = sampledSlc[pos] - } - switch sampledHdr { - case "0": - span.runSampler = false - span.sampled = false - case "1": - span.runSampler = false - span.sampled = true - default: - // we don't know if the upstream trace was sampled. use our sampler - span.runSampler = true - } - return span -} - -// FromContext extracts an existing Zipkin span if it is stored in the provided -// context. If you add context.Context as the first parameter in your service -// methods you can annotate spans from within business logic. Typical use case -// is to AnnotateDuration on interaction with resources like databases. -func FromContext(ctx context.Context) (*Span, bool) { - val := ctx.Value(SpanContextKey) - if val == nil { - return nil, false - } - span, ok := val.(*Span) - if !ok { - panic(SpanContextKey + " value isn't a span object") - } - return span, true -} - -func newID() int64 { - // https://github.com/wadey/go-zipkin/blob/46e5f01/trace.go#L183-188 - // https://github.com/twitter/zipkin/issues/199 - // :( - return rand.Int63() & 0x001fffffffffffff -} diff --git a/tracing/zipkin/zipkin_test.go b/tracing/zipkin/zipkin_test.go deleted file mode 100644 index b501cfc5d..000000000 --- a/tracing/zipkin/zipkin_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package zipkin_test - -import ( - "fmt" - "io/ioutil" - "net/http" - "reflect" - "runtime" - "strconv" - "strings" - "testing" - - "golang.org/x/net/context" - "google.golang.org/grpc/metadata" - - "github.com/go-kit/kit/endpoint" - "github.com/go-kit/kit/log" - "github.com/go-kit/kit/tracing/zipkin" -) - -func TestToContext(t *testing.T) { - const ( - hostport = "5.5.5.5:5555" - serviceName = "foo-service" - methodName = "foo-method" - traceID int64 = 12 - spanID int64 = 34 - parentSpanID int64 = 56 - sampled = "1" - ) - - r, _ := http.NewRequest("GET", "https://best.horse", nil) - r.Header.Set("X-B3-TraceId", strconv.FormatInt(traceID, 16)) - r.Header.Set("X-B3-SpanId", strconv.FormatInt(spanID, 16)) - r.Header.Set("X-B3-ParentSpanId", strconv.FormatInt(parentSpanID, 16)) - r.Header.Set("X-B3-Sampled", sampled) - - newSpan := zipkin.MakeNewSpanFunc(hostport, serviceName, methodName) - toContext := zipkin.ToContext(newSpan, log.NewLogfmtLogger(ioutil.Discard)) - - ctx := toContext(context.Background(), r) - val := ctx.Value(zipkin.SpanContextKey) - if val == nil { - t.Fatalf("%s returned no value", zipkin.SpanContextKey) - } - span, ok := val.(*zipkin.Span) - if !ok { - t.Fatalf("%s was not a Span object", zipkin.SpanContextKey) - } - - for want, haveFunc := range map[int64]func() int64{ - traceID: span.TraceID, - spanID: span.SpanID, - parentSpanID: span.ParentSpanID, - } { - if have := haveFunc(); want != have { - name := runtime.FuncForPC(reflect.ValueOf(haveFunc).Pointer()).Name() - name = strings.Split(name, "·")[0] - toks := strings.Split(name, ".") - name = toks[len(toks)-1] - t.Errorf("%s: want %d, have %d", name, want, have) - } - } - if want, have := true, span.IsSampled(); want != have { - t.Errorf("IsSampled: want %v, have %v", want, have) - } -} - -func TestFromContext(t *testing.T) { - const ( - hostport = "5.5.5.5:5555" - serviceName = "foo-service" - methodName = "foo-method" - traceID int64 = 14 - spanID int64 = 36 - parentSpanID int64 = 58 - ) - - newSpan := zipkin.NewSpan(hostport, serviceName, methodName, traceID, spanID, parentSpanID) - newSpan.Sample() - ctx := context.WithValue( - context.Background(), - zipkin.SpanContextKey, - newSpan, - ) - - span, ok := zipkin.FromContext(ctx) - if !ok { - t.Fatalf("expected a context value in %q", zipkin.SpanContextKey) - } - if span == nil { - t.Fatal("expected a Zipkin span object") - } - for want, haveFunc := range map[int64]func() int64{ - traceID: span.TraceID, - spanID: span.SpanID, - parentSpanID: span.ParentSpanID, - } { - if have := haveFunc(); want != have { - name := runtime.FuncForPC(reflect.ValueOf(haveFunc).Pointer()).Name() - name = strings.Split(name, "·")[0] - toks := strings.Split(name, ".") - name = toks[len(toks)-1] - t.Errorf("%s: want %d, have %d", name, want, have) - } - } - if want, have := true, span.IsSampled(); want != have { - t.Errorf("IsSampled: want %v, have %v", want, have) - } -} - -func TestToGRPCContext(t *testing.T) { - const ( - hostport = "5.5.5.5:5555" - serviceName = "foo-service" - methodName = "foo-method" - traceID int64 = 12 - spanID int64 = 34 - parentSpanID int64 = 56 - ) - - md := metadata.MD{ - "x-b3-traceid": []string{strconv.FormatInt(traceID, 16)}, - "x-b3-spanid": []string{strconv.FormatInt(spanID, 16)}, - "x-b3-parentspanid": []string{strconv.FormatInt(parentSpanID, 16)}, - "x-b3-sampled": []string{"1"}, - } - - newSpan := zipkin.MakeNewSpanFunc(hostport, serviceName, methodName) - toContext := zipkin.ToGRPCContext(newSpan, log.NewLogfmtLogger(ioutil.Discard)) - - ctx := toContext(context.Background(), &md) - val := ctx.Value(zipkin.SpanContextKey) - if val == nil { - t.Fatalf("%s returned no value", zipkin.SpanContextKey) - } - span, ok := val.(*zipkin.Span) - if !ok { - t.Fatalf("%s was not a Span object", zipkin.SpanContextKey) - } - - for want, haveFunc := range map[int64]func() int64{ - traceID: span.TraceID, - spanID: span.SpanID, - parentSpanID: span.ParentSpanID, - } { - if have := haveFunc(); want != have { - name := runtime.FuncForPC(reflect.ValueOf(haveFunc).Pointer()).Name() - name = strings.Split(name, "·")[0] - toks := strings.Split(name, ".") - name = toks[len(toks)-1] - t.Errorf("%s: want %d, have %d", name, want, have) - } - } - if want, have := true, span.IsSampled(); want != have { - t.Errorf("IsSampled: want %v, have %v", want, have) - } -} - -func TestToRequest(t *testing.T) { - const ( - hostport = "5.5.5.5:5555" - serviceName = "foo-service" - methodName = "foo-method" - traceID int64 = 20 - spanID int64 = 40 - parentSpanID int64 = 90 - sampled = "1" - ) - - newSpan := zipkin.MakeNewSpanFunc(hostport, serviceName, methodName) - span := newSpan(traceID, spanID, parentSpanID) - span.Sample() - ctx := context.WithValue(context.Background(), zipkin.SpanContextKey, span) - r, _ := http.NewRequest("GET", "https://best.horse", nil) - ctx = zipkin.ToRequest(newSpan)(ctx, r) - - for header, wantInt := range map[string]int64{ - "X-B3-TraceId": traceID, - "X-B3-SpanId": spanID, - "X-B3-ParentSpanId": parentSpanID, - } { - if want, have := strconv.FormatInt(wantInt, 16), r.Header.Get(header); want != have { - t.Errorf("%s: want %q, have %q", header, want, have) - } - } - if want, have := sampled, r.Header.Get("X-B3-Sampled"); want != have { - t.Errorf("X-B3-Sampled: want %q, have %q", want, have) - } -} - -func TestToGRPCRequest(t *testing.T) { - const ( - hostport = "5.5.5.5:5555" - serviceName = "foo-service" - methodName = "foo-method" - traceID int64 = 20 - spanID int64 = 40 - parentSpanID int64 = 90 - sampled = "1" - ) - - newSpan := zipkin.MakeNewSpanFunc(hostport, serviceName, methodName) - span := newSpan(traceID, spanID, parentSpanID) - span.Sample() - ctx := context.WithValue(context.Background(), zipkin.SpanContextKey, span) - md := &metadata.MD{} - ctx = zipkin.ToGRPCRequest(newSpan)(ctx, md) - - for header, wantInt := range map[string]int64{ - "x-b3-traceid": traceID, - "x-b3-spanid": spanID, - "x-b3-parentspanid": parentSpanID, - } { - if want, have := strconv.FormatInt(wantInt, 16), (*md)[header][0]; want != have { - t.Errorf("%s: want %q, have %q", header, want, have) - } - } - if want, have := sampled, (*md)["x-b3-sampled"][0]; want != have { - t.Errorf("x-b3-sampled: want %q, have %q", want, have) - } - -} - -func TestAnnotateServer(t *testing.T) { - if err := testAnnotate(zipkin.AnnotateServer, zipkin.ServerReceive, zipkin.ServerSend); err != nil { - t.Fatal(err) - } -} - -func TestAnnotateClient(t *testing.T) { - if err := testAnnotate(zipkin.AnnotateClient, zipkin.ClientSend, zipkin.ClientReceive); err != nil { - t.Fatal(err) - } -} - -func testAnnotate( - annotate func(newSpan zipkin.NewSpanFunc, c zipkin.Collector) endpoint.Middleware, - wantAnnotations ...string, -) error { - const ( - hostport = "1.2.3.4:1234" - serviceName = "some-service" - methodName = "some-method" - ) - - newSpan := zipkin.MakeNewSpanFunc(hostport, serviceName, methodName) - collector := &countingCollector{} - - var e endpoint.Endpoint - e = func(context.Context, interface{}) (interface{}, error) { return struct{}{}, nil } - e = annotate(newSpan, collector)(e) - - if want, have := 0, len(collector.annotations); want != have { - return fmt.Errorf("pre-invocation: want %d, have %d", want, have) - } - if _, err := e(context.Background(), struct{}{}); err != nil { - return fmt.Errorf("during invocation: %v", err) - } - if want, have := wantAnnotations, collector.annotations; !reflect.DeepEqual(want, have) { - return fmt.Errorf("after invocation: want %v, have %v", want, have) - } - - return nil -} - -type countingCollector struct{ annotations []string } - -func (c *countingCollector) Collect(s *zipkin.Span) error { - for _, annotation := range s.Encode().GetAnnotations() { - c.annotations = append(c.annotations, annotation.GetValue()) - } - return nil -} - -func (c *countingCollector) ShouldSample(s *zipkin.Span) bool { - return true -} - -func (c *countingCollector) Close() error { - return nil -}