Codebase list golang-github-go-kit-kit / 48b4028
Updated tracing readme's and removed deprecated tracing/zipkin package Bas van Beek 7 years ago
38 changed file(s) with 204 addition(s) and 17427 deletion(s). Raw diff Collapse all Expand all
00 # package tracing
11
22 `package tracing` provides [Dapper][]-style request tracing to services.
3 An implementation exists for [Zipkin][]; [Appdash][] support is planned.
4
5 [Dapper]: http://research.google.com/pubs/pub36356.html
6 [Zipkin]: https://blog.twitter.com/2012/distributed-systems-tracing-with-zipkin
7 [Appdash]: https://github.com/sourcegraph/appdash
83
94 ## Rationale
105
138 hot spots, and diagnosing errors. All microservice infrastructures will
149 benefit from request tracing; sufficiently large infrastructures will require
1510 it.
11
12 ## OpenTracing
13
14 Go kit builds on top of the [OpenTracing] API and uses the [opentracing-go]
15 package to provide tracing middlewares for its servers and clients. Currently
16 `kit/transport/http` and `kit/transport/grpc` transports are supported.
17
18 Since [OpenTracing] is an upcoming standard API, Go kit should support a
19 multitude of tracing backends. If a Tracer implementation in Go for your
20 back-end exists, it should work out of the box. The following tracing back-ends
21 are known to work with Go kit through the OpenTracing interface and are
22 highlighted in the [addsvc] example.
23
24
25 ### LightStep
26
27 [LightStep] support is available through their standard Go package
28 [lightstep-tracer-go].
29
30 ### AppDash
31
32 [Appdash] support is available straight from their system repository in the
33 [appdash/opentracing] directory.
34
35 ### Zipkin
36
37 [Zipkin] support is now available from the [zipkin-go-opentracing] package which
38 can be found at the [Open Zipkin GitHub] page. This means our old custom
39 `tracing/zipkin` package is now deprecated. In the `kit/tracing/zipkin`
40 directory you can still find the `docker-compose` script to bootstrap a Zipkin
41 development environment and a [README] detailing how to transition from the
42 old package to the new.
43
44 [Dapper]: http://research.google.com/pubs/pub36356.html
45 [addsvc]:https://github.com/go-kit/kit/tree/master/examples/addsvc
46 [README]: https://github.com/go-kit/kit/blob/master/tracing/zipkin/README.md
47
48 [OpenTracing]: http://opentracing.io
49 [opentracing-go]: https://github.com/opentracing/opentracing-go
50
51 [Zipkin]: http://zipkin.io/
52 [Open Zipkin GitHub]: https://github.com/openzipkin
53 [zipkin-go-opentracing]: https://github.com/openzipkin/zipkin-go-opentracing
54
55 [Appdash]: https://github.com/sourcegraph/appdash
56 [appdash/opentracing]: https://github.com/sourcegraph/appdash/tree/master/opentracing
57
58 [LightStep]: http://lightstep.com/
59 [lightstep-tracer-go]: https://github.com/lightstep/lightstep-tracer-go
33
44 Setting up [Zipkin] is not an easy thing to do. It will also demand quite some
55 resources. To help you get started with development and testing we've made a
6 docker-compose file available for running a full Zipkin stack. See the
7 `kit/tracing/zipkin/_docker` subdirectory.
6 docker-compose file available for running a full Zipkin stack.
87
98 You will need [docker-compose] 1.6.0+ and [docker-engine] 1.10.0+.
109
1312 hostname of the VM running the docker containers.
1413
1514 ```sh
16 cd tracing/zipkin/_docker
15 cd tracing/zipkin
1716 HOSTNAME=localhost docker-compose -f docker-compose-zipkin.yml up
1817 ```
1918
3534
3635 ## Middleware Usage
3736
38 Wrap a server- or client-side [endpoint][] so that it emits traces to a Zipkin
39 collector. Make sure the host given to `MakeNewSpanFunc` resolves to an IP. If
40 not your span will silently fail!
37 Follow the [addsvc] example to check out how to wire the Zipkin Middleware. The
38 changes should be relatively minor.
4139
42 [endpoint]: http://godoc.org/github.com/go-kit/kit/endpoint#Endpoint
40 The [zipkin-go-opentracing] package has support for Kafka and Scribe collectors
41 as well as using Go Kit's [Log] package for logging.
4342
44 If needing to create child spans in methods or calling another service from your
45 service method, it is highly recommended to request a context parameter so you
46 can transfer the needed metadata for traces across service boundaries.
43 ### Span per Node vs. Span per RPC
44 OpenTracing tends to support the `span per node` model, meaning the server and
45 client side of an RPC call are dealt with in separate spans. This diverts from
46 the Zipkin V1 model which is more tailored towards the `span per RPC call` model
47 in which the server and client side annotations of the same RPC call are part of
48 the same span. The [zipkin-go-opentracing] implementation allows you to choose
49 which model you wish to use. Make sure you select the same model consistently
50 for all your services that are required to talk to each other or you will have
51 trace propagation issues. If using non OpenTracing / legacy instrumentation use
52 the `span per RPC call` model.
4753
48 It is also wise to always return error parameters with your service method
49 calls, even if your service method implementations will not throw errors
50 themselves. The error return parameter can be wired to pass the potential
51 transport errors when consuming your service API in a networked environment.
54 To adhere to the OpenTracing philosophy the Tracer defaults to `span per node`.
55 To set the `span per RPC call` mode start your tracer like this:
5256
5357 ```go
54 func main() {
58 tracer, err = zipkin.NewTracer(
59 zipkin.NewRecorder(...),
60 zipkin.ClientServerSameSpan(true),
61 )
62 ```
63
64 [zipkin-go-opentracing]: https://github.com/openzipkin/zipkin-go-opentracing
65 [addsvc]:https://github.com/go-kit/kit/tree/master/examples/addsvc
66 [Log]: https://github.com/go-kit/kit/tree/master/log
67
68 ### Tracing Resources
69
70 In our legacy implementation we had the `NewChildSpan` method to allow
71 annotation of resources such as databases, caches and other services that do not
72 have server side tracing support. Since OpenTracing has no specific method of
73 dealing with these items explicitely that is compatible with Zipkin's `SA`
74 annotation the [zipkin-go-opentracing] has implemented support using the
75 OpenTracing Tags system. Here is an example of how one would be able to record
76 a resource span compatible with standard OpenTracing and triggering an `SA`
77 annotation in [zipkin-go-opentracing]:
78
79 ```go
80 // you need to import the ext package for the Tag helper functions
81 import (
82 "github.com/opentracing/opentracing-go"
83 "github.com/opentracing/opentracing-go/ext"
84 )
85
86 func (svc *Service) GetMeSomeExamples(ctx context.Context, ...) ([]Examples, error) {
87 // Example of annotating a database query:
5588 var (
56 // myHost MUST resolve to an IP or your span will not show up in Zipkin.
57 myHost = "instance01.addsvc.internal.net:8000"
58 myService = "AddService"
59 myMethod = "Add"
60 url = myHost + "/add/"
61 kafkaHost = []string{"kafka.internal.net:9092"}
89 serviceName = "MySQL"
90 serviceHost = "mysql.example.com"
91 servicePort = uint16(3306)
92 queryLabel = "GetExamplesByParam"
93 query = "select * from example where param = 'value'"
6294 )
6395
64 ctx := context.Background()
96 // retrieve the parent span, if not found create a new trace
97 parentSpan := opentracing.SpanFromContext(ctx)
98 if parentSpan == nil {
99 parentSpan = opentracing.StartSpan(queryLabel)
100 }
65101
66 // Set Up Zipkin Collector and Span factory
67 spanFunc := zipkin.MakeNewSpanFunc(myHost, myService, myMethod)
68 collector, _ := zipkin.NewKafkaCollector(kafkaHost)
102 // create a new span to record the resource interaction
103 span := opentracing.StartChildSpan(parentSpan, queryLabel)
69104
70 // Server-side Wiring
71 var server endpoint.Endpoint
72 server = makeEndpoint() // for your service
73 // wrap endpoint with Zipkin tracing middleware
74 server = zipkin.AnnotateServer(spanFunc, collector)(server)
105 // span.kind "resource" triggers SA annotation
106 ext.SpanKind.Set(span, "resource")
75107
76 http.Handle(
77 "/add/",
78 httptransport.NewServer(
79 ctx,
80 server,
81 decodeRequestFunc,
82 encodeResponseFunc,
83 httptransport.ServerBefore(
84 zipkin.ToContext(spanFunc),
85 ),
86 ),
87 )
88 ...
108 // this will label the span's service & hostPort (called Endpoint in Zipkin)
109 ext.PeerService.Set(span, serviceName)
110 ext.PeerHostname,Set(span, serviceHost)
111 ext.PeerPort.Set(span, servicePort)
89112
90 // Client-side
91 var client endpoint.Endpoint
92 client = httptransport.NewClient(
93 "GET",
94 URL,
95 encodeRequestFunc,
96 decodeResponseFunc,
97 httptransport.ClientBefore(zipkin.ToRequest(spanFunc)),
98 ).Endpoint()
99 client = zipkin.AnnotateClient(spanFunc, collector)(client)
113 // a Tag is the equivalent of a Zipkin Binary Annotation (key:value pair)
114 span.SetTag("query", query)
100115
101 ctx, cancel := context.WithTimeout(ctx, myTimeout)
102 defer cancel()
116 // a LogEvent is the equivalent of a Zipkin Annotation (timestamped)
117 span.LogEvent("query:start")
103118
104 reply, err := client(ctx, param1, param2)
105 // do something with the response/error
119 // do the actual query...
120
121 // let's annotate the end...
122 span.LogEvent("query:end")
123
124 // we're done with the span. send it to the SpanRecorder for collection...
125 span.Finish()
126
127 // do other stuff
106128 ...
107129 }
108130 ```
109
110 ## Annotating Remote Resources
111
112 Next to the above shown examples of wiring server-side and client-side tracing
113 middlewares, you can also span resources called from your service methods.
114
115 To do this, the service method needs to include a context parameter. From your
116 endpoint wrapper you can inject the endpoint context which will hold the parent
117 span already created by the server-side middleware. If the resource is a remote
118 database you can use the `zipkin.ServerAddr` spanOption to identify the remote
119 host:port and the display name of this resource.
120
121 ```go
122 type MyService struct {
123 // add a Zipkin Collector to your service implementation's properties.
124 Collector zipkin.Collector
125 }
126
127 // Example of the endpoint.Endpoint to service method wrapper, injecting the
128 // context provided by the transport server.
129 func makeComplexEndpoint() endpoint.Endpoint {
130 return func(ctx context.Context, request interface{}) (interface{}, error) {
131 req := request.(ComplexRequest)
132 v, err := svc.Complex(ctx, req.A, req.B)
133 return ComplexResponse{V: v, Err: err}, nil
134 }
135 }
136
137 // Complex is an example method of our service, displaying the tracing of a
138 // remote database resource.
139 func (s *MyService) Complex(ctx context.Context, A someType, B otherType) (returnType, error) {
140 // we've parsed the incoming parameters and now we need to query the database.
141 // we wish to include this action into our trace.
142 span, collect := zipkin.NewChildSpan(
143 ctx,
144 s.Collector,
145 "complexQuery",
146 zipkin.ServerAddr(
147 "mysql01.internal.net:3306",
148 "MySQL",
149 ),
150 )
151 // you probably want to binary annotate your query
152 span.AnnotateBinary("query", "SELECT ... FROM ... WHERE ... ORDER BY ..."),
153 // annotate the start of the query
154 span.Annotate("complexQuery:start")
155 // do the query and handle resultset
156 ...
157 // annotate we are done with the query
158 span.Annotate("complexQuery:end")
159 // maybe binary annotate some items returned by the resultset
160 ...
161 // when done with all annotations, collect the span
162 collect()
163 ...
164 }
165 ```
+0
-76
tracing/zipkin/_docker/docker-compose-zipkin.yml less more
0 # This file uses the version 2 docker-compose file format, described here:
1 # https://docs.docker.com/compose/compose-file/#version-2
2 #
3 # It runs the zipkin-cassandra, zipkin-collector, zipkin-query, zipkin-web, and
4 # zookeeper-exhibitor containers.
5 #
6 # On linux you probably want to start this composition like this:
7 #
8 # HOSTNAME=localhost docker-compose -f docker-compose-zipkin.yml up
9 #
10 # On OS X you will probably start like this:
11 #
12 # HOSTNAME=default docker-compose -f docker-compose-zipkin.yml up
13
14 version: '2'
15 services:
16 cassandra:
17 image: openzipkin/zipkin-cassandra:1.39.4
18 network_mode: host
19
20 zookeeper:
21 image: mbabineau/zookeeper-exhibitor:latest
22 network_mode: host
23 environment:
24 HOSTNAME: ${HOSTNAME}
25
26 kafka:
27 image: wurstmeister/kafka
28 network_mode: host
29 environment:
30 KAFKA_CREATE_TOPICS: "zipkin:1:1"
31 KAFKA_ZOOKEEPER_CONNECTION_TIMEOUT_MS: 60000
32 KAFKA_ADVERTISED_PORT: 9092
33 KAFKA_ADVERTISED_HOST_NAME: ${HOSTNAME}
34 KAFKA_ZOOKEEPER_CONNECT: ${HOSTNAME}:2181
35 depends_on:
36 - zookeeper
37
38 collector:
39 image: openzipkin/zipkin-collector:1.39.4
40 network_mode: host
41 environment:
42 STORAGE_TYPE: cassandra
43 TRANSPORT_TYPE: kafka
44 CASSANDRA_CONTACT_POINTS: ${HOSTNAME}
45 KAFKA_ZOOKEEPER: ${HOSTNAME}:2181
46 METADATA_BROKER_LIST: ${HOSTNAME}:9092
47 depends_on:
48 - cassandra
49 - kafka
50
51 query:
52 image: openzipkin/zipkin-query:1.39.4
53 network_mode: host
54 environment:
55 STORAGE_TYPE: cassandra
56 TRANSPORT_TYPE: kafka
57 CASSANDRA_CONTACT_POINTS: ${HOSTNAME}
58 KAFKA_ZOOKEEPER: ${HOSTNAME}:2181
59 METADATA_BROKER_LIST: ${HOSTNAME}:9092
60 depends_on:
61 - cassandra
62 - kafka
63
64 web:
65 image: openzipkin/zipkin-web:1.39.4
66 network_mode: host
67 environment:
68 TRANSPORT_TYPE: kafka
69 KAFKA_ZOOKEEPER: ${HOSTNAME}:2181
70 METADATA_BROKER_LIST: ${HOSTNAME}:9092
71 QUERY_PORT_9411_TCP_ADDR: ${HOSTNAME}
72 ROOTURL: http://${HOSTNAME}:8080
73 depends_on:
74 - cassandra
75 - kafka
+0
-11
tracing/zipkin/_thrift/compile.sh less more
0 #!/usr/bin/env sh
1
2 # Thrift code generation for Go is broken in the current stable (0.9.2)
3 # release. Leaving this stubbed out until the fix is released.
4 # https://issues.apache.org/jira/browse/THRIFT-3021
5
6 # https://thrift.apache.org/tutorial/go
7 for f in *.thrift ; do
8 thrift -r --gen go:thrift_import=github.com/apache/thrift/lib/go/thrift $f
9 done
10
+0
-18
tracing/zipkin/_thrift/gen-go/scribe/constants.go less more
0 // Autogenerated by Thrift Compiler (0.9.2)
1 // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
2
3 package scribe
4
5 import (
6 "bytes"
7 "fmt"
8 "github.com/apache/thrift/lib/go/thrift"
9 )
10
11 // (needed to ensure safety because of naive import list construction.)
12 var _ = thrift.ZERO
13 var _ = fmt.Printf
14 var _ = bytes.Equal
15
16 func init() {
17 }
+0
-150
tracing/zipkin/_thrift/gen-go/scribe/scribe-remote/scribe-remote.go less more
0 // Autogenerated by Thrift Compiler (0.9.2)
1 // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
2
3 package main
4
5 import (
6 "flag"
7 "fmt"
8 "github.com/apache/thrift/lib/go/thrift"
9 "math"
10 "net"
11 "net/url"
12 "os"
13 "scribe"
14 "strconv"
15 "strings"
16 )
17
18 func Usage() {
19 fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:")
20 flag.PrintDefaults()
21 fmt.Fprintln(os.Stderr, "\nFunctions:")
22 fmt.Fprintln(os.Stderr, " ResultCode Log( messages)")
23 fmt.Fprintln(os.Stderr)
24 os.Exit(0)
25 }
26
27 func main() {
28 flag.Usage = Usage
29 var host string
30 var port int
31 var protocol string
32 var urlString string
33 var framed bool
34 var useHttp bool
35 var parsedUrl url.URL
36 var trans thrift.TTransport
37 _ = strconv.Atoi
38 _ = math.Abs
39 flag.Usage = Usage
40 flag.StringVar(&host, "h", "localhost", "Specify host and port")
41 flag.IntVar(&port, "p", 9090, "Specify port")
42 flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
43 flag.StringVar(&urlString, "u", "", "Specify the url")
44 flag.BoolVar(&framed, "framed", false, "Use framed transport")
45 flag.BoolVar(&useHttp, "http", false, "Use http")
46 flag.Parse()
47
48 if len(urlString) > 0 {
49 parsedUrl, err := url.Parse(urlString)
50 if err != nil {
51 fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
52 flag.Usage()
53 }
54 host = parsedUrl.Host
55 useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
56 } else if useHttp {
57 _, err := url.Parse(fmt.Sprint("http://", host, ":", port))
58 if err != nil {
59 fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
60 flag.Usage()
61 }
62 }
63
64 cmd := flag.Arg(0)
65 var err error
66 if useHttp {
67 trans, err = thrift.NewTHttpClient(parsedUrl.String())
68 } else {
69 portStr := fmt.Sprint(port)
70 if strings.Contains(host, ":") {
71 host, portStr, err = net.SplitHostPort(host)
72 if err != nil {
73 fmt.Fprintln(os.Stderr, "error with host:", err)
74 os.Exit(1)
75 }
76 }
77 trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
78 if err != nil {
79 fmt.Fprintln(os.Stderr, "error resolving address:", err)
80 os.Exit(1)
81 }
82 if framed {
83 trans = thrift.NewTFramedTransport(trans)
84 }
85 }
86 if err != nil {
87 fmt.Fprintln(os.Stderr, "Error creating transport", err)
88 os.Exit(1)
89 }
90 defer trans.Close()
91 var protocolFactory thrift.TProtocolFactory
92 switch protocol {
93 case "compact":
94 protocolFactory = thrift.NewTCompactProtocolFactory()
95 break
96 case "simplejson":
97 protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
98 break
99 case "json":
100 protocolFactory = thrift.NewTJSONProtocolFactory()
101 break
102 case "binary", "":
103 protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
104 break
105 default:
106 fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
107 Usage()
108 os.Exit(1)
109 }
110 client := scribe.NewScribeClientFactory(trans, protocolFactory)
111 if err := trans.Open(); err != nil {
112 fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
113 os.Exit(1)
114 }
115
116 switch cmd {
117 case "Log":
118 if flag.NArg()-1 != 1 {
119 fmt.Fprintln(os.Stderr, "Log requires 1 args")
120 flag.Usage()
121 }
122 arg5 := flag.Arg(1)
123 mbTrans6 := thrift.NewTMemoryBufferLen(len(arg5))
124 defer mbTrans6.Close()
125 _, err7 := mbTrans6.WriteString(arg5)
126 if err7 != nil {
127 Usage()
128 return
129 }
130 factory8 := thrift.NewTSimpleJSONProtocolFactory()
131 jsProt9 := factory8.GetProtocol(mbTrans6)
132 containerStruct0 := scribe.NewLogArgs()
133 err10 := containerStruct0.ReadField1(jsProt9)
134 if err10 != nil {
135 Usage()
136 return
137 }
138 argvalue0 := containerStruct0.Messages
139 value0 := argvalue0
140 fmt.Print(client.Log(value0))
141 fmt.Print("\n")
142 break
143 case "":
144 Usage()
145 break
146 default:
147 fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
148 }
149 }
+0
-418
tracing/zipkin/_thrift/gen-go/scribe/scribe.go less more
0 // Autogenerated by Thrift Compiler (0.9.2)
1 // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
2
3 package scribe
4
5 import (
6 "bytes"
7 "fmt"
8
9 "github.com/apache/thrift/lib/go/thrift"
10 )
11
12 // (needed to ensure safety because of naive import list construction.)
13 var _ = thrift.ZERO
14 var _ = fmt.Printf
15 var _ = bytes.Equal
16
17 type Scribe interface {
18 // Parameters:
19 // - Messages
20 Log(messages []*LogEntry) (r ResultCode, err error)
21 }
22
23 type ScribeClient struct {
24 Transport thrift.TTransport
25 ProtocolFactory thrift.TProtocolFactory
26 InputProtocol thrift.TProtocol
27 OutputProtocol thrift.TProtocol
28 SeqId int32
29 }
30
31 func NewScribeClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ScribeClient {
32 return &ScribeClient{Transport: t,
33 ProtocolFactory: f,
34 InputProtocol: f.GetProtocol(t),
35 OutputProtocol: f.GetProtocol(t),
36 SeqId: 0,
37 }
38 }
39
40 func NewScribeClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ScribeClient {
41 return &ScribeClient{Transport: t,
42 ProtocolFactory: nil,
43 InputProtocol: iprot,
44 OutputProtocol: oprot,
45 SeqId: 0,
46 }
47 }
48
49 // Parameters:
50 // - Messages
51 func (p *ScribeClient) Log(messages []*LogEntry) (r ResultCode, err error) {
52 if err = p.sendLog(messages); err != nil {
53 return
54 }
55 return p.recvLog()
56 }
57
58 func (p *ScribeClient) sendLog(messages []*LogEntry) (err error) {
59 oprot := p.OutputProtocol
60 if oprot == nil {
61 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
62 p.OutputProtocol = oprot
63 }
64 p.SeqId++
65 if err = oprot.WriteMessageBegin("Log", thrift.CALL, p.SeqId); err != nil {
66 return
67 }
68 args := LogArgs{
69 Messages: messages,
70 }
71 if err = args.Write(oprot); err != nil {
72 return
73 }
74 if err = oprot.WriteMessageEnd(); err != nil {
75 return
76 }
77 return oprot.Flush()
78 }
79
80 func (p *ScribeClient) recvLog() (value ResultCode, err error) {
81 iprot := p.InputProtocol
82 if iprot == nil {
83 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
84 p.InputProtocol = iprot
85 }
86 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
87 if err != nil {
88 return
89 }
90 if mTypeId == thrift.EXCEPTION {
91 error0 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
92 var error1 error
93 error1, err = error0.Read(iprot)
94 if err != nil {
95 return
96 }
97 if err = iprot.ReadMessageEnd(); err != nil {
98 return
99 }
100 err = error1
101 return
102 }
103 if p.SeqId != seqId {
104 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "Log failed: out of sequence response")
105 return
106 }
107 result := LogResult{}
108 if err = result.Read(iprot); err != nil {
109 return
110 }
111 if err = iprot.ReadMessageEnd(); err != nil {
112 return
113 }
114 value = result.GetSuccess()
115 return
116 }
117
118 type ScribeProcessor struct {
119 processorMap map[string]thrift.TProcessorFunction
120 handler Scribe
121 }
122
123 func (p *ScribeProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
124 p.processorMap[key] = processor
125 }
126
127 func (p *ScribeProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
128 processor, ok = p.processorMap[key]
129 return processor, ok
130 }
131
132 func (p *ScribeProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
133 return p.processorMap
134 }
135
136 func NewScribeProcessor(handler Scribe) *ScribeProcessor {
137
138 self2 := &ScribeProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
139 self2.processorMap["Log"] = &scribeProcessorLog{handler: handler}
140 return self2
141 }
142
143 func (p *ScribeProcessor) Process(iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
144 name, _, seqId, err := iprot.ReadMessageBegin()
145 if err != nil {
146 return false, err
147 }
148 if processor, ok := p.GetProcessorFunction(name); ok {
149 return processor.Process(seqId, iprot, oprot)
150 }
151 iprot.Skip(thrift.STRUCT)
152 iprot.ReadMessageEnd()
153 x3 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
154 oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
155 x3.Write(oprot)
156 oprot.WriteMessageEnd()
157 oprot.Flush()
158 return false, x3
159
160 }
161
162 type scribeProcessorLog struct {
163 handler Scribe
164 }
165
166 func (p *scribeProcessorLog) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
167 args := LogArgs{}
168 if err = args.Read(iprot); err != nil {
169 iprot.ReadMessageEnd()
170 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
171 oprot.WriteMessageBegin("Log", thrift.EXCEPTION, seqId)
172 x.Write(oprot)
173 oprot.WriteMessageEnd()
174 oprot.Flush()
175 return false, err
176 }
177
178 iprot.ReadMessageEnd()
179 result := LogResult{}
180 var retval ResultCode
181 var err2 error
182 if retval, err2 = p.handler.Log(args.Messages); err2 != nil {
183 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing Log: "+err2.Error())
184 oprot.WriteMessageBegin("Log", thrift.EXCEPTION, seqId)
185 x.Write(oprot)
186 oprot.WriteMessageEnd()
187 oprot.Flush()
188 return true, err2
189 } else {
190 result.Success = &retval
191 }
192 if err2 = oprot.WriteMessageBegin("Log", thrift.REPLY, seqId); err2 != nil {
193 err = err2
194 }
195 if err2 = result.Write(oprot); err == nil && err2 != nil {
196 err = err2
197 }
198 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
199 err = err2
200 }
201 if err2 = oprot.Flush(); err == nil && err2 != nil {
202 err = err2
203 }
204 if err != nil {
205 return
206 }
207 return true, err
208 }
209
210 // HELPER FUNCTIONS AND STRUCTURES
211
212 type LogArgs struct {
213 Messages []*LogEntry `thrift:"messages,1" json:"messages"`
214 }
215
216 func NewLogArgs() *LogArgs {
217 return &LogArgs{}
218 }
219
220 func (p *LogArgs) GetMessages() []*LogEntry {
221 return p.Messages
222 }
223 func (p *LogArgs) Read(iprot thrift.TProtocol) error {
224 if _, err := iprot.ReadStructBegin(); err != nil {
225 return fmt.Errorf("%T read error: %s", p, err)
226 }
227 for {
228 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
229 if err != nil {
230 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
231 }
232 if fieldTypeId == thrift.STOP {
233 break
234 }
235 switch fieldId {
236 case 1:
237 if err := p.ReadField1(iprot); err != nil {
238 return err
239 }
240 default:
241 if err := iprot.Skip(fieldTypeId); err != nil {
242 return err
243 }
244 }
245 if err := iprot.ReadFieldEnd(); err != nil {
246 return err
247 }
248 }
249 if err := iprot.ReadStructEnd(); err != nil {
250 return fmt.Errorf("%T read struct end error: %s", p, err)
251 }
252 return nil
253 }
254
255 func (p *LogArgs) ReadField1(iprot thrift.TProtocol) error {
256 _, size, err := iprot.ReadListBegin()
257 if err != nil {
258 return fmt.Errorf("error reading list begin: %s", err)
259 }
260 tSlice := make([]*LogEntry, 0, size)
261 p.Messages = tSlice
262 for i := 0; i < size; i++ {
263 _elem4 := &LogEntry{}
264 if err := _elem4.Read(iprot); err != nil {
265 return fmt.Errorf("%T error reading struct: %s", _elem4, err)
266 }
267 p.Messages = append(p.Messages, _elem4)
268 }
269 if err := iprot.ReadListEnd(); err != nil {
270 return fmt.Errorf("error reading list end: %s", err)
271 }
272 return nil
273 }
274
275 func (p *LogArgs) Write(oprot thrift.TProtocol) error {
276 if err := oprot.WriteStructBegin("Log_args"); err != nil {
277 return fmt.Errorf("%T write struct begin error: %s", p, err)
278 }
279 if err := p.writeField1(oprot); err != nil {
280 return err
281 }
282 if err := oprot.WriteFieldStop(); err != nil {
283 return fmt.Errorf("write field stop error: %s", err)
284 }
285 if err := oprot.WriteStructEnd(); err != nil {
286 return fmt.Errorf("write struct stop error: %s", err)
287 }
288 return nil
289 }
290
291 func (p *LogArgs) writeField1(oprot thrift.TProtocol) (err error) {
292 if err := oprot.WriteFieldBegin("messages", thrift.LIST, 1); err != nil {
293 return fmt.Errorf("%T write field begin error 1:messages: %s", p, err)
294 }
295 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Messages)); err != nil {
296 return fmt.Errorf("error writing list begin: %s", err)
297 }
298 for _, v := range p.Messages {
299 if err := v.Write(oprot); err != nil {
300 return fmt.Errorf("%T error writing struct: %s", v, err)
301 }
302 }
303 if err := oprot.WriteListEnd(); err != nil {
304 return fmt.Errorf("error writing list end: %s", err)
305 }
306 if err := oprot.WriteFieldEnd(); err != nil {
307 return fmt.Errorf("%T write field end error 1:messages: %s", p, err)
308 }
309 return err
310 }
311
312 func (p *LogArgs) String() string {
313 if p == nil {
314 return "<nil>"
315 }
316 return fmt.Sprintf("LogArgs(%+v)", *p)
317 }
318
319 type LogResult struct {
320 Success *ResultCode `thrift:"success,0" json:"success"`
321 }
322
323 func NewLogResult() *LogResult {
324 return &LogResult{}
325 }
326
327 var LogResult_Success_DEFAULT ResultCode
328
329 func (p *LogResult) GetSuccess() ResultCode {
330 if !p.IsSetSuccess() {
331 return LogResult_Success_DEFAULT
332 }
333 return *p.Success
334 }
335 func (p *LogResult) IsSetSuccess() bool {
336 return p.Success != nil
337 }
338
339 func (p *LogResult) Read(iprot thrift.TProtocol) error {
340 if _, err := iprot.ReadStructBegin(); err != nil {
341 return fmt.Errorf("%T read error: %s", p, err)
342 }
343 for {
344 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
345 if err != nil {
346 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
347 }
348 if fieldTypeId == thrift.STOP {
349 break
350 }
351 switch fieldId {
352 case 0:
353 if err := p.ReadField0(iprot); err != nil {
354 return err
355 }
356 default:
357 if err := iprot.Skip(fieldTypeId); err != nil {
358 return err
359 }
360 }
361 if err := iprot.ReadFieldEnd(); err != nil {
362 return err
363 }
364 }
365 if err := iprot.ReadStructEnd(); err != nil {
366 return fmt.Errorf("%T read struct end error: %s", p, err)
367 }
368 return nil
369 }
370
371 func (p *LogResult) ReadField0(iprot thrift.TProtocol) error {
372 if v, err := iprot.ReadI32(); err != nil {
373 return fmt.Errorf("error reading field 0: %s", err)
374 } else {
375 temp := ResultCode(v)
376 p.Success = &temp
377 }
378 return nil
379 }
380
381 func (p *LogResult) Write(oprot thrift.TProtocol) error {
382 if err := oprot.WriteStructBegin("Log_result"); err != nil {
383 return fmt.Errorf("%T write struct begin error: %s", p, err)
384 }
385 if err := p.writeField0(oprot); err != nil {
386 return err
387 }
388 if err := oprot.WriteFieldStop(); err != nil {
389 return fmt.Errorf("write field stop error: %s", err)
390 }
391 if err := oprot.WriteStructEnd(); err != nil {
392 return fmt.Errorf("write struct stop error: %s", err)
393 }
394 return nil
395 }
396
397 func (p *LogResult) writeField0(oprot thrift.TProtocol) (err error) {
398 if p.IsSetSuccess() {
399 if err := oprot.WriteFieldBegin("success", thrift.I32, 0); err != nil {
400 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
401 }
402 if err := oprot.WriteI32(int32(*p.Success)); err != nil {
403 return fmt.Errorf("%T.success (0) field write error: %s", p, err)
404 }
405 if err := oprot.WriteFieldEnd(); err != nil {
406 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
407 }
408 }
409 return err
410 }
411
412 func (p *LogResult) String() string {
413 if p == nil {
414 return "<nil>"
415 }
416 return fmt.Sprintf("LogResult(%+v)", *p)
417 }
+0
-168
tracing/zipkin/_thrift/gen-go/scribe/ttypes.go less more
0 // Autogenerated by Thrift Compiler (0.9.2)
1 // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
2
3 package scribe
4
5 import (
6 "bytes"
7 "fmt"
8 "github.com/apache/thrift/lib/go/thrift"
9 )
10
11 // (needed to ensure safety because of naive import list construction.)
12 var _ = thrift.ZERO
13 var _ = fmt.Printf
14 var _ = bytes.Equal
15
16 var GoUnusedProtection__ int
17
18 type ResultCode int64
19
20 const (
21 ResultCode_OK ResultCode = 0
22 ResultCode_TRY_LATER ResultCode = 1
23 )
24
25 func (p ResultCode) String() string {
26 switch p {
27 case ResultCode_OK:
28 return "ResultCode_OK"
29 case ResultCode_TRY_LATER:
30 return "ResultCode_TRY_LATER"
31 }
32 return "<UNSET>"
33 }
34
35 func ResultCodeFromString(s string) (ResultCode, error) {
36 switch s {
37 case "ResultCode_OK":
38 return ResultCode_OK, nil
39 case "ResultCode_TRY_LATER":
40 return ResultCode_TRY_LATER, nil
41 }
42 return ResultCode(0), fmt.Errorf("not a valid ResultCode string")
43 }
44
45 func ResultCodePtr(v ResultCode) *ResultCode { return &v }
46
47 type LogEntry struct {
48 Category string `thrift:"category,1" json:"category"`
49 Message string `thrift:"message,2" json:"message"`
50 }
51
52 func NewLogEntry() *LogEntry {
53 return &LogEntry{}
54 }
55
56 func (p *LogEntry) GetCategory() string {
57 return p.Category
58 }
59
60 func (p *LogEntry) GetMessage() string {
61 return p.Message
62 }
63 func (p *LogEntry) Read(iprot thrift.TProtocol) error {
64 if _, err := iprot.ReadStructBegin(); err != nil {
65 return fmt.Errorf("%T read error: %s", p, err)
66 }
67 for {
68 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
69 if err != nil {
70 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
71 }
72 if fieldTypeId == thrift.STOP {
73 break
74 }
75 switch fieldId {
76 case 1:
77 if err := p.ReadField1(iprot); err != nil {
78 return err
79 }
80 case 2:
81 if err := p.ReadField2(iprot); err != nil {
82 return err
83 }
84 default:
85 if err := iprot.Skip(fieldTypeId); err != nil {
86 return err
87 }
88 }
89 if err := iprot.ReadFieldEnd(); err != nil {
90 return err
91 }
92 }
93 if err := iprot.ReadStructEnd(); err != nil {
94 return fmt.Errorf("%T read struct end error: %s", p, err)
95 }
96 return nil
97 }
98
99 func (p *LogEntry) ReadField1(iprot thrift.TProtocol) error {
100 if v, err := iprot.ReadString(); err != nil {
101 return fmt.Errorf("error reading field 1: %s", err)
102 } else {
103 p.Category = v
104 }
105 return nil
106 }
107
108 func (p *LogEntry) ReadField2(iprot thrift.TProtocol) error {
109 if v, err := iprot.ReadString(); err != nil {
110 return fmt.Errorf("error reading field 2: %s", err)
111 } else {
112 p.Message = v
113 }
114 return nil
115 }
116
117 func (p *LogEntry) Write(oprot thrift.TProtocol) error {
118 if err := oprot.WriteStructBegin("LogEntry"); err != nil {
119 return fmt.Errorf("%T write struct begin error: %s", p, err)
120 }
121 if err := p.writeField1(oprot); err != nil {
122 return err
123 }
124 if err := p.writeField2(oprot); err != nil {
125 return err
126 }
127 if err := oprot.WriteFieldStop(); err != nil {
128 return fmt.Errorf("write field stop error: %s", err)
129 }
130 if err := oprot.WriteStructEnd(); err != nil {
131 return fmt.Errorf("write struct stop error: %s", err)
132 }
133 return nil
134 }
135
136 func (p *LogEntry) writeField1(oprot thrift.TProtocol) (err error) {
137 if err := oprot.WriteFieldBegin("category", thrift.STRING, 1); err != nil {
138 return fmt.Errorf("%T write field begin error 1:category: %s", p, err)
139 }
140 if err := oprot.WriteString(string(p.Category)); err != nil {
141 return fmt.Errorf("%T.category (1) field write error: %s", p, err)
142 }
143 if err := oprot.WriteFieldEnd(); err != nil {
144 return fmt.Errorf("%T write field end error 1:category: %s", p, err)
145 }
146 return err
147 }
148
149 func (p *LogEntry) writeField2(oprot thrift.TProtocol) (err error) {
150 if err := oprot.WriteFieldBegin("message", thrift.STRING, 2); err != nil {
151 return fmt.Errorf("%T write field begin error 2:message: %s", p, err)
152 }
153 if err := oprot.WriteString(string(p.Message)); err != nil {
154 return fmt.Errorf("%T.message (2) field write error: %s", p, err)
155 }
156 if err := oprot.WriteFieldEnd(); err != nil {
157 return fmt.Errorf("%T write field end error 2:message: %s", p, err)
158 }
159 return err
160 }
161
162 func (p *LogEntry) String() string {
163 if p == nil {
164 return "<nil>"
165 }
166 return fmt.Sprintf("LogEntry(%+v)", *p)
167 }
+0
-23
tracing/zipkin/_thrift/gen-go/zipkincollector/constants.go less more
0 // Autogenerated by Thrift Compiler (0.9.2)
1 // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
2
3 package zipkincollector
4
5 import (
6 "bytes"
7 "fmt"
8 "github.com/apache/thrift/lib/go/thrift"
9 "scribe"
10 "zipkindependencies"
11 )
12
13 // (needed to ensure safety because of naive import list construction.)
14 var _ = thrift.ZERO
15 var _ = fmt.Printf
16 var _ = bytes.Equal
17
18 var _ = scribe.GoUnusedProtection__
19 var _ = zipkindependencies.GoUnusedProtection__
20
21 func init() {
22 }
+0
-205
tracing/zipkin/_thrift/gen-go/zipkincollector/ttypes.go less more
0 // Autogenerated by Thrift Compiler (0.9.2)
1 // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
2
3 package zipkincollector
4
5 import (
6 "bytes"
7 "fmt"
8 "github.com/apache/thrift/lib/go/thrift"
9 "scribe"
10 "zipkindependencies"
11 )
12
13 // (needed to ensure safety because of naive import list construction.)
14 var _ = thrift.ZERO
15 var _ = fmt.Printf
16 var _ = bytes.Equal
17
18 var _ = scribe.GoUnusedProtection__
19 var _ = zipkindependencies.GoUnusedProtection__
20 var GoUnusedProtection__ int
21
22 type AdjustableRateException struct {
23 Msg string `thrift:"msg,1" json:"msg"`
24 }
25
26 func NewAdjustableRateException() *AdjustableRateException {
27 return &AdjustableRateException{}
28 }
29
30 func (p *AdjustableRateException) GetMsg() string {
31 return p.Msg
32 }
33 func (p *AdjustableRateException) Read(iprot thrift.TProtocol) error {
34 if _, err := iprot.ReadStructBegin(); err != nil {
35 return fmt.Errorf("%T read error: %s", p, err)
36 }
37 for {
38 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
39 if err != nil {
40 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
41 }
42 if fieldTypeId == thrift.STOP {
43 break
44 }
45 switch fieldId {
46 case 1:
47 if err := p.ReadField1(iprot); err != nil {
48 return err
49 }
50 default:
51 if err := iprot.Skip(fieldTypeId); err != nil {
52 return err
53 }
54 }
55 if err := iprot.ReadFieldEnd(); err != nil {
56 return err
57 }
58 }
59 if err := iprot.ReadStructEnd(); err != nil {
60 return fmt.Errorf("%T read struct end error: %s", p, err)
61 }
62 return nil
63 }
64
65 func (p *AdjustableRateException) ReadField1(iprot thrift.TProtocol) error {
66 if v, err := iprot.ReadString(); err != nil {
67 return fmt.Errorf("error reading field 1: %s", err)
68 } else {
69 p.Msg = v
70 }
71 return nil
72 }
73
74 func (p *AdjustableRateException) Write(oprot thrift.TProtocol) error {
75 if err := oprot.WriteStructBegin("AdjustableRateException"); err != nil {
76 return fmt.Errorf("%T write struct begin error: %s", p, err)
77 }
78 if err := p.writeField1(oprot); err != nil {
79 return err
80 }
81 if err := oprot.WriteFieldStop(); err != nil {
82 return fmt.Errorf("write field stop error: %s", err)
83 }
84 if err := oprot.WriteStructEnd(); err != nil {
85 return fmt.Errorf("write struct stop error: %s", err)
86 }
87 return nil
88 }
89
90 func (p *AdjustableRateException) writeField1(oprot thrift.TProtocol) (err error) {
91 if err := oprot.WriteFieldBegin("msg", thrift.STRING, 1); err != nil {
92 return fmt.Errorf("%T write field begin error 1:msg: %s", p, err)
93 }
94 if err := oprot.WriteString(string(p.Msg)); err != nil {
95 return fmt.Errorf("%T.msg (1) field write error: %s", p, err)
96 }
97 if err := oprot.WriteFieldEnd(); err != nil {
98 return fmt.Errorf("%T write field end error 1:msg: %s", p, err)
99 }
100 return err
101 }
102
103 func (p *AdjustableRateException) String() string {
104 if p == nil {
105 return "<nil>"
106 }
107 return fmt.Sprintf("AdjustableRateException(%+v)", *p)
108 }
109
110 func (p *AdjustableRateException) Error() string {
111 return p.String()
112 }
113
114 type StoreAggregatesException struct {
115 Msg string `thrift:"msg,1" json:"msg"`
116 }
117
118 func NewStoreAggregatesException() *StoreAggregatesException {
119 return &StoreAggregatesException{}
120 }
121
122 func (p *StoreAggregatesException) GetMsg() string {
123 return p.Msg
124 }
125 func (p *StoreAggregatesException) Read(iprot thrift.TProtocol) error {
126 if _, err := iprot.ReadStructBegin(); err != nil {
127 return fmt.Errorf("%T read error: %s", p, err)
128 }
129 for {
130 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
131 if err != nil {
132 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
133 }
134 if fieldTypeId == thrift.STOP {
135 break
136 }
137 switch fieldId {
138 case 1:
139 if err := p.ReadField1(iprot); err != nil {
140 return err
141 }
142 default:
143 if err := iprot.Skip(fieldTypeId); err != nil {
144 return err
145 }
146 }
147 if err := iprot.ReadFieldEnd(); err != nil {
148 return err
149 }
150 }
151 if err := iprot.ReadStructEnd(); err != nil {
152 return fmt.Errorf("%T read struct end error: %s", p, err)
153 }
154 return nil
155 }
156
157 func (p *StoreAggregatesException) ReadField1(iprot thrift.TProtocol) error {
158 if v, err := iprot.ReadString(); err != nil {
159 return fmt.Errorf("error reading field 1: %s", err)
160 } else {
161 p.Msg = v
162 }
163 return nil
164 }
165
166 func (p *StoreAggregatesException) Write(oprot thrift.TProtocol) error {
167 if err := oprot.WriteStructBegin("StoreAggregatesException"); err != nil {
168 return fmt.Errorf("%T write struct begin error: %s", p, err)
169 }
170 if err := p.writeField1(oprot); err != nil {
171 return err
172 }
173 if err := oprot.WriteFieldStop(); err != nil {
174 return fmt.Errorf("write field stop error: %s", err)
175 }
176 if err := oprot.WriteStructEnd(); err != nil {
177 return fmt.Errorf("write struct stop error: %s", err)
178 }
179 return nil
180 }
181
182 func (p *StoreAggregatesException) writeField1(oprot thrift.TProtocol) (err error) {
183 if err := oprot.WriteFieldBegin("msg", thrift.STRING, 1); err != nil {
184 return fmt.Errorf("%T write field begin error 1:msg: %s", p, err)
185 }
186 if err := oprot.WriteString(string(p.Msg)); err != nil {
187 return fmt.Errorf("%T.msg (1) field write error: %s", p, err)
188 }
189 if err := oprot.WriteFieldEnd(); err != nil {
190 return fmt.Errorf("%T write field end error 1:msg: %s", p, err)
191 }
192 return err
193 }
194
195 func (p *StoreAggregatesException) String() string {
196 if p == nil {
197 return "<nil>"
198 }
199 return fmt.Sprintf("StoreAggregatesException(%+v)", *p)
200 }
201
202 func (p *StoreAggregatesException) Error() string {
203 return p.String()
204 }
+0
-234
tracing/zipkin/_thrift/gen-go/zipkincollector/zipkin_collector-remote/zipkin_collector-remote.go less more
0 // Autogenerated by Thrift Compiler (0.9.2)
1 // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
2
3 package main
4
5 import (
6 "flag"
7 "fmt"
8 "github.com/apache/thrift/lib/go/thrift"
9 "math"
10 "net"
11 "net/url"
12 "os"
13 "strconv"
14 "strings"
15 "zipkincollector"
16 )
17
18 func Usage() {
19 fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:")
20 flag.PrintDefaults()
21 fmt.Fprintln(os.Stderr, "\nFunctions:")
22 fmt.Fprintln(os.Stderr, " void storeTopAnnotations(string service_name, annotations)")
23 fmt.Fprintln(os.Stderr, " void storeTopKeyValueAnnotations(string service_name, annotations)")
24 fmt.Fprintln(os.Stderr, " void storeDependencies(Dependencies dependencies)")
25 fmt.Fprintln(os.Stderr, " ResultCode Log( messages)")
26 fmt.Fprintln(os.Stderr)
27 os.Exit(0)
28 }
29
30 func main() {
31 flag.Usage = Usage
32 var host string
33 var port int
34 var protocol string
35 var urlString string
36 var framed bool
37 var useHttp bool
38 var parsedUrl url.URL
39 var trans thrift.TTransport
40 _ = strconv.Atoi
41 _ = math.Abs
42 flag.Usage = Usage
43 flag.StringVar(&host, "h", "localhost", "Specify host and port")
44 flag.IntVar(&port, "p", 9090, "Specify port")
45 flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
46 flag.StringVar(&urlString, "u", "", "Specify the url")
47 flag.BoolVar(&framed, "framed", false, "Use framed transport")
48 flag.BoolVar(&useHttp, "http", false, "Use http")
49 flag.Parse()
50
51 if len(urlString) > 0 {
52 parsedUrl, err := url.Parse(urlString)
53 if err != nil {
54 fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
55 flag.Usage()
56 }
57 host = parsedUrl.Host
58 useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
59 } else if useHttp {
60 _, err := url.Parse(fmt.Sprint("http://", host, ":", port))
61 if err != nil {
62 fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
63 flag.Usage()
64 }
65 }
66
67 cmd := flag.Arg(0)
68 var err error
69 if useHttp {
70 trans, err = thrift.NewTHttpClient(parsedUrl.String())
71 } else {
72 portStr := fmt.Sprint(port)
73 if strings.Contains(host, ":") {
74 host, portStr, err = net.SplitHostPort(host)
75 if err != nil {
76 fmt.Fprintln(os.Stderr, "error with host:", err)
77 os.Exit(1)
78 }
79 }
80 trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
81 if err != nil {
82 fmt.Fprintln(os.Stderr, "error resolving address:", err)
83 os.Exit(1)
84 }
85 if framed {
86 trans = thrift.NewTFramedTransport(trans)
87 }
88 }
89 if err != nil {
90 fmt.Fprintln(os.Stderr, "Error creating transport", err)
91 os.Exit(1)
92 }
93 defer trans.Close()
94 var protocolFactory thrift.TProtocolFactory
95 switch protocol {
96 case "compact":
97 protocolFactory = thrift.NewTCompactProtocolFactory()
98 break
99 case "simplejson":
100 protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
101 break
102 case "json":
103 protocolFactory = thrift.NewTJSONProtocolFactory()
104 break
105 case "binary", "":
106 protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
107 break
108 default:
109 fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
110 Usage()
111 os.Exit(1)
112 }
113 client := zipkincollector.NewZipkinCollectorClientFactory(trans, protocolFactory)
114 if err := trans.Open(); err != nil {
115 fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
116 os.Exit(1)
117 }
118
119 switch cmd {
120 case "storeTopAnnotations":
121 if flag.NArg()-1 != 2 {
122 fmt.Fprintln(os.Stderr, "StoreTopAnnotations requires 2 args")
123 flag.Usage()
124 }
125 argvalue0 := flag.Arg(1)
126 value0 := argvalue0
127 arg10 := flag.Arg(2)
128 mbTrans11 := thrift.NewTMemoryBufferLen(len(arg10))
129 defer mbTrans11.Close()
130 _, err12 := mbTrans11.WriteString(arg10)
131 if err12 != nil {
132 Usage()
133 return
134 }
135 factory13 := thrift.NewTSimpleJSONProtocolFactory()
136 jsProt14 := factory13.GetProtocol(mbTrans11)
137 containerStruct1 := zipkincollector.NewStoreTopAnnotationsArgs()
138 err15 := containerStruct1.ReadField2(jsProt14)
139 if err15 != nil {
140 Usage()
141 return
142 }
143 argvalue1 := containerStruct1.Annotations
144 value1 := argvalue1
145 fmt.Print(client.StoreTopAnnotations(value0, value1))
146 fmt.Print("\n")
147 break
148 case "storeTopKeyValueAnnotations":
149 if flag.NArg()-1 != 2 {
150 fmt.Fprintln(os.Stderr, "StoreTopKeyValueAnnotations requires 2 args")
151 flag.Usage()
152 }
153 argvalue0 := flag.Arg(1)
154 value0 := argvalue0
155 arg17 := flag.Arg(2)
156 mbTrans18 := thrift.NewTMemoryBufferLen(len(arg17))
157 defer mbTrans18.Close()
158 _, err19 := mbTrans18.WriteString(arg17)
159 if err19 != nil {
160 Usage()
161 return
162 }
163 factory20 := thrift.NewTSimpleJSONProtocolFactory()
164 jsProt21 := factory20.GetProtocol(mbTrans18)
165 containerStruct1 := zipkincollector.NewStoreTopKeyValueAnnotationsArgs()
166 err22 := containerStruct1.ReadField2(jsProt21)
167 if err22 != nil {
168 Usage()
169 return
170 }
171 argvalue1 := containerStruct1.Annotations
172 value1 := argvalue1
173 fmt.Print(client.StoreTopKeyValueAnnotations(value0, value1))
174 fmt.Print("\n")
175 break
176 case "storeDependencies":
177 if flag.NArg()-1 != 1 {
178 fmt.Fprintln(os.Stderr, "StoreDependencies requires 1 args")
179 flag.Usage()
180 }
181 arg23 := flag.Arg(1)
182 mbTrans24 := thrift.NewTMemoryBufferLen(len(arg23))
183 defer mbTrans24.Close()
184 _, err25 := mbTrans24.WriteString(arg23)
185 if err25 != nil {
186 Usage()
187 return
188 }
189 factory26 := thrift.NewTSimpleJSONProtocolFactory()
190 jsProt27 := factory26.GetProtocol(mbTrans24)
191 argvalue0 := zipkincollector.NewDependencies()
192 err28 := argvalue0.Read(jsProt27)
193 if err28 != nil {
194 Usage()
195 return
196 }
197 value0 := argvalue0
198 fmt.Print(client.StoreDependencies(value0))
199 fmt.Print("\n")
200 break
201 case "Log":
202 if flag.NArg()-1 != 1 {
203 fmt.Fprintln(os.Stderr, "Log requires 1 args")
204 flag.Usage()
205 }
206 arg29 := flag.Arg(1)
207 mbTrans30 := thrift.NewTMemoryBufferLen(len(arg29))
208 defer mbTrans30.Close()
209 _, err31 := mbTrans30.WriteString(arg29)
210 if err31 != nil {
211 Usage()
212 return
213 }
214 factory32 := thrift.NewTSimpleJSONProtocolFactory()
215 jsProt33 := factory32.GetProtocol(mbTrans30)
216 containerStruct0 := zipkincollector.NewLogArgs()
217 err34 := containerStruct0.ReadField1(jsProt33)
218 if err34 != nil {
219 Usage()
220 return
221 }
222 argvalue0 := containerStruct0.Messages
223 value0 := argvalue0
224 fmt.Print(client.Log(value0))
225 fmt.Print("\n")
226 break
227 case "":
228 Usage()
229 break
230 default:
231 fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
232 }
233 }
+0
-1112
tracing/zipkin/_thrift/gen-go/zipkincollector/zipkincollector.go less more
0 // Autogenerated by Thrift Compiler (0.9.2)
1 // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
2
3 package zipkincollector
4
5 import (
6 "bytes"
7 "fmt"
8 "github.com/apache/thrift/lib/go/thrift"
9 "scribe"
10 "zipkindependencies"
11 )
12
13 // (needed to ensure safety because of naive import list construction.)
14 var _ = thrift.ZERO
15 var _ = fmt.Printf
16 var _ = bytes.Equal
17
18 var _ = scribe.GoUnusedProtection__
19 var _ = zipkindependencies.GoUnusedProtection__
20
21 type ZipkinCollector interface {
22 scribe.Scribe
23
24 // Aggregates methods
25 //
26 // Parameters:
27 // - ServiceName
28 // - Annotations
29 StoreTopAnnotations(service_name string, annotations []string) (err error)
30 // Parameters:
31 // - ServiceName
32 // - Annotations
33 StoreTopKeyValueAnnotations(service_name string, annotations []string) (err error)
34 // Parameters:
35 // - Dependencies
36 StoreDependencies(dependencies *zipkindependencies.Dependencies) (err error)
37 }
38
39 type ZipkinCollectorClient struct {
40 *scribe.ScribeClient
41 }
42
43 func NewZipkinCollectorClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ZipkinCollectorClient {
44 return &ZipkinCollectorClient{ScribeClient: scribe.NewScribeClientFactory(t, f)}
45 }
46
47 func NewZipkinCollectorClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ZipkinCollectorClient {
48 return &ZipkinCollectorClient{ScribeClient: scribe.NewScribeClientProtocol(t, iprot, oprot)}
49 }
50
51 // Aggregates methods
52 //
53 // Parameters:
54 // - ServiceName
55 // - Annotations
56 func (p *ZipkinCollectorClient) StoreTopAnnotations(service_name string, annotations []string) (err error) {
57 if err = p.sendStoreTopAnnotations(service_name, annotations); err != nil {
58 return
59 }
60 return p.recvStoreTopAnnotations()
61 }
62
63 func (p *ZipkinCollectorClient) sendStoreTopAnnotations(service_name string, annotations []string) (err error) {
64 oprot := p.OutputProtocol
65 if oprot == nil {
66 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
67 p.OutputProtocol = oprot
68 }
69 p.SeqId++
70 if err = oprot.WriteMessageBegin("storeTopAnnotations", thrift.CALL, p.SeqId); err != nil {
71 return
72 }
73 args := StoreTopAnnotationsArgs{
74 ServiceName: service_name,
75 Annotations: annotations,
76 }
77 if err = args.Write(oprot); err != nil {
78 return
79 }
80 if err = oprot.WriteMessageEnd(); err != nil {
81 return
82 }
83 return oprot.Flush()
84 }
85
86 func (p *ZipkinCollectorClient) recvStoreTopAnnotations() (err error) {
87 iprot := p.InputProtocol
88 if iprot == nil {
89 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
90 p.InputProtocol = iprot
91 }
92 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
93 if err != nil {
94 return
95 }
96 if mTypeId == thrift.EXCEPTION {
97 error0 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
98 var error1 error
99 error1, err = error0.Read(iprot)
100 if err != nil {
101 return
102 }
103 if err = iprot.ReadMessageEnd(); err != nil {
104 return
105 }
106 err = error1
107 return
108 }
109 if p.SeqId != seqId {
110 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "storeTopAnnotations failed: out of sequence response")
111 return
112 }
113 result := StoreTopAnnotationsResult{}
114 if err = result.Read(iprot); err != nil {
115 return
116 }
117 if err = iprot.ReadMessageEnd(); err != nil {
118 return
119 }
120 if result.E != nil {
121 err = result.E
122 return
123 }
124 return
125 }
126
127 // Parameters:
128 // - ServiceName
129 // - Annotations
130 func (p *ZipkinCollectorClient) StoreTopKeyValueAnnotations(service_name string, annotations []string) (err error) {
131 if err = p.sendStoreTopKeyValueAnnotations(service_name, annotations); err != nil {
132 return
133 }
134 return p.recvStoreTopKeyValueAnnotations()
135 }
136
137 func (p *ZipkinCollectorClient) sendStoreTopKeyValueAnnotations(service_name string, annotations []string) (err error) {
138 oprot := p.OutputProtocol
139 if oprot == nil {
140 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
141 p.OutputProtocol = oprot
142 }
143 p.SeqId++
144 if err = oprot.WriteMessageBegin("storeTopKeyValueAnnotations", thrift.CALL, p.SeqId); err != nil {
145 return
146 }
147 args := StoreTopKeyValueAnnotationsArgs{
148 ServiceName: service_name,
149 Annotations: annotations,
150 }
151 if err = args.Write(oprot); err != nil {
152 return
153 }
154 if err = oprot.WriteMessageEnd(); err != nil {
155 return
156 }
157 return oprot.Flush()
158 }
159
160 func (p *ZipkinCollectorClient) recvStoreTopKeyValueAnnotations() (err error) {
161 iprot := p.InputProtocol
162 if iprot == nil {
163 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
164 p.InputProtocol = iprot
165 }
166 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
167 if err != nil {
168 return
169 }
170 if mTypeId == thrift.EXCEPTION {
171 error2 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
172 var error3 error
173 error3, err = error2.Read(iprot)
174 if err != nil {
175 return
176 }
177 if err = iprot.ReadMessageEnd(); err != nil {
178 return
179 }
180 err = error3
181 return
182 }
183 if p.SeqId != seqId {
184 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "storeTopKeyValueAnnotations failed: out of sequence response")
185 return
186 }
187 result := StoreTopKeyValueAnnotationsResult{}
188 if err = result.Read(iprot); err != nil {
189 return
190 }
191 if err = iprot.ReadMessageEnd(); err != nil {
192 return
193 }
194 if result.E != nil {
195 err = result.E
196 return
197 }
198 return
199 }
200
201 // Parameters:
202 // - Dependencies
203 func (p *ZipkinCollectorClient) StoreDependencies(dependencies *zipkindependencies.Dependencies) (err error) {
204 if err = p.sendStoreDependencies(dependencies); err != nil {
205 return
206 }
207 return p.recvStoreDependencies()
208 }
209
210 func (p *ZipkinCollectorClient) sendStoreDependencies(dependencies *zipkindependencies.Dependencies) (err error) {
211 oprot := p.OutputProtocol
212 if oprot == nil {
213 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
214 p.OutputProtocol = oprot
215 }
216 p.SeqId++
217 if err = oprot.WriteMessageBegin("storeDependencies", thrift.CALL, p.SeqId); err != nil {
218 return
219 }
220 args := StoreDependenciesArgs{
221 Dependencies: dependencies,
222 }
223 if err = args.Write(oprot); err != nil {
224 return
225 }
226 if err = oprot.WriteMessageEnd(); err != nil {
227 return
228 }
229 return oprot.Flush()
230 }
231
232 func (p *ZipkinCollectorClient) recvStoreDependencies() (err error) {
233 iprot := p.InputProtocol
234 if iprot == nil {
235 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
236 p.InputProtocol = iprot
237 }
238 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
239 if err != nil {
240 return
241 }
242 if mTypeId == thrift.EXCEPTION {
243 error4 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
244 var error5 error
245 error5, err = error4.Read(iprot)
246 if err != nil {
247 return
248 }
249 if err = iprot.ReadMessageEnd(); err != nil {
250 return
251 }
252 err = error5
253 return
254 }
255 if p.SeqId != seqId {
256 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "storeDependencies failed: out of sequence response")
257 return
258 }
259 result := StoreDependenciesResult{}
260 if err = result.Read(iprot); err != nil {
261 return
262 }
263 if err = iprot.ReadMessageEnd(); err != nil {
264 return
265 }
266 if result.E != nil {
267 err = result.E
268 return
269 }
270 return
271 }
272
273 type ZipkinCollectorProcessor struct {
274 *scribe.ScribeProcessor
275 }
276
277 func NewZipkinCollectorProcessor(handler ZipkinCollector) *ZipkinCollectorProcessor {
278 self6 := &ZipkinCollectorProcessor{scribe.NewScribeProcessor(handler)}
279 self6.AddToProcessorMap("storeTopAnnotations", &zipkinCollectorProcessorStoreTopAnnotations{handler: handler})
280 self6.AddToProcessorMap("storeTopKeyValueAnnotations", &zipkinCollectorProcessorStoreTopKeyValueAnnotations{handler: handler})
281 self6.AddToProcessorMap("storeDependencies", &zipkinCollectorProcessorStoreDependencies{handler: handler})
282 return self6
283 }
284
285 type zipkinCollectorProcessorStoreTopAnnotations struct {
286 handler ZipkinCollector
287 }
288
289 func (p *zipkinCollectorProcessorStoreTopAnnotations) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
290 args := StoreTopAnnotationsArgs{}
291 if err = args.Read(iprot); err != nil {
292 iprot.ReadMessageEnd()
293 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
294 oprot.WriteMessageBegin("storeTopAnnotations", thrift.EXCEPTION, seqId)
295 x.Write(oprot)
296 oprot.WriteMessageEnd()
297 oprot.Flush()
298 return false, err
299 }
300
301 iprot.ReadMessageEnd()
302 result := StoreTopAnnotationsResult{}
303 var err2 error
304 if err2 = p.handler.StoreTopAnnotations(args.ServiceName, args.Annotations); err2 != nil {
305 switch v := err2.(type) {
306 case *StoreAggregatesException:
307 result.E = v
308 default:
309 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing storeTopAnnotations: "+err2.Error())
310 oprot.WriteMessageBegin("storeTopAnnotations", thrift.EXCEPTION, seqId)
311 x.Write(oprot)
312 oprot.WriteMessageEnd()
313 oprot.Flush()
314 return true, err2
315 }
316 }
317 if err2 = oprot.WriteMessageBegin("storeTopAnnotations", thrift.REPLY, seqId); err2 != nil {
318 err = err2
319 }
320 if err2 = result.Write(oprot); err == nil && err2 != nil {
321 err = err2
322 }
323 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
324 err = err2
325 }
326 if err2 = oprot.Flush(); err == nil && err2 != nil {
327 err = err2
328 }
329 if err != nil {
330 return
331 }
332 return true, err
333 }
334
335 type zipkinCollectorProcessorStoreTopKeyValueAnnotations struct {
336 handler ZipkinCollector
337 }
338
339 func (p *zipkinCollectorProcessorStoreTopKeyValueAnnotations) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
340 args := StoreTopKeyValueAnnotationsArgs{}
341 if err = args.Read(iprot); err != nil {
342 iprot.ReadMessageEnd()
343 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
344 oprot.WriteMessageBegin("storeTopKeyValueAnnotations", thrift.EXCEPTION, seqId)
345 x.Write(oprot)
346 oprot.WriteMessageEnd()
347 oprot.Flush()
348 return false, err
349 }
350
351 iprot.ReadMessageEnd()
352 result := StoreTopKeyValueAnnotationsResult{}
353 var err2 error
354 if err2 = p.handler.StoreTopKeyValueAnnotations(args.ServiceName, args.Annotations); err2 != nil {
355 switch v := err2.(type) {
356 case *StoreAggregatesException:
357 result.E = v
358 default:
359 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing storeTopKeyValueAnnotations: "+err2.Error())
360 oprot.WriteMessageBegin("storeTopKeyValueAnnotations", thrift.EXCEPTION, seqId)
361 x.Write(oprot)
362 oprot.WriteMessageEnd()
363 oprot.Flush()
364 return true, err2
365 }
366 }
367 if err2 = oprot.WriteMessageBegin("storeTopKeyValueAnnotations", thrift.REPLY, seqId); err2 != nil {
368 err = err2
369 }
370 if err2 = result.Write(oprot); err == nil && err2 != nil {
371 err = err2
372 }
373 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
374 err = err2
375 }
376 if err2 = oprot.Flush(); err == nil && err2 != nil {
377 err = err2
378 }
379 if err != nil {
380 return
381 }
382 return true, err
383 }
384
385 type zipkinCollectorProcessorStoreDependencies struct {
386 handler ZipkinCollector
387 }
388
389 func (p *zipkinCollectorProcessorStoreDependencies) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
390 args := StoreDependenciesArgs{}
391 if err = args.Read(iprot); err != nil {
392 iprot.ReadMessageEnd()
393 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
394 oprot.WriteMessageBegin("storeDependencies", thrift.EXCEPTION, seqId)
395 x.Write(oprot)
396 oprot.WriteMessageEnd()
397 oprot.Flush()
398 return false, err
399 }
400
401 iprot.ReadMessageEnd()
402 result := StoreDependenciesResult{}
403 var err2 error
404 if err2 = p.handler.StoreDependencies(args.Dependencies); err2 != nil {
405 switch v := err2.(type) {
406 case *StoreAggregatesException:
407 result.E = v
408 default:
409 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing storeDependencies: "+err2.Error())
410 oprot.WriteMessageBegin("storeDependencies", thrift.EXCEPTION, seqId)
411 x.Write(oprot)
412 oprot.WriteMessageEnd()
413 oprot.Flush()
414 return true, err2
415 }
416 }
417 if err2 = oprot.WriteMessageBegin("storeDependencies", thrift.REPLY, seqId); err2 != nil {
418 err = err2
419 }
420 if err2 = result.Write(oprot); err == nil && err2 != nil {
421 err = err2
422 }
423 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
424 err = err2
425 }
426 if err2 = oprot.Flush(); err == nil && err2 != nil {
427 err = err2
428 }
429 if err != nil {
430 return
431 }
432 return true, err
433 }
434
435 // HELPER FUNCTIONS AND STRUCTURES
436
437 type StoreTopAnnotationsArgs struct {
438 ServiceName string `thrift:"service_name,1" json:"service_name"`
439 Annotations []string `thrift:"annotations,2" json:"annotations"`
440 }
441
442 func NewStoreTopAnnotationsArgs() *StoreTopAnnotationsArgs {
443 return &StoreTopAnnotationsArgs{}
444 }
445
446 func (p *StoreTopAnnotationsArgs) GetServiceName() string {
447 return p.ServiceName
448 }
449
450 func (p *StoreTopAnnotationsArgs) GetAnnotations() []string {
451 return p.Annotations
452 }
453 func (p *StoreTopAnnotationsArgs) Read(iprot thrift.TProtocol) error {
454 if _, err := iprot.ReadStructBegin(); err != nil {
455 return fmt.Errorf("%T read error: %s", p, err)
456 }
457 for {
458 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
459 if err != nil {
460 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
461 }
462 if fieldTypeId == thrift.STOP {
463 break
464 }
465 switch fieldId {
466 case 1:
467 if err := p.ReadField1(iprot); err != nil {
468 return err
469 }
470 case 2:
471 if err := p.ReadField2(iprot); err != nil {
472 return err
473 }
474 default:
475 if err := iprot.Skip(fieldTypeId); err != nil {
476 return err
477 }
478 }
479 if err := iprot.ReadFieldEnd(); err != nil {
480 return err
481 }
482 }
483 if err := iprot.ReadStructEnd(); err != nil {
484 return fmt.Errorf("%T read struct end error: %s", p, err)
485 }
486 return nil
487 }
488
489 func (p *StoreTopAnnotationsArgs) ReadField1(iprot thrift.TProtocol) error {
490 if v, err := iprot.ReadString(); err != nil {
491 return fmt.Errorf("error reading field 1: %s", err)
492 } else {
493 p.ServiceName = v
494 }
495 return nil
496 }
497
498 func (p *StoreTopAnnotationsArgs) ReadField2(iprot thrift.TProtocol) error {
499 _, size, err := iprot.ReadListBegin()
500 if err != nil {
501 return fmt.Errorf("error reading list begin: %s", err)
502 }
503 tSlice := make([]string, 0, size)
504 p.Annotations = tSlice
505 for i := 0; i < size; i++ {
506 var _elem7 string
507 if v, err := iprot.ReadString(); err != nil {
508 return fmt.Errorf("error reading field 0: %s", err)
509 } else {
510 _elem7 = v
511 }
512 p.Annotations = append(p.Annotations, _elem7)
513 }
514 if err := iprot.ReadListEnd(); err != nil {
515 return fmt.Errorf("error reading list end: %s", err)
516 }
517 return nil
518 }
519
520 func (p *StoreTopAnnotationsArgs) Write(oprot thrift.TProtocol) error {
521 if err := oprot.WriteStructBegin("storeTopAnnotations_args"); err != nil {
522 return fmt.Errorf("%T write struct begin error: %s", p, err)
523 }
524 if err := p.writeField1(oprot); err != nil {
525 return err
526 }
527 if err := p.writeField2(oprot); err != nil {
528 return err
529 }
530 if err := oprot.WriteFieldStop(); err != nil {
531 return fmt.Errorf("write field stop error: %s", err)
532 }
533 if err := oprot.WriteStructEnd(); err != nil {
534 return fmt.Errorf("write struct stop error: %s", err)
535 }
536 return nil
537 }
538
539 func (p *StoreTopAnnotationsArgs) writeField1(oprot thrift.TProtocol) (err error) {
540 if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil {
541 return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err)
542 }
543 if err := oprot.WriteString(string(p.ServiceName)); err != nil {
544 return fmt.Errorf("%T.service_name (1) field write error: %s", p, err)
545 }
546 if err := oprot.WriteFieldEnd(); err != nil {
547 return fmt.Errorf("%T write field end error 1:service_name: %s", p, err)
548 }
549 return err
550 }
551
552 func (p *StoreTopAnnotationsArgs) writeField2(oprot thrift.TProtocol) (err error) {
553 if err := oprot.WriteFieldBegin("annotations", thrift.LIST, 2); err != nil {
554 return fmt.Errorf("%T write field begin error 2:annotations: %s", p, err)
555 }
556 if err := oprot.WriteListBegin(thrift.STRING, len(p.Annotations)); err != nil {
557 return fmt.Errorf("error writing list begin: %s", err)
558 }
559 for _, v := range p.Annotations {
560 if err := oprot.WriteString(string(v)); err != nil {
561 return fmt.Errorf("%T. (0) field write error: %s", p, err)
562 }
563 }
564 if err := oprot.WriteListEnd(); err != nil {
565 return fmt.Errorf("error writing list end: %s", err)
566 }
567 if err := oprot.WriteFieldEnd(); err != nil {
568 return fmt.Errorf("%T write field end error 2:annotations: %s", p, err)
569 }
570 return err
571 }
572
573 func (p *StoreTopAnnotationsArgs) String() string {
574 if p == nil {
575 return "<nil>"
576 }
577 return fmt.Sprintf("StoreTopAnnotationsArgs(%+v)", *p)
578 }
579
580 type StoreTopAnnotationsResult struct {
581 E *StoreAggregatesException `thrift:"e,1" json:"e"`
582 }
583
584 func NewStoreTopAnnotationsResult() *StoreTopAnnotationsResult {
585 return &StoreTopAnnotationsResult{}
586 }
587
588 var StoreTopAnnotationsResult_E_DEFAULT *StoreAggregatesException
589
590 func (p *StoreTopAnnotationsResult) GetE() *StoreAggregatesException {
591 if !p.IsSetE() {
592 return StoreTopAnnotationsResult_E_DEFAULT
593 }
594 return p.E
595 }
596 func (p *StoreTopAnnotationsResult) IsSetE() bool {
597 return p.E != nil
598 }
599
600 func (p *StoreTopAnnotationsResult) Read(iprot thrift.TProtocol) error {
601 if _, err := iprot.ReadStructBegin(); err != nil {
602 return fmt.Errorf("%T read error: %s", p, err)
603 }
604 for {
605 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
606 if err != nil {
607 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
608 }
609 if fieldTypeId == thrift.STOP {
610 break
611 }
612 switch fieldId {
613 case 1:
614 if err := p.ReadField1(iprot); err != nil {
615 return err
616 }
617 default:
618 if err := iprot.Skip(fieldTypeId); err != nil {
619 return err
620 }
621 }
622 if err := iprot.ReadFieldEnd(); err != nil {
623 return err
624 }
625 }
626 if err := iprot.ReadStructEnd(); err != nil {
627 return fmt.Errorf("%T read struct end error: %s", p, err)
628 }
629 return nil
630 }
631
632 func (p *StoreTopAnnotationsResult) ReadField1(iprot thrift.TProtocol) error {
633 p.E = &StoreAggregatesException{}
634 if err := p.E.Read(iprot); err != nil {
635 return fmt.Errorf("%T error reading struct: %s", p.E, err)
636 }
637 return nil
638 }
639
640 func (p *StoreTopAnnotationsResult) Write(oprot thrift.TProtocol) error {
641 if err := oprot.WriteStructBegin("storeTopAnnotations_result"); err != nil {
642 return fmt.Errorf("%T write struct begin error: %s", p, err)
643 }
644 if err := p.writeField1(oprot); err != nil {
645 return err
646 }
647 if err := oprot.WriteFieldStop(); err != nil {
648 return fmt.Errorf("write field stop error: %s", err)
649 }
650 if err := oprot.WriteStructEnd(); err != nil {
651 return fmt.Errorf("write struct stop error: %s", err)
652 }
653 return nil
654 }
655
656 func (p *StoreTopAnnotationsResult) writeField1(oprot thrift.TProtocol) (err error) {
657 if p.IsSetE() {
658 if err := oprot.WriteFieldBegin("e", thrift.STRUCT, 1); err != nil {
659 return fmt.Errorf("%T write field begin error 1:e: %s", p, err)
660 }
661 if err := p.E.Write(oprot); err != nil {
662 return fmt.Errorf("%T error writing struct: %s", p.E, err)
663 }
664 if err := oprot.WriteFieldEnd(); err != nil {
665 return fmt.Errorf("%T write field end error 1:e: %s", p, err)
666 }
667 }
668 return err
669 }
670
671 func (p *StoreTopAnnotationsResult) String() string {
672 if p == nil {
673 return "<nil>"
674 }
675 return fmt.Sprintf("StoreTopAnnotationsResult(%+v)", *p)
676 }
677
678 type StoreTopKeyValueAnnotationsArgs struct {
679 ServiceName string `thrift:"service_name,1" json:"service_name"`
680 Annotations []string `thrift:"annotations,2" json:"annotations"`
681 }
682
683 func NewStoreTopKeyValueAnnotationsArgs() *StoreTopKeyValueAnnotationsArgs {
684 return &StoreTopKeyValueAnnotationsArgs{}
685 }
686
687 func (p *StoreTopKeyValueAnnotationsArgs) GetServiceName() string {
688 return p.ServiceName
689 }
690
691 func (p *StoreTopKeyValueAnnotationsArgs) GetAnnotations() []string {
692 return p.Annotations
693 }
694 func (p *StoreTopKeyValueAnnotationsArgs) Read(iprot thrift.TProtocol) error {
695 if _, err := iprot.ReadStructBegin(); err != nil {
696 return fmt.Errorf("%T read error: %s", p, err)
697 }
698 for {
699 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
700 if err != nil {
701 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
702 }
703 if fieldTypeId == thrift.STOP {
704 break
705 }
706 switch fieldId {
707 case 1:
708 if err := p.ReadField1(iprot); err != nil {
709 return err
710 }
711 case 2:
712 if err := p.ReadField2(iprot); err != nil {
713 return err
714 }
715 default:
716 if err := iprot.Skip(fieldTypeId); err != nil {
717 return err
718 }
719 }
720 if err := iprot.ReadFieldEnd(); err != nil {
721 return err
722 }
723 }
724 if err := iprot.ReadStructEnd(); err != nil {
725 return fmt.Errorf("%T read struct end error: %s", p, err)
726 }
727 return nil
728 }
729
730 func (p *StoreTopKeyValueAnnotationsArgs) ReadField1(iprot thrift.TProtocol) error {
731 if v, err := iprot.ReadString(); err != nil {
732 return fmt.Errorf("error reading field 1: %s", err)
733 } else {
734 p.ServiceName = v
735 }
736 return nil
737 }
738
739 func (p *StoreTopKeyValueAnnotationsArgs) ReadField2(iprot thrift.TProtocol) error {
740 _, size, err := iprot.ReadListBegin()
741 if err != nil {
742 return fmt.Errorf("error reading list begin: %s", err)
743 }
744 tSlice := make([]string, 0, size)
745 p.Annotations = tSlice
746 for i := 0; i < size; i++ {
747 var _elem8 string
748 if v, err := iprot.ReadString(); err != nil {
749 return fmt.Errorf("error reading field 0: %s", err)
750 } else {
751 _elem8 = v
752 }
753 p.Annotations = append(p.Annotations, _elem8)
754 }
755 if err := iprot.ReadListEnd(); err != nil {
756 return fmt.Errorf("error reading list end: %s", err)
757 }
758 return nil
759 }
760
761 func (p *StoreTopKeyValueAnnotationsArgs) Write(oprot thrift.TProtocol) error {
762 if err := oprot.WriteStructBegin("storeTopKeyValueAnnotations_args"); err != nil {
763 return fmt.Errorf("%T write struct begin error: %s", p, err)
764 }
765 if err := p.writeField1(oprot); err != nil {
766 return err
767 }
768 if err := p.writeField2(oprot); err != nil {
769 return err
770 }
771 if err := oprot.WriteFieldStop(); err != nil {
772 return fmt.Errorf("write field stop error: %s", err)
773 }
774 if err := oprot.WriteStructEnd(); err != nil {
775 return fmt.Errorf("write struct stop error: %s", err)
776 }
777 return nil
778 }
779
780 func (p *StoreTopKeyValueAnnotationsArgs) writeField1(oprot thrift.TProtocol) (err error) {
781 if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil {
782 return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err)
783 }
784 if err := oprot.WriteString(string(p.ServiceName)); err != nil {
785 return fmt.Errorf("%T.service_name (1) field write error: %s", p, err)
786 }
787 if err := oprot.WriteFieldEnd(); err != nil {
788 return fmt.Errorf("%T write field end error 1:service_name: %s", p, err)
789 }
790 return err
791 }
792
793 func (p *StoreTopKeyValueAnnotationsArgs) writeField2(oprot thrift.TProtocol) (err error) {
794 if err := oprot.WriteFieldBegin("annotations", thrift.LIST, 2); err != nil {
795 return fmt.Errorf("%T write field begin error 2:annotations: %s", p, err)
796 }
797 if err := oprot.WriteListBegin(thrift.STRING, len(p.Annotations)); err != nil {
798 return fmt.Errorf("error writing list begin: %s", err)
799 }
800 for _, v := range p.Annotations {
801 if err := oprot.WriteString(string(v)); err != nil {
802 return fmt.Errorf("%T. (0) field write error: %s", p, err)
803 }
804 }
805 if err := oprot.WriteListEnd(); err != nil {
806 return fmt.Errorf("error writing list end: %s", err)
807 }
808 if err := oprot.WriteFieldEnd(); err != nil {
809 return fmt.Errorf("%T write field end error 2:annotations: %s", p, err)
810 }
811 return err
812 }
813
814 func (p *StoreTopKeyValueAnnotationsArgs) String() string {
815 if p == nil {
816 return "<nil>"
817 }
818 return fmt.Sprintf("StoreTopKeyValueAnnotationsArgs(%+v)", *p)
819 }
820
821 type StoreTopKeyValueAnnotationsResult struct {
822 E *StoreAggregatesException `thrift:"e,1" json:"e"`
823 }
824
825 func NewStoreTopKeyValueAnnotationsResult() *StoreTopKeyValueAnnotationsResult {
826 return &StoreTopKeyValueAnnotationsResult{}
827 }
828
829 var StoreTopKeyValueAnnotationsResult_E_DEFAULT *StoreAggregatesException
830
831 func (p *StoreTopKeyValueAnnotationsResult) GetE() *StoreAggregatesException {
832 if !p.IsSetE() {
833 return StoreTopKeyValueAnnotationsResult_E_DEFAULT
834 }
835 return p.E
836 }
837 func (p *StoreTopKeyValueAnnotationsResult) IsSetE() bool {
838 return p.E != nil
839 }
840
841 func (p *StoreTopKeyValueAnnotationsResult) Read(iprot thrift.TProtocol) error {
842 if _, err := iprot.ReadStructBegin(); err != nil {
843 return fmt.Errorf("%T read error: %s", p, err)
844 }
845 for {
846 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
847 if err != nil {
848 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
849 }
850 if fieldTypeId == thrift.STOP {
851 break
852 }
853 switch fieldId {
854 case 1:
855 if err := p.ReadField1(iprot); err != nil {
856 return err
857 }
858 default:
859 if err := iprot.Skip(fieldTypeId); err != nil {
860 return err
861 }
862 }
863 if err := iprot.ReadFieldEnd(); err != nil {
864 return err
865 }
866 }
867 if err := iprot.ReadStructEnd(); err != nil {
868 return fmt.Errorf("%T read struct end error: %s", p, err)
869 }
870 return nil
871 }
872
873 func (p *StoreTopKeyValueAnnotationsResult) ReadField1(iprot thrift.TProtocol) error {
874 p.E = &StoreAggregatesException{}
875 if err := p.E.Read(iprot); err != nil {
876 return fmt.Errorf("%T error reading struct: %s", p.E, err)
877 }
878 return nil
879 }
880
881 func (p *StoreTopKeyValueAnnotationsResult) Write(oprot thrift.TProtocol) error {
882 if err := oprot.WriteStructBegin("storeTopKeyValueAnnotations_result"); err != nil {
883 return fmt.Errorf("%T write struct begin error: %s", p, err)
884 }
885 if err := p.writeField1(oprot); err != nil {
886 return err
887 }
888 if err := oprot.WriteFieldStop(); err != nil {
889 return fmt.Errorf("write field stop error: %s", err)
890 }
891 if err := oprot.WriteStructEnd(); err != nil {
892 return fmt.Errorf("write struct stop error: %s", err)
893 }
894 return nil
895 }
896
897 func (p *StoreTopKeyValueAnnotationsResult) writeField1(oprot thrift.TProtocol) (err error) {
898 if p.IsSetE() {
899 if err := oprot.WriteFieldBegin("e", thrift.STRUCT, 1); err != nil {
900 return fmt.Errorf("%T write field begin error 1:e: %s", p, err)
901 }
902 if err := p.E.Write(oprot); err != nil {
903 return fmt.Errorf("%T error writing struct: %s", p.E, err)
904 }
905 if err := oprot.WriteFieldEnd(); err != nil {
906 return fmt.Errorf("%T write field end error 1:e: %s", p, err)
907 }
908 }
909 return err
910 }
911
912 func (p *StoreTopKeyValueAnnotationsResult) String() string {
913 if p == nil {
914 return "<nil>"
915 }
916 return fmt.Sprintf("StoreTopKeyValueAnnotationsResult(%+v)", *p)
917 }
918
919 type StoreDependenciesArgs struct {
920 Dependencies *zipkindependencies.Dependencies `thrift:"dependencies,1" json:"dependencies"`
921 }
922
923 func NewStoreDependenciesArgs() *StoreDependenciesArgs {
924 return &StoreDependenciesArgs{}
925 }
926
927 var StoreDependenciesArgs_Dependencies_DEFAULT *zipkindependencies.Dependencies
928
929 func (p *StoreDependenciesArgs) GetDependencies() *zipkindependencies.Dependencies {
930 if !p.IsSetDependencies() {
931 return StoreDependenciesArgs_Dependencies_DEFAULT
932 }
933 return p.Dependencies
934 }
935 func (p *StoreDependenciesArgs) IsSetDependencies() bool {
936 return p.Dependencies != nil
937 }
938
939 func (p *StoreDependenciesArgs) Read(iprot thrift.TProtocol) error {
940 if _, err := iprot.ReadStructBegin(); err != nil {
941 return fmt.Errorf("%T read error: %s", p, err)
942 }
943 for {
944 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
945 if err != nil {
946 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
947 }
948 if fieldTypeId == thrift.STOP {
949 break
950 }
951 switch fieldId {
952 case 1:
953 if err := p.ReadField1(iprot); err != nil {
954 return err
955 }
956 default:
957 if err := iprot.Skip(fieldTypeId); err != nil {
958 return err
959 }
960 }
961 if err := iprot.ReadFieldEnd(); err != nil {
962 return err
963 }
964 }
965 if err := iprot.ReadStructEnd(); err != nil {
966 return fmt.Errorf("%T read struct end error: %s", p, err)
967 }
968 return nil
969 }
970
971 func (p *StoreDependenciesArgs) ReadField1(iprot thrift.TProtocol) error {
972 p.Dependencies = &zipkindependencies.Dependencies{}
973 if err := p.Dependencies.Read(iprot); err != nil {
974 return fmt.Errorf("%T error reading struct: %s", p.Dependencies, err)
975 }
976 return nil
977 }
978
979 func (p *StoreDependenciesArgs) Write(oprot thrift.TProtocol) error {
980 if err := oprot.WriteStructBegin("storeDependencies_args"); err != nil {
981 return fmt.Errorf("%T write struct begin error: %s", p, err)
982 }
983 if err := p.writeField1(oprot); err != nil {
984 return err
985 }
986 if err := oprot.WriteFieldStop(); err != nil {
987 return fmt.Errorf("write field stop error: %s", err)
988 }
989 if err := oprot.WriteStructEnd(); err != nil {
990 return fmt.Errorf("write struct stop error: %s", err)
991 }
992 return nil
993 }
994
995 func (p *StoreDependenciesArgs) writeField1(oprot thrift.TProtocol) (err error) {
996 if err := oprot.WriteFieldBegin("dependencies", thrift.STRUCT, 1); err != nil {
997 return fmt.Errorf("%T write field begin error 1:dependencies: %s", p, err)
998 }
999 if err := p.Dependencies.Write(oprot); err != nil {
1000 return fmt.Errorf("%T error writing struct: %s", p.Dependencies, err)
1001 }
1002 if err := oprot.WriteFieldEnd(); err != nil {
1003 return fmt.Errorf("%T write field end error 1:dependencies: %s", p, err)
1004 }
1005 return err
1006 }
1007
1008 func (p *StoreDependenciesArgs) String() string {
1009 if p == nil {
1010 return "<nil>"
1011 }
1012 return fmt.Sprintf("StoreDependenciesArgs(%+v)", *p)
1013 }
1014
1015 type StoreDependenciesResult struct {
1016 E *StoreAggregatesException `thrift:"e,1" json:"e"`
1017 }
1018
1019 func NewStoreDependenciesResult() *StoreDependenciesResult {
1020 return &StoreDependenciesResult{}
1021 }
1022
1023 var StoreDependenciesResult_E_DEFAULT *StoreAggregatesException
1024
1025 func (p *StoreDependenciesResult) GetE() *StoreAggregatesException {
1026 if !p.IsSetE() {
1027 return StoreDependenciesResult_E_DEFAULT
1028 }
1029 return p.E
1030 }
1031 func (p *StoreDependenciesResult) IsSetE() bool {
1032 return p.E != nil
1033 }
1034
1035 func (p *StoreDependenciesResult) Read(iprot thrift.TProtocol) error {
1036 if _, err := iprot.ReadStructBegin(); err != nil {
1037 return fmt.Errorf("%T read error: %s", p, err)
1038 }
1039 for {
1040 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
1041 if err != nil {
1042 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
1043 }
1044 if fieldTypeId == thrift.STOP {
1045 break
1046 }
1047 switch fieldId {
1048 case 1:
1049 if err := p.ReadField1(iprot); err != nil {
1050 return err
1051 }
1052 default:
1053 if err := iprot.Skip(fieldTypeId); err != nil {
1054 return err
1055 }
1056 }
1057 if err := iprot.ReadFieldEnd(); err != nil {
1058 return err
1059 }
1060 }
1061 if err := iprot.ReadStructEnd(); err != nil {
1062 return fmt.Errorf("%T read struct end error: %s", p, err)
1063 }
1064 return nil
1065 }
1066
1067 func (p *StoreDependenciesResult) ReadField1(iprot thrift.TProtocol) error {
1068 p.E = &StoreAggregatesException{}
1069 if err := p.E.Read(iprot); err != nil {
1070 return fmt.Errorf("%T error reading struct: %s", p.E, err)
1071 }
1072 return nil
1073 }
1074
1075 func (p *StoreDependenciesResult) Write(oprot thrift.TProtocol) error {
1076 if err := oprot.WriteStructBegin("storeDependencies_result"); err != nil {
1077 return fmt.Errorf("%T write struct begin error: %s", p, err)
1078 }
1079 if err := p.writeField1(oprot); err != nil {
1080 return err
1081 }
1082 if err := oprot.WriteFieldStop(); err != nil {
1083 return fmt.Errorf("write field stop error: %s", err)
1084 }
1085 if err := oprot.WriteStructEnd(); err != nil {
1086 return fmt.Errorf("write struct stop error: %s", err)
1087 }
1088 return nil
1089 }
1090
1091 func (p *StoreDependenciesResult) writeField1(oprot thrift.TProtocol) (err error) {
1092 if p.IsSetE() {
1093 if err := oprot.WriteFieldBegin("e", thrift.STRUCT, 1); err != nil {
1094 return fmt.Errorf("%T write field begin error 1:e: %s", p, err)
1095 }
1096 if err := p.E.Write(oprot); err != nil {
1097 return fmt.Errorf("%T error writing struct: %s", p.E, err)
1098 }
1099 if err := oprot.WriteFieldEnd(); err != nil {
1100 return fmt.Errorf("%T write field end error 1:e: %s", p, err)
1101 }
1102 }
1103 return err
1104 }
1105
1106 func (p *StoreDependenciesResult) String() string {
1107 if p == nil {
1108 return "<nil>"
1109 }
1110 return fmt.Sprintf("StoreDependenciesResult(%+v)", *p)
1111 }
+0
-23
tracing/zipkin/_thrift/gen-go/zipkincore/constants.go less more
0 // Autogenerated by Thrift Compiler (0.9.2)
1 // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
2
3 package zipkincore
4
5 import (
6 "bytes"
7 "fmt"
8 "github.com/apache/thrift/lib/go/thrift"
9 )
10
11 // (needed to ensure safety because of naive import list construction.)
12 var _ = thrift.ZERO
13 var _ = fmt.Printf
14 var _ = bytes.Equal
15
16 const CLIENT_SEND = "cs"
17 const CLIENT_RECV = "cr"
18 const SERVER_SEND = "ss"
19 const SERVER_RECV = "sr"
20
21 func init() {
22 }
+0
-990
tracing/zipkin/_thrift/gen-go/zipkincore/ttypes.go less more
0 // Autogenerated by Thrift Compiler (0.9.2)
1 // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
2
3 package zipkincore
4
5 import (
6 "bytes"
7 "fmt"
8 "github.com/apache/thrift/lib/go/thrift"
9 )
10
11 // (needed to ensure safety because of naive import list construction.)
12 var _ = thrift.ZERO
13 var _ = fmt.Printf
14 var _ = bytes.Equal
15
16 var GoUnusedProtection__ int
17
18 type AnnotationType int64
19
20 const (
21 AnnotationType_BOOL AnnotationType = 0
22 AnnotationType_BYTES AnnotationType = 1
23 AnnotationType_I16 AnnotationType = 2
24 AnnotationType_I32 AnnotationType = 3
25 AnnotationType_I64 AnnotationType = 4
26 AnnotationType_DOUBLE AnnotationType = 5
27 AnnotationType_STRING AnnotationType = 6
28 )
29
30 func (p AnnotationType) String() string {
31 switch p {
32 case AnnotationType_BOOL:
33 return "AnnotationType_BOOL"
34 case AnnotationType_BYTES:
35 return "AnnotationType_BYTES"
36 case AnnotationType_I16:
37 return "AnnotationType_I16"
38 case AnnotationType_I32:
39 return "AnnotationType_I32"
40 case AnnotationType_I64:
41 return "AnnotationType_I64"
42 case AnnotationType_DOUBLE:
43 return "AnnotationType_DOUBLE"
44 case AnnotationType_STRING:
45 return "AnnotationType_STRING"
46 }
47 return "<UNSET>"
48 }
49
50 func AnnotationTypeFromString(s string) (AnnotationType, error) {
51 switch s {
52 case "AnnotationType_BOOL":
53 return AnnotationType_BOOL, nil
54 case "AnnotationType_BYTES":
55 return AnnotationType_BYTES, nil
56 case "AnnotationType_I16":
57 return AnnotationType_I16, nil
58 case "AnnotationType_I32":
59 return AnnotationType_I32, nil
60 case "AnnotationType_I64":
61 return AnnotationType_I64, nil
62 case "AnnotationType_DOUBLE":
63 return AnnotationType_DOUBLE, nil
64 case "AnnotationType_STRING":
65 return AnnotationType_STRING, nil
66 }
67 return AnnotationType(0), fmt.Errorf("not a valid AnnotationType string")
68 }
69
70 func AnnotationTypePtr(v AnnotationType) *AnnotationType { return &v }
71
72 type Endpoint struct {
73 Ipv4 int32 `thrift:"ipv4,1" json:"ipv4"`
74 Port int16 `thrift:"port,2" json:"port"`
75 ServiceName string `thrift:"service_name,3" json:"service_name"`
76 }
77
78 func NewEndpoint() *Endpoint {
79 return &Endpoint{}
80 }
81
82 func (p *Endpoint) GetIpv4() int32 {
83 return p.Ipv4
84 }
85
86 func (p *Endpoint) GetPort() int16 {
87 return p.Port
88 }
89
90 func (p *Endpoint) GetServiceName() string {
91 return p.ServiceName
92 }
93 func (p *Endpoint) Read(iprot thrift.TProtocol) error {
94 if _, err := iprot.ReadStructBegin(); err != nil {
95 return fmt.Errorf("%T read error: %s", p, err)
96 }
97 for {
98 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
99 if err != nil {
100 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
101 }
102 if fieldTypeId == thrift.STOP {
103 break
104 }
105 switch fieldId {
106 case 1:
107 if err := p.ReadField1(iprot); err != nil {
108 return err
109 }
110 case 2:
111 if err := p.ReadField2(iprot); err != nil {
112 return err
113 }
114 case 3:
115 if err := p.ReadField3(iprot); err != nil {
116 return err
117 }
118 default:
119 if err := iprot.Skip(fieldTypeId); err != nil {
120 return err
121 }
122 }
123 if err := iprot.ReadFieldEnd(); err != nil {
124 return err
125 }
126 }
127 if err := iprot.ReadStructEnd(); err != nil {
128 return fmt.Errorf("%T read struct end error: %s", p, err)
129 }
130 return nil
131 }
132
133 func (p *Endpoint) ReadField1(iprot thrift.TProtocol) error {
134 if v, err := iprot.ReadI32(); err != nil {
135 return fmt.Errorf("error reading field 1: %s", err)
136 } else {
137 p.Ipv4 = v
138 }
139 return nil
140 }
141
142 func (p *Endpoint) ReadField2(iprot thrift.TProtocol) error {
143 if v, err := iprot.ReadI16(); err != nil {
144 return fmt.Errorf("error reading field 2: %s", err)
145 } else {
146 p.Port = v
147 }
148 return nil
149 }
150
151 func (p *Endpoint) ReadField3(iprot thrift.TProtocol) error {
152 if v, err := iprot.ReadString(); err != nil {
153 return fmt.Errorf("error reading field 3: %s", err)
154 } else {
155 p.ServiceName = v
156 }
157 return nil
158 }
159
160 func (p *Endpoint) Write(oprot thrift.TProtocol) error {
161 if err := oprot.WriteStructBegin("Endpoint"); err != nil {
162 return fmt.Errorf("%T write struct begin error: %s", p, err)
163 }
164 if err := p.writeField1(oprot); err != nil {
165 return err
166 }
167 if err := p.writeField2(oprot); err != nil {
168 return err
169 }
170 if err := p.writeField3(oprot); err != nil {
171 return err
172 }
173 if err := oprot.WriteFieldStop(); err != nil {
174 return fmt.Errorf("write field stop error: %s", err)
175 }
176 if err := oprot.WriteStructEnd(); err != nil {
177 return fmt.Errorf("write struct stop error: %s", err)
178 }
179 return nil
180 }
181
182 func (p *Endpoint) writeField1(oprot thrift.TProtocol) (err error) {
183 if err := oprot.WriteFieldBegin("ipv4", thrift.I32, 1); err != nil {
184 return fmt.Errorf("%T write field begin error 1:ipv4: %s", p, err)
185 }
186 if err := oprot.WriteI32(int32(p.Ipv4)); err != nil {
187 return fmt.Errorf("%T.ipv4 (1) field write error: %s", p, err)
188 }
189 if err := oprot.WriteFieldEnd(); err != nil {
190 return fmt.Errorf("%T write field end error 1:ipv4: %s", p, err)
191 }
192 return err
193 }
194
195 func (p *Endpoint) writeField2(oprot thrift.TProtocol) (err error) {
196 if err := oprot.WriteFieldBegin("port", thrift.I16, 2); err != nil {
197 return fmt.Errorf("%T write field begin error 2:port: %s", p, err)
198 }
199 if err := oprot.WriteI16(int16(p.Port)); err != nil {
200 return fmt.Errorf("%T.port (2) field write error: %s", p, err)
201 }
202 if err := oprot.WriteFieldEnd(); err != nil {
203 return fmt.Errorf("%T write field end error 2:port: %s", p, err)
204 }
205 return err
206 }
207
208 func (p *Endpoint) writeField3(oprot thrift.TProtocol) (err error) {
209 if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 3); err != nil {
210 return fmt.Errorf("%T write field begin error 3:service_name: %s", p, err)
211 }
212 if err := oprot.WriteString(string(p.ServiceName)); err != nil {
213 return fmt.Errorf("%T.service_name (3) field write error: %s", p, err)
214 }
215 if err := oprot.WriteFieldEnd(); err != nil {
216 return fmt.Errorf("%T write field end error 3:service_name: %s", p, err)
217 }
218 return err
219 }
220
221 func (p *Endpoint) String() string {
222 if p == nil {
223 return "<nil>"
224 }
225 return fmt.Sprintf("Endpoint(%+v)", *p)
226 }
227
228 type Annotation struct {
229 Timestamp int64 `thrift:"timestamp,1" json:"timestamp"`
230 Value string `thrift:"value,2" json:"value"`
231 Host *Endpoint `thrift:"host,3" json:"host"`
232 Duration *int32 `thrift:"duration,4" json:"duration"`
233 }
234
235 func NewAnnotation() *Annotation {
236 return &Annotation{}
237 }
238
239 func (p *Annotation) GetTimestamp() int64 {
240 return p.Timestamp
241 }
242
243 func (p *Annotation) GetValue() string {
244 return p.Value
245 }
246
247 var Annotation_Host_DEFAULT *Endpoint
248
249 func (p *Annotation) GetHost() *Endpoint {
250 if !p.IsSetHost() {
251 return Annotation_Host_DEFAULT
252 }
253 return p.Host
254 }
255
256 var Annotation_Duration_DEFAULT int32
257
258 func (p *Annotation) GetDuration() int32 {
259 if !p.IsSetDuration() {
260 return Annotation_Duration_DEFAULT
261 }
262 return *p.Duration
263 }
264 func (p *Annotation) IsSetHost() bool {
265 return p.Host != nil
266 }
267
268 func (p *Annotation) IsSetDuration() bool {
269 return p.Duration != nil
270 }
271
272 func (p *Annotation) Read(iprot thrift.TProtocol) error {
273 if _, err := iprot.ReadStructBegin(); err != nil {
274 return fmt.Errorf("%T read error: %s", p, err)
275 }
276 for {
277 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
278 if err != nil {
279 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
280 }
281 if fieldTypeId == thrift.STOP {
282 break
283 }
284 switch fieldId {
285 case 1:
286 if err := p.ReadField1(iprot); err != nil {
287 return err
288 }
289 case 2:
290 if err := p.ReadField2(iprot); err != nil {
291 return err
292 }
293 case 3:
294 if err := p.ReadField3(iprot); err != nil {
295 return err
296 }
297 case 4:
298 if err := p.ReadField4(iprot); err != nil {
299 return err
300 }
301 default:
302 if err := iprot.Skip(fieldTypeId); err != nil {
303 return err
304 }
305 }
306 if err := iprot.ReadFieldEnd(); err != nil {
307 return err
308 }
309 }
310 if err := iprot.ReadStructEnd(); err != nil {
311 return fmt.Errorf("%T read struct end error: %s", p, err)
312 }
313 return nil
314 }
315
316 func (p *Annotation) ReadField1(iprot thrift.TProtocol) error {
317 if v, err := iprot.ReadI64(); err != nil {
318 return fmt.Errorf("error reading field 1: %s", err)
319 } else {
320 p.Timestamp = v
321 }
322 return nil
323 }
324
325 func (p *Annotation) ReadField2(iprot thrift.TProtocol) error {
326 if v, err := iprot.ReadString(); err != nil {
327 return fmt.Errorf("error reading field 2: %s", err)
328 } else {
329 p.Value = v
330 }
331 return nil
332 }
333
334 func (p *Annotation) ReadField3(iprot thrift.TProtocol) error {
335 p.Host = &Endpoint{}
336 if err := p.Host.Read(iprot); err != nil {
337 return fmt.Errorf("%T error reading struct: %s", p.Host, err)
338 }
339 return nil
340 }
341
342 func (p *Annotation) ReadField4(iprot thrift.TProtocol) error {
343 if v, err := iprot.ReadI32(); err != nil {
344 return fmt.Errorf("error reading field 4: %s", err)
345 } else {
346 p.Duration = &v
347 }
348 return nil
349 }
350
351 func (p *Annotation) Write(oprot thrift.TProtocol) error {
352 if err := oprot.WriteStructBegin("Annotation"); err != nil {
353 return fmt.Errorf("%T write struct begin error: %s", p, err)
354 }
355 if err := p.writeField1(oprot); err != nil {
356 return err
357 }
358 if err := p.writeField2(oprot); err != nil {
359 return err
360 }
361 if err := p.writeField3(oprot); err != nil {
362 return err
363 }
364 if err := p.writeField4(oprot); err != nil {
365 return err
366 }
367 if err := oprot.WriteFieldStop(); err != nil {
368 return fmt.Errorf("write field stop error: %s", err)
369 }
370 if err := oprot.WriteStructEnd(); err != nil {
371 return fmt.Errorf("write struct stop error: %s", err)
372 }
373 return nil
374 }
375
376 func (p *Annotation) writeField1(oprot thrift.TProtocol) (err error) {
377 if err := oprot.WriteFieldBegin("timestamp", thrift.I64, 1); err != nil {
378 return fmt.Errorf("%T write field begin error 1:timestamp: %s", p, err)
379 }
380 if err := oprot.WriteI64(int64(p.Timestamp)); err != nil {
381 return fmt.Errorf("%T.timestamp (1) field write error: %s", p, err)
382 }
383 if err := oprot.WriteFieldEnd(); err != nil {
384 return fmt.Errorf("%T write field end error 1:timestamp: %s", p, err)
385 }
386 return err
387 }
388
389 func (p *Annotation) writeField2(oprot thrift.TProtocol) (err error) {
390 if err := oprot.WriteFieldBegin("value", thrift.STRING, 2); err != nil {
391 return fmt.Errorf("%T write field begin error 2:value: %s", p, err)
392 }
393 if err := oprot.WriteString(string(p.Value)); err != nil {
394 return fmt.Errorf("%T.value (2) field write error: %s", p, err)
395 }
396 if err := oprot.WriteFieldEnd(); err != nil {
397 return fmt.Errorf("%T write field end error 2:value: %s", p, err)
398 }
399 return err
400 }
401
402 func (p *Annotation) writeField3(oprot thrift.TProtocol) (err error) {
403 if p.IsSetHost() {
404 if err := oprot.WriteFieldBegin("host", thrift.STRUCT, 3); err != nil {
405 return fmt.Errorf("%T write field begin error 3:host: %s", p, err)
406 }
407 if err := p.Host.Write(oprot); err != nil {
408 return fmt.Errorf("%T error writing struct: %s", p.Host, err)
409 }
410 if err := oprot.WriteFieldEnd(); err != nil {
411 return fmt.Errorf("%T write field end error 3:host: %s", p, err)
412 }
413 }
414 return err
415 }
416
417 func (p *Annotation) writeField4(oprot thrift.TProtocol) (err error) {
418 if p.IsSetDuration() {
419 if err := oprot.WriteFieldBegin("duration", thrift.I32, 4); err != nil {
420 return fmt.Errorf("%T write field begin error 4:duration: %s", p, err)
421 }
422 if err := oprot.WriteI32(int32(*p.Duration)); err != nil {
423 return fmt.Errorf("%T.duration (4) field write error: %s", p, err)
424 }
425 if err := oprot.WriteFieldEnd(); err != nil {
426 return fmt.Errorf("%T write field end error 4:duration: %s", p, err)
427 }
428 }
429 return err
430 }
431
432 func (p *Annotation) String() string {
433 if p == nil {
434 return "<nil>"
435 }
436 return fmt.Sprintf("Annotation(%+v)", *p)
437 }
438
439 type BinaryAnnotation struct {
440 Key string `thrift:"key,1" json:"key"`
441 Value []byte `thrift:"value,2" json:"value"`
442 AnnotationType AnnotationType `thrift:"annotation_type,3" json:"annotation_type"`
443 Host *Endpoint `thrift:"host,4" json:"host"`
444 }
445
446 func NewBinaryAnnotation() *BinaryAnnotation {
447 return &BinaryAnnotation{}
448 }
449
450 func (p *BinaryAnnotation) GetKey() string {
451 return p.Key
452 }
453
454 func (p *BinaryAnnotation) GetValue() []byte {
455 return p.Value
456 }
457
458 func (p *BinaryAnnotation) GetAnnotationType() AnnotationType {
459 return p.AnnotationType
460 }
461
462 var BinaryAnnotation_Host_DEFAULT *Endpoint
463
464 func (p *BinaryAnnotation) GetHost() *Endpoint {
465 if !p.IsSetHost() {
466 return BinaryAnnotation_Host_DEFAULT
467 }
468 return p.Host
469 }
470 func (p *BinaryAnnotation) IsSetHost() bool {
471 return p.Host != nil
472 }
473
474 func (p *BinaryAnnotation) Read(iprot thrift.TProtocol) error {
475 if _, err := iprot.ReadStructBegin(); err != nil {
476 return fmt.Errorf("%T read error: %s", p, err)
477 }
478 for {
479 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
480 if err != nil {
481 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
482 }
483 if fieldTypeId == thrift.STOP {
484 break
485 }
486 switch fieldId {
487 case 1:
488 if err := p.ReadField1(iprot); err != nil {
489 return err
490 }
491 case 2:
492 if err := p.ReadField2(iprot); err != nil {
493 return err
494 }
495 case 3:
496 if err := p.ReadField3(iprot); err != nil {
497 return err
498 }
499 case 4:
500 if err := p.ReadField4(iprot); err != nil {
501 return err
502 }
503 default:
504 if err := iprot.Skip(fieldTypeId); err != nil {
505 return err
506 }
507 }
508 if err := iprot.ReadFieldEnd(); err != nil {
509 return err
510 }
511 }
512 if err := iprot.ReadStructEnd(); err != nil {
513 return fmt.Errorf("%T read struct end error: %s", p, err)
514 }
515 return nil
516 }
517
518 func (p *BinaryAnnotation) ReadField1(iprot thrift.TProtocol) error {
519 if v, err := iprot.ReadString(); err != nil {
520 return fmt.Errorf("error reading field 1: %s", err)
521 } else {
522 p.Key = v
523 }
524 return nil
525 }
526
527 func (p *BinaryAnnotation) ReadField2(iprot thrift.TProtocol) error {
528 if v, err := iprot.ReadBinary(); err != nil {
529 return fmt.Errorf("error reading field 2: %s", err)
530 } else {
531 p.Value = v
532 }
533 return nil
534 }
535
536 func (p *BinaryAnnotation) ReadField3(iprot thrift.TProtocol) error {
537 if v, err := iprot.ReadI32(); err != nil {
538 return fmt.Errorf("error reading field 3: %s", err)
539 } else {
540 temp := AnnotationType(v)
541 p.AnnotationType = temp
542 }
543 return nil
544 }
545
546 func (p *BinaryAnnotation) ReadField4(iprot thrift.TProtocol) error {
547 p.Host = &Endpoint{}
548 if err := p.Host.Read(iprot); err != nil {
549 return fmt.Errorf("%T error reading struct: %s", p.Host, err)
550 }
551 return nil
552 }
553
554 func (p *BinaryAnnotation) Write(oprot thrift.TProtocol) error {
555 if err := oprot.WriteStructBegin("BinaryAnnotation"); err != nil {
556 return fmt.Errorf("%T write struct begin error: %s", p, err)
557 }
558 if err := p.writeField1(oprot); err != nil {
559 return err
560 }
561 if err := p.writeField2(oprot); err != nil {
562 return err
563 }
564 if err := p.writeField3(oprot); err != nil {
565 return err
566 }
567 if err := p.writeField4(oprot); err != nil {
568 return err
569 }
570 if err := oprot.WriteFieldStop(); err != nil {
571 return fmt.Errorf("write field stop error: %s", err)
572 }
573 if err := oprot.WriteStructEnd(); err != nil {
574 return fmt.Errorf("write struct stop error: %s", err)
575 }
576 return nil
577 }
578
579 func (p *BinaryAnnotation) writeField1(oprot thrift.TProtocol) (err error) {
580 if err := oprot.WriteFieldBegin("key", thrift.STRING, 1); err != nil {
581 return fmt.Errorf("%T write field begin error 1:key: %s", p, err)
582 }
583 if err := oprot.WriteString(string(p.Key)); err != nil {
584 return fmt.Errorf("%T.key (1) field write error: %s", p, err)
585 }
586 if err := oprot.WriteFieldEnd(); err != nil {
587 return fmt.Errorf("%T write field end error 1:key: %s", p, err)
588 }
589 return err
590 }
591
592 func (p *BinaryAnnotation) writeField2(oprot thrift.TProtocol) (err error) {
593 if err := oprot.WriteFieldBegin("value", thrift.STRING, 2); err != nil {
594 return fmt.Errorf("%T write field begin error 2:value: %s", p, err)
595 }
596 if err := oprot.WriteBinary(p.Value); err != nil {
597 return fmt.Errorf("%T.value (2) field write error: %s", p, err)
598 }
599 if err := oprot.WriteFieldEnd(); err != nil {
600 return fmt.Errorf("%T write field end error 2:value: %s", p, err)
601 }
602 return err
603 }
604
605 func (p *BinaryAnnotation) writeField3(oprot thrift.TProtocol) (err error) {
606 if err := oprot.WriteFieldBegin("annotation_type", thrift.I32, 3); err != nil {
607 return fmt.Errorf("%T write field begin error 3:annotation_type: %s", p, err)
608 }
609 if err := oprot.WriteI32(int32(p.AnnotationType)); err != nil {
610 return fmt.Errorf("%T.annotation_type (3) field write error: %s", p, err)
611 }
612 if err := oprot.WriteFieldEnd(); err != nil {
613 return fmt.Errorf("%T write field end error 3:annotation_type: %s", p, err)
614 }
615 return err
616 }
617
618 func (p *BinaryAnnotation) writeField4(oprot thrift.TProtocol) (err error) {
619 if p.IsSetHost() {
620 if err := oprot.WriteFieldBegin("host", thrift.STRUCT, 4); err != nil {
621 return fmt.Errorf("%T write field begin error 4:host: %s", p, err)
622 }
623 if err := p.Host.Write(oprot); err != nil {
624 return fmt.Errorf("%T error writing struct: %s", p.Host, err)
625 }
626 if err := oprot.WriteFieldEnd(); err != nil {
627 return fmt.Errorf("%T write field end error 4:host: %s", p, err)
628 }
629 }
630 return err
631 }
632
633 func (p *BinaryAnnotation) String() string {
634 if p == nil {
635 return "<nil>"
636 }
637 return fmt.Sprintf("BinaryAnnotation(%+v)", *p)
638 }
639
640 type Span struct {
641 TraceId int64 `thrift:"trace_id,1" json:"trace_id"`
642 // unused field # 2
643 Name string `thrift:"name,3" json:"name"`
644 Id int64 `thrift:"id,4" json:"id"`
645 ParentId *int64 `thrift:"parent_id,5" json:"parent_id"`
646 Annotations []*Annotation `thrift:"annotations,6" json:"annotations"`
647 // unused field # 7
648 BinaryAnnotations []*BinaryAnnotation `thrift:"binary_annotations,8" json:"binary_annotations"`
649 Debug bool `thrift:"debug,9" json:"debug"`
650 }
651
652 func NewSpan() *Span {
653 return &Span{}
654 }
655
656 func (p *Span) GetTraceId() int64 {
657 return p.TraceId
658 }
659
660 func (p *Span) GetName() string {
661 return p.Name
662 }
663
664 func (p *Span) GetId() int64 {
665 return p.Id
666 }
667
668 var Span_ParentId_DEFAULT int64
669
670 func (p *Span) GetParentId() int64 {
671 if !p.IsSetParentId() {
672 return Span_ParentId_DEFAULT
673 }
674 return *p.ParentId
675 }
676
677 func (p *Span) GetAnnotations() []*Annotation {
678 return p.Annotations
679 }
680
681 func (p *Span) GetBinaryAnnotations() []*BinaryAnnotation {
682 return p.BinaryAnnotations
683 }
684
685 var Span_Debug_DEFAULT bool = false
686
687 func (p *Span) GetDebug() bool {
688 return p.Debug
689 }
690 func (p *Span) IsSetParentId() bool {
691 return p.ParentId != nil
692 }
693
694 func (p *Span) IsSetDebug() bool {
695 return p.Debug != Span_Debug_DEFAULT
696 }
697
698 func (p *Span) Read(iprot thrift.TProtocol) error {
699 if _, err := iprot.ReadStructBegin(); err != nil {
700 return fmt.Errorf("%T read error: %s", p, err)
701 }
702 for {
703 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
704 if err != nil {
705 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
706 }
707 if fieldTypeId == thrift.STOP {
708 break
709 }
710 switch fieldId {
711 case 1:
712 if err := p.ReadField1(iprot); err != nil {
713 return err
714 }
715 case 3:
716 if err := p.ReadField3(iprot); err != nil {
717 return err
718 }
719 case 4:
720 if err := p.ReadField4(iprot); err != nil {
721 return err
722 }
723 case 5:
724 if err := p.ReadField5(iprot); err != nil {
725 return err
726 }
727 case 6:
728 if err := p.ReadField6(iprot); err != nil {
729 return err
730 }
731 case 8:
732 if err := p.ReadField8(iprot); err != nil {
733 return err
734 }
735 case 9:
736 if err := p.ReadField9(iprot); err != nil {
737 return err
738 }
739 default:
740 if err := iprot.Skip(fieldTypeId); err != nil {
741 return err
742 }
743 }
744 if err := iprot.ReadFieldEnd(); err != nil {
745 return err
746 }
747 }
748 if err := iprot.ReadStructEnd(); err != nil {
749 return fmt.Errorf("%T read struct end error: %s", p, err)
750 }
751 return nil
752 }
753
754 func (p *Span) ReadField1(iprot thrift.TProtocol) error {
755 if v, err := iprot.ReadI64(); err != nil {
756 return fmt.Errorf("error reading field 1: %s", err)
757 } else {
758 p.TraceId = v
759 }
760 return nil
761 }
762
763 func (p *Span) ReadField3(iprot thrift.TProtocol) error {
764 if v, err := iprot.ReadString(); err != nil {
765 return fmt.Errorf("error reading field 3: %s", err)
766 } else {
767 p.Name = v
768 }
769 return nil
770 }
771
772 func (p *Span) ReadField4(iprot thrift.TProtocol) error {
773 if v, err := iprot.ReadI64(); err != nil {
774 return fmt.Errorf("error reading field 4: %s", err)
775 } else {
776 p.Id = v
777 }
778 return nil
779 }
780
781 func (p *Span) ReadField5(iprot thrift.TProtocol) error {
782 if v, err := iprot.ReadI64(); err != nil {
783 return fmt.Errorf("error reading field 5: %s", err)
784 } else {
785 p.ParentId = &v
786 }
787 return nil
788 }
789
790 func (p *Span) ReadField6(iprot thrift.TProtocol) error {
791 _, size, err := iprot.ReadListBegin()
792 if err != nil {
793 return fmt.Errorf("error reading list begin: %s", err)
794 }
795 tSlice := make([]*Annotation, 0, size)
796 p.Annotations = tSlice
797 for i := 0; i < size; i++ {
798 _elem0 := &Annotation{}
799 if err := _elem0.Read(iprot); err != nil {
800 return fmt.Errorf("%T error reading struct: %s", _elem0, err)
801 }
802 p.Annotations = append(p.Annotations, _elem0)
803 }
804 if err := iprot.ReadListEnd(); err != nil {
805 return fmt.Errorf("error reading list end: %s", err)
806 }
807 return nil
808 }
809
810 func (p *Span) ReadField8(iprot thrift.TProtocol) error {
811 _, size, err := iprot.ReadListBegin()
812 if err != nil {
813 return fmt.Errorf("error reading list begin: %s", err)
814 }
815 tSlice := make([]*BinaryAnnotation, 0, size)
816 p.BinaryAnnotations = tSlice
817 for i := 0; i < size; i++ {
818 _elem1 := &BinaryAnnotation{}
819 if err := _elem1.Read(iprot); err != nil {
820 return fmt.Errorf("%T error reading struct: %s", _elem1, err)
821 }
822 p.BinaryAnnotations = append(p.BinaryAnnotations, _elem1)
823 }
824 if err := iprot.ReadListEnd(); err != nil {
825 return fmt.Errorf("error reading list end: %s", err)
826 }
827 return nil
828 }
829
830 func (p *Span) ReadField9(iprot thrift.TProtocol) error {
831 if v, err := iprot.ReadBool(); err != nil {
832 return fmt.Errorf("error reading field 9: %s", err)
833 } else {
834 p.Debug = v
835 }
836 return nil
837 }
838
839 func (p *Span) Write(oprot thrift.TProtocol) error {
840 if err := oprot.WriteStructBegin("Span"); err != nil {
841 return fmt.Errorf("%T write struct begin error: %s", p, err)
842 }
843 if err := p.writeField1(oprot); err != nil {
844 return err
845 }
846 if err := p.writeField3(oprot); err != nil {
847 return err
848 }
849 if err := p.writeField4(oprot); err != nil {
850 return err
851 }
852 if err := p.writeField5(oprot); err != nil {
853 return err
854 }
855 if err := p.writeField6(oprot); err != nil {
856 return err
857 }
858 if err := p.writeField8(oprot); err != nil {
859 return err
860 }
861 if err := p.writeField9(oprot); err != nil {
862 return err
863 }
864 if err := oprot.WriteFieldStop(); err != nil {
865 return fmt.Errorf("write field stop error: %s", err)
866 }
867 if err := oprot.WriteStructEnd(); err != nil {
868 return fmt.Errorf("write struct stop error: %s", err)
869 }
870 return nil
871 }
872
873 func (p *Span) writeField1(oprot thrift.TProtocol) (err error) {
874 if err := oprot.WriteFieldBegin("trace_id", thrift.I64, 1); err != nil {
875 return fmt.Errorf("%T write field begin error 1:trace_id: %s", p, err)
876 }
877 if err := oprot.WriteI64(int64(p.TraceId)); err != nil {
878 return fmt.Errorf("%T.trace_id (1) field write error: %s", p, err)
879 }
880 if err := oprot.WriteFieldEnd(); err != nil {
881 return fmt.Errorf("%T write field end error 1:trace_id: %s", p, err)
882 }
883 return err
884 }
885
886 func (p *Span) writeField3(oprot thrift.TProtocol) (err error) {
887 if err := oprot.WriteFieldBegin("name", thrift.STRING, 3); err != nil {
888 return fmt.Errorf("%T write field begin error 3:name: %s", p, err)
889 }
890 if err := oprot.WriteString(string(p.Name)); err != nil {
891 return fmt.Errorf("%T.name (3) field write error: %s", p, err)
892 }
893 if err := oprot.WriteFieldEnd(); err != nil {
894 return fmt.Errorf("%T write field end error 3:name: %s", p, err)
895 }
896 return err
897 }
898
899 func (p *Span) writeField4(oprot thrift.TProtocol) (err error) {
900 if err := oprot.WriteFieldBegin("id", thrift.I64, 4); err != nil {
901 return fmt.Errorf("%T write field begin error 4:id: %s", p, err)
902 }
903 if err := oprot.WriteI64(int64(p.Id)); err != nil {
904 return fmt.Errorf("%T.id (4) field write error: %s", p, err)
905 }
906 if err := oprot.WriteFieldEnd(); err != nil {
907 return fmt.Errorf("%T write field end error 4:id: %s", p, err)
908 }
909 return err
910 }
911
912 func (p *Span) writeField5(oprot thrift.TProtocol) (err error) {
913 if p.IsSetParentId() {
914 if err := oprot.WriteFieldBegin("parent_id", thrift.I64, 5); err != nil {
915 return fmt.Errorf("%T write field begin error 5:parent_id: %s", p, err)
916 }
917 if err := oprot.WriteI64(int64(*p.ParentId)); err != nil {
918 return fmt.Errorf("%T.parent_id (5) field write error: %s", p, err)
919 }
920 if err := oprot.WriteFieldEnd(); err != nil {
921 return fmt.Errorf("%T write field end error 5:parent_id: %s", p, err)
922 }
923 }
924 return err
925 }
926
927 func (p *Span) writeField6(oprot thrift.TProtocol) (err error) {
928 if err := oprot.WriteFieldBegin("annotations", thrift.LIST, 6); err != nil {
929 return fmt.Errorf("%T write field begin error 6:annotations: %s", p, err)
930 }
931 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Annotations)); err != nil {
932 return fmt.Errorf("error writing list begin: %s", err)
933 }
934 for _, v := range p.Annotations {
935 if err := v.Write(oprot); err != nil {
936 return fmt.Errorf("%T error writing struct: %s", v, err)
937 }
938 }
939 if err := oprot.WriteListEnd(); err != nil {
940 return fmt.Errorf("error writing list end: %s", err)
941 }
942 if err := oprot.WriteFieldEnd(); err != nil {
943 return fmt.Errorf("%T write field end error 6:annotations: %s", p, err)
944 }
945 return err
946 }
947
948 func (p *Span) writeField8(oprot thrift.TProtocol) (err error) {
949 if err := oprot.WriteFieldBegin("binary_annotations", thrift.LIST, 8); err != nil {
950 return fmt.Errorf("%T write field begin error 8:binary_annotations: %s", p, err)
951 }
952 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.BinaryAnnotations)); err != nil {
953 return fmt.Errorf("error writing list begin: %s", err)
954 }
955 for _, v := range p.BinaryAnnotations {
956 if err := v.Write(oprot); err != nil {
957 return fmt.Errorf("%T error writing struct: %s", v, err)
958 }
959 }
960 if err := oprot.WriteListEnd(); err != nil {
961 return fmt.Errorf("error writing list end: %s", err)
962 }
963 if err := oprot.WriteFieldEnd(); err != nil {
964 return fmt.Errorf("%T write field end error 8:binary_annotations: %s", p, err)
965 }
966 return err
967 }
968
969 func (p *Span) writeField9(oprot thrift.TProtocol) (err error) {
970 if p.IsSetDebug() {
971 if err := oprot.WriteFieldBegin("debug", thrift.BOOL, 9); err != nil {
972 return fmt.Errorf("%T write field begin error 9:debug: %s", p, err)
973 }
974 if err := oprot.WriteBool(bool(p.Debug)); err != nil {
975 return fmt.Errorf("%T.debug (9) field write error: %s", p, err)
976 }
977 if err := oprot.WriteFieldEnd(); err != nil {
978 return fmt.Errorf("%T write field end error 9:debug: %s", p, err)
979 }
980 }
981 return err
982 }
983
984 func (p *Span) String() string {
985 if p == nil {
986 return "<nil>"
987 }
988 return fmt.Sprintf("Span(%+v)", *p)
989 }
+0
-18
tracing/zipkin/_thrift/gen-go/zipkindependencies/constants.go less more
0 // Autogenerated by Thrift Compiler (0.9.2)
1 // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
2
3 package zipkindependencies
4
5 import (
6 "bytes"
7 "fmt"
8 "github.com/apache/thrift/lib/go/thrift"
9 )
10
11 // (needed to ensure safety because of naive import list construction.)
12 var _ = thrift.ZERO
13 var _ = fmt.Printf
14 var _ = bytes.Equal
15
16 func init() {
17 }
+0
-580
tracing/zipkin/_thrift/gen-go/zipkindependencies/ttypes.go less more
0 // Autogenerated by Thrift Compiler (0.9.2)
1 // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
2
3 package zipkindependencies
4
5 import (
6 "bytes"
7 "fmt"
8 "github.com/apache/thrift/lib/go/thrift"
9 )
10
11 // (needed to ensure safety because of naive import list construction.)
12 var _ = thrift.ZERO
13 var _ = fmt.Printf
14 var _ = bytes.Equal
15
16 var GoUnusedProtection__ int
17
18 type Moments struct {
19 M0 int64 `thrift:"m0,1" json:"m0"`
20 M1 float64 `thrift:"m1,2" json:"m1"`
21 M2 float64 `thrift:"m2,3" json:"m2"`
22 M3 float64 `thrift:"m3,4" json:"m3"`
23 M4 float64 `thrift:"m4,5" json:"m4"`
24 }
25
26 func NewMoments() *Moments {
27 return &Moments{}
28 }
29
30 func (p *Moments) GetM0() int64 {
31 return p.M0
32 }
33
34 func (p *Moments) GetM1() float64 {
35 return p.M1
36 }
37
38 func (p *Moments) GetM2() float64 {
39 return p.M2
40 }
41
42 func (p *Moments) GetM3() float64 {
43 return p.M3
44 }
45
46 func (p *Moments) GetM4() float64 {
47 return p.M4
48 }
49 func (p *Moments) Read(iprot thrift.TProtocol) error {
50 if _, err := iprot.ReadStructBegin(); err != nil {
51 return fmt.Errorf("%T read error: %s", p, err)
52 }
53 for {
54 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
55 if err != nil {
56 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
57 }
58 if fieldTypeId == thrift.STOP {
59 break
60 }
61 switch fieldId {
62 case 1:
63 if err := p.ReadField1(iprot); err != nil {
64 return err
65 }
66 case 2:
67 if err := p.ReadField2(iprot); err != nil {
68 return err
69 }
70 case 3:
71 if err := p.ReadField3(iprot); err != nil {
72 return err
73 }
74 case 4:
75 if err := p.ReadField4(iprot); err != nil {
76 return err
77 }
78 case 5:
79 if err := p.ReadField5(iprot); err != nil {
80 return err
81 }
82 default:
83 if err := iprot.Skip(fieldTypeId); err != nil {
84 return err
85 }
86 }
87 if err := iprot.ReadFieldEnd(); err != nil {
88 return err
89 }
90 }
91 if err := iprot.ReadStructEnd(); err != nil {
92 return fmt.Errorf("%T read struct end error: %s", p, err)
93 }
94 return nil
95 }
96
97 func (p *Moments) ReadField1(iprot thrift.TProtocol) error {
98 if v, err := iprot.ReadI64(); err != nil {
99 return fmt.Errorf("error reading field 1: %s", err)
100 } else {
101 p.M0 = v
102 }
103 return nil
104 }
105
106 func (p *Moments) ReadField2(iprot thrift.TProtocol) error {
107 if v, err := iprot.ReadDouble(); err != nil {
108 return fmt.Errorf("error reading field 2: %s", err)
109 } else {
110 p.M1 = v
111 }
112 return nil
113 }
114
115 func (p *Moments) ReadField3(iprot thrift.TProtocol) error {
116 if v, err := iprot.ReadDouble(); err != nil {
117 return fmt.Errorf("error reading field 3: %s", err)
118 } else {
119 p.M2 = v
120 }
121 return nil
122 }
123
124 func (p *Moments) ReadField4(iprot thrift.TProtocol) error {
125 if v, err := iprot.ReadDouble(); err != nil {
126 return fmt.Errorf("error reading field 4: %s", err)
127 } else {
128 p.M3 = v
129 }
130 return nil
131 }
132
133 func (p *Moments) ReadField5(iprot thrift.TProtocol) error {
134 if v, err := iprot.ReadDouble(); err != nil {
135 return fmt.Errorf("error reading field 5: %s", err)
136 } else {
137 p.M4 = v
138 }
139 return nil
140 }
141
142 func (p *Moments) Write(oprot thrift.TProtocol) error {
143 if err := oprot.WriteStructBegin("Moments"); err != nil {
144 return fmt.Errorf("%T write struct begin error: %s", p, err)
145 }
146 if err := p.writeField1(oprot); err != nil {
147 return err
148 }
149 if err := p.writeField2(oprot); err != nil {
150 return err
151 }
152 if err := p.writeField3(oprot); err != nil {
153 return err
154 }
155 if err := p.writeField4(oprot); err != nil {
156 return err
157 }
158 if err := p.writeField5(oprot); err != nil {
159 return err
160 }
161 if err := oprot.WriteFieldStop(); err != nil {
162 return fmt.Errorf("write field stop error: %s", err)
163 }
164 if err := oprot.WriteStructEnd(); err != nil {
165 return fmt.Errorf("write struct stop error: %s", err)
166 }
167 return nil
168 }
169
170 func (p *Moments) writeField1(oprot thrift.TProtocol) (err error) {
171 if err := oprot.WriteFieldBegin("m0", thrift.I64, 1); err != nil {
172 return fmt.Errorf("%T write field begin error 1:m0: %s", p, err)
173 }
174 if err := oprot.WriteI64(int64(p.M0)); err != nil {
175 return fmt.Errorf("%T.m0 (1) field write error: %s", p, err)
176 }
177 if err := oprot.WriteFieldEnd(); err != nil {
178 return fmt.Errorf("%T write field end error 1:m0: %s", p, err)
179 }
180 return err
181 }
182
183 func (p *Moments) writeField2(oprot thrift.TProtocol) (err error) {
184 if err := oprot.WriteFieldBegin("m1", thrift.DOUBLE, 2); err != nil {
185 return fmt.Errorf("%T write field begin error 2:m1: %s", p, err)
186 }
187 if err := oprot.WriteDouble(float64(p.M1)); err != nil {
188 return fmt.Errorf("%T.m1 (2) field write error: %s", p, err)
189 }
190 if err := oprot.WriteFieldEnd(); err != nil {
191 return fmt.Errorf("%T write field end error 2:m1: %s", p, err)
192 }
193 return err
194 }
195
196 func (p *Moments) writeField3(oprot thrift.TProtocol) (err error) {
197 if err := oprot.WriteFieldBegin("m2", thrift.DOUBLE, 3); err != nil {
198 return fmt.Errorf("%T write field begin error 3:m2: %s", p, err)
199 }
200 if err := oprot.WriteDouble(float64(p.M2)); err != nil {
201 return fmt.Errorf("%T.m2 (3) field write error: %s", p, err)
202 }
203 if err := oprot.WriteFieldEnd(); err != nil {
204 return fmt.Errorf("%T write field end error 3:m2: %s", p, err)
205 }
206 return err
207 }
208
209 func (p *Moments) writeField4(oprot thrift.TProtocol) (err error) {
210 if err := oprot.WriteFieldBegin("m3", thrift.DOUBLE, 4); err != nil {
211 return fmt.Errorf("%T write field begin error 4:m3: %s", p, err)
212 }
213 if err := oprot.WriteDouble(float64(p.M3)); err != nil {
214 return fmt.Errorf("%T.m3 (4) field write error: %s", p, err)
215 }
216 if err := oprot.WriteFieldEnd(); err != nil {
217 return fmt.Errorf("%T write field end error 4:m3: %s", p, err)
218 }
219 return err
220 }
221
222 func (p *Moments) writeField5(oprot thrift.TProtocol) (err error) {
223 if err := oprot.WriteFieldBegin("m4", thrift.DOUBLE, 5); err != nil {
224 return fmt.Errorf("%T write field begin error 5:m4: %s", p, err)
225 }
226 if err := oprot.WriteDouble(float64(p.M4)); err != nil {
227 return fmt.Errorf("%T.m4 (5) field write error: %s", p, err)
228 }
229 if err := oprot.WriteFieldEnd(); err != nil {
230 return fmt.Errorf("%T write field end error 5:m4: %s", p, err)
231 }
232 return err
233 }
234
235 func (p *Moments) String() string {
236 if p == nil {
237 return "<nil>"
238 }
239 return fmt.Sprintf("Moments(%+v)", *p)
240 }
241
242 type DependencyLink struct {
243 Parent string `thrift:"parent,1" json:"parent"`
244 Child string `thrift:"child,2" json:"child"`
245 DurationMoments *Moments `thrift:"duration_moments,3" json:"duration_moments"`
246 }
247
248 func NewDependencyLink() *DependencyLink {
249 return &DependencyLink{}
250 }
251
252 func (p *DependencyLink) GetParent() string {
253 return p.Parent
254 }
255
256 func (p *DependencyLink) GetChild() string {
257 return p.Child
258 }
259
260 var DependencyLink_DurationMoments_DEFAULT *Moments
261
262 func (p *DependencyLink) GetDurationMoments() *Moments {
263 if !p.IsSetDurationMoments() {
264 return DependencyLink_DurationMoments_DEFAULT
265 }
266 return p.DurationMoments
267 }
268 func (p *DependencyLink) IsSetDurationMoments() bool {
269 return p.DurationMoments != nil
270 }
271
272 func (p *DependencyLink) Read(iprot thrift.TProtocol) error {
273 if _, err := iprot.ReadStructBegin(); err != nil {
274 return fmt.Errorf("%T read error: %s", p, err)
275 }
276 for {
277 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
278 if err != nil {
279 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
280 }
281 if fieldTypeId == thrift.STOP {
282 break
283 }
284 switch fieldId {
285 case 1:
286 if err := p.ReadField1(iprot); err != nil {
287 return err
288 }
289 case 2:
290 if err := p.ReadField2(iprot); err != nil {
291 return err
292 }
293 case 3:
294 if err := p.ReadField3(iprot); err != nil {
295 return err
296 }
297 default:
298 if err := iprot.Skip(fieldTypeId); err != nil {
299 return err
300 }
301 }
302 if err := iprot.ReadFieldEnd(); err != nil {
303 return err
304 }
305 }
306 if err := iprot.ReadStructEnd(); err != nil {
307 return fmt.Errorf("%T read struct end error: %s", p, err)
308 }
309 return nil
310 }
311
312 func (p *DependencyLink) ReadField1(iprot thrift.TProtocol) error {
313 if v, err := iprot.ReadString(); err != nil {
314 return fmt.Errorf("error reading field 1: %s", err)
315 } else {
316 p.Parent = v
317 }
318 return nil
319 }
320
321 func (p *DependencyLink) ReadField2(iprot thrift.TProtocol) error {
322 if v, err := iprot.ReadString(); err != nil {
323 return fmt.Errorf("error reading field 2: %s", err)
324 } else {
325 p.Child = v
326 }
327 return nil
328 }
329
330 func (p *DependencyLink) ReadField3(iprot thrift.TProtocol) error {
331 p.DurationMoments = &Moments{}
332 if err := p.DurationMoments.Read(iprot); err != nil {
333 return fmt.Errorf("%T error reading struct: %s", p.DurationMoments, err)
334 }
335 return nil
336 }
337
338 func (p *DependencyLink) Write(oprot thrift.TProtocol) error {
339 if err := oprot.WriteStructBegin("DependencyLink"); err != nil {
340 return fmt.Errorf("%T write struct begin error: %s", p, err)
341 }
342 if err := p.writeField1(oprot); err != nil {
343 return err
344 }
345 if err := p.writeField2(oprot); err != nil {
346 return err
347 }
348 if err := p.writeField3(oprot); err != nil {
349 return err
350 }
351 if err := oprot.WriteFieldStop(); err != nil {
352 return fmt.Errorf("write field stop error: %s", err)
353 }
354 if err := oprot.WriteStructEnd(); err != nil {
355 return fmt.Errorf("write struct stop error: %s", err)
356 }
357 return nil
358 }
359
360 func (p *DependencyLink) writeField1(oprot thrift.TProtocol) (err error) {
361 if err := oprot.WriteFieldBegin("parent", thrift.STRING, 1); err != nil {
362 return fmt.Errorf("%T write field begin error 1:parent: %s", p, err)
363 }
364 if err := oprot.WriteString(string(p.Parent)); err != nil {
365 return fmt.Errorf("%T.parent (1) field write error: %s", p, err)
366 }
367 if err := oprot.WriteFieldEnd(); err != nil {
368 return fmt.Errorf("%T write field end error 1:parent: %s", p, err)
369 }
370 return err
371 }
372
373 func (p *DependencyLink) writeField2(oprot thrift.TProtocol) (err error) {
374 if err := oprot.WriteFieldBegin("child", thrift.STRING, 2); err != nil {
375 return fmt.Errorf("%T write field begin error 2:child: %s", p, err)
376 }
377 if err := oprot.WriteString(string(p.Child)); err != nil {
378 return fmt.Errorf("%T.child (2) field write error: %s", p, err)
379 }
380 if err := oprot.WriteFieldEnd(); err != nil {
381 return fmt.Errorf("%T write field end error 2:child: %s", p, err)
382 }
383 return err
384 }
385
386 func (p *DependencyLink) writeField3(oprot thrift.TProtocol) (err error) {
387 if err := oprot.WriteFieldBegin("duration_moments", thrift.STRUCT, 3); err != nil {
388 return fmt.Errorf("%T write field begin error 3:duration_moments: %s", p, err)
389 }
390 if err := p.DurationMoments.Write(oprot); err != nil {
391 return fmt.Errorf("%T error writing struct: %s", p.DurationMoments, err)
392 }
393 if err := oprot.WriteFieldEnd(); err != nil {
394 return fmt.Errorf("%T write field end error 3:duration_moments: %s", p, err)
395 }
396 return err
397 }
398
399 func (p *DependencyLink) String() string {
400 if p == nil {
401 return "<nil>"
402 }
403 return fmt.Sprintf("DependencyLink(%+v)", *p)
404 }
405
406 type Dependencies struct {
407 StartTime int64 `thrift:"start_time,1" json:"start_time"`
408 EndTime int64 `thrift:"end_time,2" json:"end_time"`
409 Links []*DependencyLink `thrift:"links,3" json:"links"`
410 }
411
412 func NewDependencies() *Dependencies {
413 return &Dependencies{}
414 }
415
416 func (p *Dependencies) GetStartTime() int64 {
417 return p.StartTime
418 }
419
420 func (p *Dependencies) GetEndTime() int64 {
421 return p.EndTime
422 }
423
424 func (p *Dependencies) GetLinks() []*DependencyLink {
425 return p.Links
426 }
427 func (p *Dependencies) Read(iprot thrift.TProtocol) error {
428 if _, err := iprot.ReadStructBegin(); err != nil {
429 return fmt.Errorf("%T read error: %s", p, err)
430 }
431 for {
432 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
433 if err != nil {
434 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
435 }
436 if fieldTypeId == thrift.STOP {
437 break
438 }
439 switch fieldId {
440 case 1:
441 if err := p.ReadField1(iprot); err != nil {
442 return err
443 }
444 case 2:
445 if err := p.ReadField2(iprot); err != nil {
446 return err
447 }
448 case 3:
449 if err := p.ReadField3(iprot); err != nil {
450 return err
451 }
452 default:
453 if err := iprot.Skip(fieldTypeId); err != nil {
454 return err
455 }
456 }
457 if err := iprot.ReadFieldEnd(); err != nil {
458 return err
459 }
460 }
461 if err := iprot.ReadStructEnd(); err != nil {
462 return fmt.Errorf("%T read struct end error: %s", p, err)
463 }
464 return nil
465 }
466
467 func (p *Dependencies) ReadField1(iprot thrift.TProtocol) error {
468 if v, err := iprot.ReadI64(); err != nil {
469 return fmt.Errorf("error reading field 1: %s", err)
470 } else {
471 p.StartTime = v
472 }
473 return nil
474 }
475
476 func (p *Dependencies) ReadField2(iprot thrift.TProtocol) error {
477 if v, err := iprot.ReadI64(); err != nil {
478 return fmt.Errorf("error reading field 2: %s", err)
479 } else {
480 p.EndTime = v
481 }
482 return nil
483 }
484
485 func (p *Dependencies) ReadField3(iprot thrift.TProtocol) error {
486 _, size, err := iprot.ReadListBegin()
487 if err != nil {
488 return fmt.Errorf("error reading list begin: %s", err)
489 }
490 tSlice := make([]*DependencyLink, 0, size)
491 p.Links = tSlice
492 for i := 0; i < size; i++ {
493 _elem0 := &DependencyLink{}
494 if err := _elem0.Read(iprot); err != nil {
495 return fmt.Errorf("%T error reading struct: %s", _elem0, err)
496 }
497 p.Links = append(p.Links, _elem0)
498 }
499 if err := iprot.ReadListEnd(); err != nil {
500 return fmt.Errorf("error reading list end: %s", err)
501 }
502 return nil
503 }
504
505 func (p *Dependencies) Write(oprot thrift.TProtocol) error {
506 if err := oprot.WriteStructBegin("Dependencies"); err != nil {
507 return fmt.Errorf("%T write struct begin error: %s", p, err)
508 }
509 if err := p.writeField1(oprot); err != nil {
510 return err
511 }
512 if err := p.writeField2(oprot); err != nil {
513 return err
514 }
515 if err := p.writeField3(oprot); err != nil {
516 return err
517 }
518 if err := oprot.WriteFieldStop(); err != nil {
519 return fmt.Errorf("write field stop error: %s", err)
520 }
521 if err := oprot.WriteStructEnd(); err != nil {
522 return fmt.Errorf("write struct stop error: %s", err)
523 }
524 return nil
525 }
526
527 func (p *Dependencies) writeField1(oprot thrift.TProtocol) (err error) {
528 if err := oprot.WriteFieldBegin("start_time", thrift.I64, 1); err != nil {
529 return fmt.Errorf("%T write field begin error 1:start_time: %s", p, err)
530 }
531 if err := oprot.WriteI64(int64(p.StartTime)); err != nil {
532 return fmt.Errorf("%T.start_time (1) field write error: %s", p, err)
533 }
534 if err := oprot.WriteFieldEnd(); err != nil {
535 return fmt.Errorf("%T write field end error 1:start_time: %s", p, err)
536 }
537 return err
538 }
539
540 func (p *Dependencies) writeField2(oprot thrift.TProtocol) (err error) {
541 if err := oprot.WriteFieldBegin("end_time", thrift.I64, 2); err != nil {
542 return fmt.Errorf("%T write field begin error 2:end_time: %s", p, err)
543 }
544 if err := oprot.WriteI64(int64(p.EndTime)); err != nil {
545 return fmt.Errorf("%T.end_time (2) field write error: %s", p, err)
546 }
547 if err := oprot.WriteFieldEnd(); err != nil {
548 return fmt.Errorf("%T write field end error 2:end_time: %s", p, err)
549 }
550 return err
551 }
552
553 func (p *Dependencies) writeField3(oprot thrift.TProtocol) (err error) {
554 if err := oprot.WriteFieldBegin("links", thrift.LIST, 3); err != nil {
555 return fmt.Errorf("%T write field begin error 3:links: %s", p, err)
556 }
557 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Links)); err != nil {
558 return fmt.Errorf("error writing list begin: %s", err)
559 }
560 for _, v := range p.Links {
561 if err := v.Write(oprot); err != nil {
562 return fmt.Errorf("%T error writing struct: %s", v, err)
563 }
564 }
565 if err := oprot.WriteListEnd(); err != nil {
566 return fmt.Errorf("error writing list end: %s", err)
567 }
568 if err := oprot.WriteFieldEnd(); err != nil {
569 return fmt.Errorf("%T write field end error 3:links: %s", p, err)
570 }
571 return err
572 }
573
574 func (p *Dependencies) String() string {
575 if p == nil {
576 return "<nil>"
577 }
578 return fmt.Sprintf("Dependencies(%+v)", *p)
579 }
+0
-23
tracing/zipkin/_thrift/gen-go/zipkinquery/constants.go less more
0 // Autogenerated by Thrift Compiler (0.9.2)
1 // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
2
3 package zipkinquery
4
5 import (
6 "bytes"
7 "fmt"
8 "github.com/apache/thrift/lib/go/thrift"
9 "zipkincore"
10 "zipkindependencies"
11 )
12
13 // (needed to ensure safety because of naive import list construction.)
14 var _ = thrift.ZERO
15 var _ = fmt.Printf
16 var _ = bytes.Equal
17
18 var _ = zipkincore.GoUnusedProtection__
19 var _ = zipkindependencies.GoUnusedProtection__
20
21 func init() {
22 }
+0
-2085
tracing/zipkin/_thrift/gen-go/zipkinquery/ttypes.go less more
0 // Autogenerated by Thrift Compiler (0.9.2)
1 // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
2
3 package zipkinquery
4
5 import (
6 "bytes"
7 "fmt"
8 "github.com/apache/thrift/lib/go/thrift"
9 "zipkincore"
10 "zipkindependencies"
11 )
12
13 // (needed to ensure safety because of naive import list construction.)
14 var _ = thrift.ZERO
15 var _ = fmt.Printf
16 var _ = bytes.Equal
17
18 var _ = zipkincore.GoUnusedProtection__
19 var _ = zipkindependencies.GoUnusedProtection__
20 var GoUnusedProtection__ int
21
22 type Order int64
23
24 const (
25 Order_TIMESTAMP_DESC Order = 0
26 Order_TIMESTAMP_ASC Order = 1
27 Order_DURATION_ASC Order = 2
28 Order_DURATION_DESC Order = 3
29 Order_NONE Order = 4
30 )
31
32 func (p Order) String() string {
33 switch p {
34 case Order_TIMESTAMP_DESC:
35 return "Order_TIMESTAMP_DESC"
36 case Order_TIMESTAMP_ASC:
37 return "Order_TIMESTAMP_ASC"
38 case Order_DURATION_ASC:
39 return "Order_DURATION_ASC"
40 case Order_DURATION_DESC:
41 return "Order_DURATION_DESC"
42 case Order_NONE:
43 return "Order_NONE"
44 }
45 return "<UNSET>"
46 }
47
48 func OrderFromString(s string) (Order, error) {
49 switch s {
50 case "Order_TIMESTAMP_DESC":
51 return Order_TIMESTAMP_DESC, nil
52 case "Order_TIMESTAMP_ASC":
53 return Order_TIMESTAMP_ASC, nil
54 case "Order_DURATION_ASC":
55 return Order_DURATION_ASC, nil
56 case "Order_DURATION_DESC":
57 return Order_DURATION_DESC, nil
58 case "Order_NONE":
59 return Order_NONE, nil
60 }
61 return Order(0), fmt.Errorf("not a valid Order string")
62 }
63
64 func OrderPtr(v Order) *Order { return &v }
65
66 //The raw data in our storage might have various problems. How should we adjust it before
67 //returning it to the user?
68 //
69 //Time skew adjuster tries to make sure that even though servers might have slightly
70 //different clocks the annotations in the returned data are adjusted so that they are
71 //in the correct order.
72 type Adjust int64
73
74 const (
75 Adjust_NOTHING Adjust = 0
76 Adjust_TIME_SKEW Adjust = 1
77 )
78
79 func (p Adjust) String() string {
80 switch p {
81 case Adjust_NOTHING:
82 return "Adjust_NOTHING"
83 case Adjust_TIME_SKEW:
84 return "Adjust_TIME_SKEW"
85 }
86 return "<UNSET>"
87 }
88
89 func AdjustFromString(s string) (Adjust, error) {
90 switch s {
91 case "Adjust_NOTHING":
92 return Adjust_NOTHING, nil
93 case "Adjust_TIME_SKEW":
94 return Adjust_TIME_SKEW, nil
95 }
96 return Adjust(0), fmt.Errorf("not a valid Adjust string")
97 }
98
99 func AdjustPtr(v Adjust) *Adjust { return &v }
100
101 type Trace struct {
102 Spans []*zipkincore.Span `thrift:"spans,1" json:"spans"`
103 }
104
105 func NewTrace() *Trace {
106 return &Trace{}
107 }
108
109 func (p *Trace) GetSpans() []*zipkincore.Span {
110 return p.Spans
111 }
112 func (p *Trace) Read(iprot thrift.TProtocol) error {
113 if _, err := iprot.ReadStructBegin(); err != nil {
114 return fmt.Errorf("%T read error: %s", p, err)
115 }
116 for {
117 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
118 if err != nil {
119 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
120 }
121 if fieldTypeId == thrift.STOP {
122 break
123 }
124 switch fieldId {
125 case 1:
126 if err := p.ReadField1(iprot); err != nil {
127 return err
128 }
129 default:
130 if err := iprot.Skip(fieldTypeId); err != nil {
131 return err
132 }
133 }
134 if err := iprot.ReadFieldEnd(); err != nil {
135 return err
136 }
137 }
138 if err := iprot.ReadStructEnd(); err != nil {
139 return fmt.Errorf("%T read struct end error: %s", p, err)
140 }
141 return nil
142 }
143
144 func (p *Trace) ReadField1(iprot thrift.TProtocol) error {
145 _, size, err := iprot.ReadListBegin()
146 if err != nil {
147 return fmt.Errorf("error reading list begin: %s", err)
148 }
149 tSlice := make([]*zipkincore.Span, 0, size)
150 p.Spans = tSlice
151 for i := 0; i < size; i++ {
152 _elem0 := &zipkincore.Span{}
153 if err := _elem0.Read(iprot); err != nil {
154 return fmt.Errorf("%T error reading struct: %s", _elem0, err)
155 }
156 p.Spans = append(p.Spans, _elem0)
157 }
158 if err := iprot.ReadListEnd(); err != nil {
159 return fmt.Errorf("error reading list end: %s", err)
160 }
161 return nil
162 }
163
164 func (p *Trace) Write(oprot thrift.TProtocol) error {
165 if err := oprot.WriteStructBegin("Trace"); err != nil {
166 return fmt.Errorf("%T write struct begin error: %s", p, err)
167 }
168 if err := p.writeField1(oprot); err != nil {
169 return err
170 }
171 if err := oprot.WriteFieldStop(); err != nil {
172 return fmt.Errorf("write field stop error: %s", err)
173 }
174 if err := oprot.WriteStructEnd(); err != nil {
175 return fmt.Errorf("write struct stop error: %s", err)
176 }
177 return nil
178 }
179
180 func (p *Trace) writeField1(oprot thrift.TProtocol) (err error) {
181 if err := oprot.WriteFieldBegin("spans", thrift.LIST, 1); err != nil {
182 return fmt.Errorf("%T write field begin error 1:spans: %s", p, err)
183 }
184 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Spans)); err != nil {
185 return fmt.Errorf("error writing list begin: %s", err)
186 }
187 for _, v := range p.Spans {
188 if err := v.Write(oprot); err != nil {
189 return fmt.Errorf("%T error writing struct: %s", v, err)
190 }
191 }
192 if err := oprot.WriteListEnd(); err != nil {
193 return fmt.Errorf("error writing list end: %s", err)
194 }
195 if err := oprot.WriteFieldEnd(); err != nil {
196 return fmt.Errorf("%T write field end error 1:spans: %s", p, err)
197 }
198 return err
199 }
200
201 func (p *Trace) String() string {
202 if p == nil {
203 return "<nil>"
204 }
205 return fmt.Sprintf("Trace(%+v)", *p)
206 }
207
208 type QueryException struct {
209 Msg string `thrift:"msg,1" json:"msg"`
210 }
211
212 func NewQueryException() *QueryException {
213 return &QueryException{}
214 }
215
216 func (p *QueryException) GetMsg() string {
217 return p.Msg
218 }
219 func (p *QueryException) Read(iprot thrift.TProtocol) error {
220 if _, err := iprot.ReadStructBegin(); err != nil {
221 return fmt.Errorf("%T read error: %s", p, err)
222 }
223 for {
224 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
225 if err != nil {
226 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
227 }
228 if fieldTypeId == thrift.STOP {
229 break
230 }
231 switch fieldId {
232 case 1:
233 if err := p.ReadField1(iprot); err != nil {
234 return err
235 }
236 default:
237 if err := iprot.Skip(fieldTypeId); err != nil {
238 return err
239 }
240 }
241 if err := iprot.ReadFieldEnd(); err != nil {
242 return err
243 }
244 }
245 if err := iprot.ReadStructEnd(); err != nil {
246 return fmt.Errorf("%T read struct end error: %s", p, err)
247 }
248 return nil
249 }
250
251 func (p *QueryException) ReadField1(iprot thrift.TProtocol) error {
252 if v, err := iprot.ReadString(); err != nil {
253 return fmt.Errorf("error reading field 1: %s", err)
254 } else {
255 p.Msg = v
256 }
257 return nil
258 }
259
260 func (p *QueryException) Write(oprot thrift.TProtocol) error {
261 if err := oprot.WriteStructBegin("QueryException"); err != nil {
262 return fmt.Errorf("%T write struct begin error: %s", p, err)
263 }
264 if err := p.writeField1(oprot); err != nil {
265 return err
266 }
267 if err := oprot.WriteFieldStop(); err != nil {
268 return fmt.Errorf("write field stop error: %s", err)
269 }
270 if err := oprot.WriteStructEnd(); err != nil {
271 return fmt.Errorf("write struct stop error: %s", err)
272 }
273 return nil
274 }
275
276 func (p *QueryException) writeField1(oprot thrift.TProtocol) (err error) {
277 if err := oprot.WriteFieldBegin("msg", thrift.STRING, 1); err != nil {
278 return fmt.Errorf("%T write field begin error 1:msg: %s", p, err)
279 }
280 if err := oprot.WriteString(string(p.Msg)); err != nil {
281 return fmt.Errorf("%T.msg (1) field write error: %s", p, err)
282 }
283 if err := oprot.WriteFieldEnd(); err != nil {
284 return fmt.Errorf("%T write field end error 1:msg: %s", p, err)
285 }
286 return err
287 }
288
289 func (p *QueryException) String() string {
290 if p == nil {
291 return "<nil>"
292 }
293 return fmt.Sprintf("QueryException(%+v)", *p)
294 }
295
296 func (p *QueryException) Error() string {
297 return p.String()
298 }
299
300 type SpanTimestamp struct {
301 Name string `thrift:"name,1" json:"name"`
302 StartTimestamp int64 `thrift:"start_timestamp,2" json:"start_timestamp"`
303 EndTimestamp int64 `thrift:"end_timestamp,3" json:"end_timestamp"`
304 }
305
306 func NewSpanTimestamp() *SpanTimestamp {
307 return &SpanTimestamp{}
308 }
309
310 func (p *SpanTimestamp) GetName() string {
311 return p.Name
312 }
313
314 func (p *SpanTimestamp) GetStartTimestamp() int64 {
315 return p.StartTimestamp
316 }
317
318 func (p *SpanTimestamp) GetEndTimestamp() int64 {
319 return p.EndTimestamp
320 }
321 func (p *SpanTimestamp) Read(iprot thrift.TProtocol) error {
322 if _, err := iprot.ReadStructBegin(); err != nil {
323 return fmt.Errorf("%T read error: %s", p, err)
324 }
325 for {
326 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
327 if err != nil {
328 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
329 }
330 if fieldTypeId == thrift.STOP {
331 break
332 }
333 switch fieldId {
334 case 1:
335 if err := p.ReadField1(iprot); err != nil {
336 return err
337 }
338 case 2:
339 if err := p.ReadField2(iprot); err != nil {
340 return err
341 }
342 case 3:
343 if err := p.ReadField3(iprot); err != nil {
344 return err
345 }
346 default:
347 if err := iprot.Skip(fieldTypeId); err != nil {
348 return err
349 }
350 }
351 if err := iprot.ReadFieldEnd(); err != nil {
352 return err
353 }
354 }
355 if err := iprot.ReadStructEnd(); err != nil {
356 return fmt.Errorf("%T read struct end error: %s", p, err)
357 }
358 return nil
359 }
360
361 func (p *SpanTimestamp) ReadField1(iprot thrift.TProtocol) error {
362 if v, err := iprot.ReadString(); err != nil {
363 return fmt.Errorf("error reading field 1: %s", err)
364 } else {
365 p.Name = v
366 }
367 return nil
368 }
369
370 func (p *SpanTimestamp) ReadField2(iprot thrift.TProtocol) error {
371 if v, err := iprot.ReadI64(); err != nil {
372 return fmt.Errorf("error reading field 2: %s", err)
373 } else {
374 p.StartTimestamp = v
375 }
376 return nil
377 }
378
379 func (p *SpanTimestamp) ReadField3(iprot thrift.TProtocol) error {
380 if v, err := iprot.ReadI64(); err != nil {
381 return fmt.Errorf("error reading field 3: %s", err)
382 } else {
383 p.EndTimestamp = v
384 }
385 return nil
386 }
387
388 func (p *SpanTimestamp) Write(oprot thrift.TProtocol) error {
389 if err := oprot.WriteStructBegin("SpanTimestamp"); err != nil {
390 return fmt.Errorf("%T write struct begin error: %s", p, err)
391 }
392 if err := p.writeField1(oprot); err != nil {
393 return err
394 }
395 if err := p.writeField2(oprot); err != nil {
396 return err
397 }
398 if err := p.writeField3(oprot); err != nil {
399 return err
400 }
401 if err := oprot.WriteFieldStop(); err != nil {
402 return fmt.Errorf("write field stop error: %s", err)
403 }
404 if err := oprot.WriteStructEnd(); err != nil {
405 return fmt.Errorf("write struct stop error: %s", err)
406 }
407 return nil
408 }
409
410 func (p *SpanTimestamp) writeField1(oprot thrift.TProtocol) (err error) {
411 if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil {
412 return fmt.Errorf("%T write field begin error 1:name: %s", p, err)
413 }
414 if err := oprot.WriteString(string(p.Name)); err != nil {
415 return fmt.Errorf("%T.name (1) field write error: %s", p, err)
416 }
417 if err := oprot.WriteFieldEnd(); err != nil {
418 return fmt.Errorf("%T write field end error 1:name: %s", p, err)
419 }
420 return err
421 }
422
423 func (p *SpanTimestamp) writeField2(oprot thrift.TProtocol) (err error) {
424 if err := oprot.WriteFieldBegin("start_timestamp", thrift.I64, 2); err != nil {
425 return fmt.Errorf("%T write field begin error 2:start_timestamp: %s", p, err)
426 }
427 if err := oprot.WriteI64(int64(p.StartTimestamp)); err != nil {
428 return fmt.Errorf("%T.start_timestamp (2) field write error: %s", p, err)
429 }
430 if err := oprot.WriteFieldEnd(); err != nil {
431 return fmt.Errorf("%T write field end error 2:start_timestamp: %s", p, err)
432 }
433 return err
434 }
435
436 func (p *SpanTimestamp) writeField3(oprot thrift.TProtocol) (err error) {
437 if err := oprot.WriteFieldBegin("end_timestamp", thrift.I64, 3); err != nil {
438 return fmt.Errorf("%T write field begin error 3:end_timestamp: %s", p, err)
439 }
440 if err := oprot.WriteI64(int64(p.EndTimestamp)); err != nil {
441 return fmt.Errorf("%T.end_timestamp (3) field write error: %s", p, err)
442 }
443 if err := oprot.WriteFieldEnd(); err != nil {
444 return fmt.Errorf("%T write field end error 3:end_timestamp: %s", p, err)
445 }
446 return err
447 }
448
449 func (p *SpanTimestamp) String() string {
450 if p == nil {
451 return "<nil>"
452 }
453 return fmt.Sprintf("SpanTimestamp(%+v)", *p)
454 }
455
456 type TraceSummary struct {
457 TraceId int64 `thrift:"trace_id,1" json:"trace_id"`
458 StartTimestamp int64 `thrift:"start_timestamp,2" json:"start_timestamp"`
459 EndTimestamp int64 `thrift:"end_timestamp,3" json:"end_timestamp"`
460 DurationMicro int32 `thrift:"duration_micro,4" json:"duration_micro"`
461 // unused field # 5
462 Endpoints []*zipkincore.Endpoint `thrift:"endpoints,6" json:"endpoints"`
463 SpanTimestamps []*SpanTimestamp `thrift:"span_timestamps,7" json:"span_timestamps"`
464 }
465
466 func NewTraceSummary() *TraceSummary {
467 return &TraceSummary{}
468 }
469
470 func (p *TraceSummary) GetTraceId() int64 {
471 return p.TraceId
472 }
473
474 func (p *TraceSummary) GetStartTimestamp() int64 {
475 return p.StartTimestamp
476 }
477
478 func (p *TraceSummary) GetEndTimestamp() int64 {
479 return p.EndTimestamp
480 }
481
482 func (p *TraceSummary) GetDurationMicro() int32 {
483 return p.DurationMicro
484 }
485
486 func (p *TraceSummary) GetEndpoints() []*zipkincore.Endpoint {
487 return p.Endpoints
488 }
489
490 func (p *TraceSummary) GetSpanTimestamps() []*SpanTimestamp {
491 return p.SpanTimestamps
492 }
493 func (p *TraceSummary) Read(iprot thrift.TProtocol) error {
494 if _, err := iprot.ReadStructBegin(); err != nil {
495 return fmt.Errorf("%T read error: %s", p, err)
496 }
497 for {
498 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
499 if err != nil {
500 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
501 }
502 if fieldTypeId == thrift.STOP {
503 break
504 }
505 switch fieldId {
506 case 1:
507 if err := p.ReadField1(iprot); err != nil {
508 return err
509 }
510 case 2:
511 if err := p.ReadField2(iprot); err != nil {
512 return err
513 }
514 case 3:
515 if err := p.ReadField3(iprot); err != nil {
516 return err
517 }
518 case 4:
519 if err := p.ReadField4(iprot); err != nil {
520 return err
521 }
522 case 6:
523 if err := p.ReadField6(iprot); err != nil {
524 return err
525 }
526 case 7:
527 if err := p.ReadField7(iprot); err != nil {
528 return err
529 }
530 default:
531 if err := iprot.Skip(fieldTypeId); err != nil {
532 return err
533 }
534 }
535 if err := iprot.ReadFieldEnd(); err != nil {
536 return err
537 }
538 }
539 if err := iprot.ReadStructEnd(); err != nil {
540 return fmt.Errorf("%T read struct end error: %s", p, err)
541 }
542 return nil
543 }
544
545 func (p *TraceSummary) ReadField1(iprot thrift.TProtocol) error {
546 if v, err := iprot.ReadI64(); err != nil {
547 return fmt.Errorf("error reading field 1: %s", err)
548 } else {
549 p.TraceId = v
550 }
551 return nil
552 }
553
554 func (p *TraceSummary) ReadField2(iprot thrift.TProtocol) error {
555 if v, err := iprot.ReadI64(); err != nil {
556 return fmt.Errorf("error reading field 2: %s", err)
557 } else {
558 p.StartTimestamp = v
559 }
560 return nil
561 }
562
563 func (p *TraceSummary) ReadField3(iprot thrift.TProtocol) error {
564 if v, err := iprot.ReadI64(); err != nil {
565 return fmt.Errorf("error reading field 3: %s", err)
566 } else {
567 p.EndTimestamp = v
568 }
569 return nil
570 }
571
572 func (p *TraceSummary) ReadField4(iprot thrift.TProtocol) error {
573 if v, err := iprot.ReadI32(); err != nil {
574 return fmt.Errorf("error reading field 4: %s", err)
575 } else {
576 p.DurationMicro = v
577 }
578 return nil
579 }
580
581 func (p *TraceSummary) ReadField6(iprot thrift.TProtocol) error {
582 _, size, err := iprot.ReadListBegin()
583 if err != nil {
584 return fmt.Errorf("error reading list begin: %s", err)
585 }
586 tSlice := make([]*zipkincore.Endpoint, 0, size)
587 p.Endpoints = tSlice
588 for i := 0; i < size; i++ {
589 _elem1 := &zipkincore.Endpoint{}
590 if err := _elem1.Read(iprot); err != nil {
591 return fmt.Errorf("%T error reading struct: %s", _elem1, err)
592 }
593 p.Endpoints = append(p.Endpoints, _elem1)
594 }
595 if err := iprot.ReadListEnd(); err != nil {
596 return fmt.Errorf("error reading list end: %s", err)
597 }
598 return nil
599 }
600
601 func (p *TraceSummary) ReadField7(iprot thrift.TProtocol) error {
602 _, size, err := iprot.ReadListBegin()
603 if err != nil {
604 return fmt.Errorf("error reading list begin: %s", err)
605 }
606 tSlice := make([]*SpanTimestamp, 0, size)
607 p.SpanTimestamps = tSlice
608 for i := 0; i < size; i++ {
609 _elem2 := &SpanTimestamp{}
610 if err := _elem2.Read(iprot); err != nil {
611 return fmt.Errorf("%T error reading struct: %s", _elem2, err)
612 }
613 p.SpanTimestamps = append(p.SpanTimestamps, _elem2)
614 }
615 if err := iprot.ReadListEnd(); err != nil {
616 return fmt.Errorf("error reading list end: %s", err)
617 }
618 return nil
619 }
620
621 func (p *TraceSummary) Write(oprot thrift.TProtocol) error {
622 if err := oprot.WriteStructBegin("TraceSummary"); err != nil {
623 return fmt.Errorf("%T write struct begin error: %s", p, err)
624 }
625 if err := p.writeField1(oprot); err != nil {
626 return err
627 }
628 if err := p.writeField2(oprot); err != nil {
629 return err
630 }
631 if err := p.writeField3(oprot); err != nil {
632 return err
633 }
634 if err := p.writeField4(oprot); err != nil {
635 return err
636 }
637 if err := p.writeField6(oprot); err != nil {
638 return err
639 }
640 if err := p.writeField7(oprot); err != nil {
641 return err
642 }
643 if err := oprot.WriteFieldStop(); err != nil {
644 return fmt.Errorf("write field stop error: %s", err)
645 }
646 if err := oprot.WriteStructEnd(); err != nil {
647 return fmt.Errorf("write struct stop error: %s", err)
648 }
649 return nil
650 }
651
652 func (p *TraceSummary) writeField1(oprot thrift.TProtocol) (err error) {
653 if err := oprot.WriteFieldBegin("trace_id", thrift.I64, 1); err != nil {
654 return fmt.Errorf("%T write field begin error 1:trace_id: %s", p, err)
655 }
656 if err := oprot.WriteI64(int64(p.TraceId)); err != nil {
657 return fmt.Errorf("%T.trace_id (1) field write error: %s", p, err)
658 }
659 if err := oprot.WriteFieldEnd(); err != nil {
660 return fmt.Errorf("%T write field end error 1:trace_id: %s", p, err)
661 }
662 return err
663 }
664
665 func (p *TraceSummary) writeField2(oprot thrift.TProtocol) (err error) {
666 if err := oprot.WriteFieldBegin("start_timestamp", thrift.I64, 2); err != nil {
667 return fmt.Errorf("%T write field begin error 2:start_timestamp: %s", p, err)
668 }
669 if err := oprot.WriteI64(int64(p.StartTimestamp)); err != nil {
670 return fmt.Errorf("%T.start_timestamp (2) field write error: %s", p, err)
671 }
672 if err := oprot.WriteFieldEnd(); err != nil {
673 return fmt.Errorf("%T write field end error 2:start_timestamp: %s", p, err)
674 }
675 return err
676 }
677
678 func (p *TraceSummary) writeField3(oprot thrift.TProtocol) (err error) {
679 if err := oprot.WriteFieldBegin("end_timestamp", thrift.I64, 3); err != nil {
680 return fmt.Errorf("%T write field begin error 3:end_timestamp: %s", p, err)
681 }
682 if err := oprot.WriteI64(int64(p.EndTimestamp)); err != nil {
683 return fmt.Errorf("%T.end_timestamp (3) field write error: %s", p, err)
684 }
685 if err := oprot.WriteFieldEnd(); err != nil {
686 return fmt.Errorf("%T write field end error 3:end_timestamp: %s", p, err)
687 }
688 return err
689 }
690
691 func (p *TraceSummary) writeField4(oprot thrift.TProtocol) (err error) {
692 if err := oprot.WriteFieldBegin("duration_micro", thrift.I32, 4); err != nil {
693 return fmt.Errorf("%T write field begin error 4:duration_micro: %s", p, err)
694 }
695 if err := oprot.WriteI32(int32(p.DurationMicro)); err != nil {
696 return fmt.Errorf("%T.duration_micro (4) field write error: %s", p, err)
697 }
698 if err := oprot.WriteFieldEnd(); err != nil {
699 return fmt.Errorf("%T write field end error 4:duration_micro: %s", p, err)
700 }
701 return err
702 }
703
704 func (p *TraceSummary) writeField6(oprot thrift.TProtocol) (err error) {
705 if err := oprot.WriteFieldBegin("endpoints", thrift.LIST, 6); err != nil {
706 return fmt.Errorf("%T write field begin error 6:endpoints: %s", p, err)
707 }
708 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Endpoints)); err != nil {
709 return fmt.Errorf("error writing list begin: %s", err)
710 }
711 for _, v := range p.Endpoints {
712 if err := v.Write(oprot); err != nil {
713 return fmt.Errorf("%T error writing struct: %s", v, err)
714 }
715 }
716 if err := oprot.WriteListEnd(); err != nil {
717 return fmt.Errorf("error writing list end: %s", err)
718 }
719 if err := oprot.WriteFieldEnd(); err != nil {
720 return fmt.Errorf("%T write field end error 6:endpoints: %s", p, err)
721 }
722 return err
723 }
724
725 func (p *TraceSummary) writeField7(oprot thrift.TProtocol) (err error) {
726 if err := oprot.WriteFieldBegin("span_timestamps", thrift.LIST, 7); err != nil {
727 return fmt.Errorf("%T write field begin error 7:span_timestamps: %s", p, err)
728 }
729 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.SpanTimestamps)); err != nil {
730 return fmt.Errorf("error writing list begin: %s", err)
731 }
732 for _, v := range p.SpanTimestamps {
733 if err := v.Write(oprot); err != nil {
734 return fmt.Errorf("%T error writing struct: %s", v, err)
735 }
736 }
737 if err := oprot.WriteListEnd(); err != nil {
738 return fmt.Errorf("error writing list end: %s", err)
739 }
740 if err := oprot.WriteFieldEnd(); err != nil {
741 return fmt.Errorf("%T write field end error 7:span_timestamps: %s", p, err)
742 }
743 return err
744 }
745
746 func (p *TraceSummary) String() string {
747 if p == nil {
748 return "<nil>"
749 }
750 return fmt.Sprintf("TraceSummary(%+v)", *p)
751 }
752
753 type TimelineAnnotation struct {
754 Timestamp int64 `thrift:"timestamp,1" json:"timestamp"`
755 Value string `thrift:"value,2" json:"value"`
756 Host *zipkincore.Endpoint `thrift:"host,3" json:"host"`
757 SpanId int64 `thrift:"span_id,4" json:"span_id"`
758 ParentId *int64 `thrift:"parent_id,5" json:"parent_id"`
759 ServiceName string `thrift:"service_name,6" json:"service_name"`
760 SpanName string `thrift:"span_name,7" json:"span_name"`
761 }
762
763 func NewTimelineAnnotation() *TimelineAnnotation {
764 return &TimelineAnnotation{}
765 }
766
767 func (p *TimelineAnnotation) GetTimestamp() int64 {
768 return p.Timestamp
769 }
770
771 func (p *TimelineAnnotation) GetValue() string {
772 return p.Value
773 }
774
775 var TimelineAnnotation_Host_DEFAULT *zipkincore.Endpoint
776
777 func (p *TimelineAnnotation) GetHost() *zipkincore.Endpoint {
778 if !p.IsSetHost() {
779 return TimelineAnnotation_Host_DEFAULT
780 }
781 return p.Host
782 }
783
784 func (p *TimelineAnnotation) GetSpanId() int64 {
785 return p.SpanId
786 }
787
788 var TimelineAnnotation_ParentId_DEFAULT int64
789
790 func (p *TimelineAnnotation) GetParentId() int64 {
791 if !p.IsSetParentId() {
792 return TimelineAnnotation_ParentId_DEFAULT
793 }
794 return *p.ParentId
795 }
796
797 func (p *TimelineAnnotation) GetServiceName() string {
798 return p.ServiceName
799 }
800
801 func (p *TimelineAnnotation) GetSpanName() string {
802 return p.SpanName
803 }
804 func (p *TimelineAnnotation) IsSetHost() bool {
805 return p.Host != nil
806 }
807
808 func (p *TimelineAnnotation) IsSetParentId() bool {
809 return p.ParentId != nil
810 }
811
812 func (p *TimelineAnnotation) Read(iprot thrift.TProtocol) error {
813 if _, err := iprot.ReadStructBegin(); err != nil {
814 return fmt.Errorf("%T read error: %s", p, err)
815 }
816 for {
817 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
818 if err != nil {
819 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
820 }
821 if fieldTypeId == thrift.STOP {
822 break
823 }
824 switch fieldId {
825 case 1:
826 if err := p.ReadField1(iprot); err != nil {
827 return err
828 }
829 case 2:
830 if err := p.ReadField2(iprot); err != nil {
831 return err
832 }
833 case 3:
834 if err := p.ReadField3(iprot); err != nil {
835 return err
836 }
837 case 4:
838 if err := p.ReadField4(iprot); err != nil {
839 return err
840 }
841 case 5:
842 if err := p.ReadField5(iprot); err != nil {
843 return err
844 }
845 case 6:
846 if err := p.ReadField6(iprot); err != nil {
847 return err
848 }
849 case 7:
850 if err := p.ReadField7(iprot); err != nil {
851 return err
852 }
853 default:
854 if err := iprot.Skip(fieldTypeId); err != nil {
855 return err
856 }
857 }
858 if err := iprot.ReadFieldEnd(); err != nil {
859 return err
860 }
861 }
862 if err := iprot.ReadStructEnd(); err != nil {
863 return fmt.Errorf("%T read struct end error: %s", p, err)
864 }
865 return nil
866 }
867
868 func (p *TimelineAnnotation) ReadField1(iprot thrift.TProtocol) error {
869 if v, err := iprot.ReadI64(); err != nil {
870 return fmt.Errorf("error reading field 1: %s", err)
871 } else {
872 p.Timestamp = v
873 }
874 return nil
875 }
876
877 func (p *TimelineAnnotation) ReadField2(iprot thrift.TProtocol) error {
878 if v, err := iprot.ReadString(); err != nil {
879 return fmt.Errorf("error reading field 2: %s", err)
880 } else {
881 p.Value = v
882 }
883 return nil
884 }
885
886 func (p *TimelineAnnotation) ReadField3(iprot thrift.TProtocol) error {
887 p.Host = &zipkincore.Endpoint{}
888 if err := p.Host.Read(iprot); err != nil {
889 return fmt.Errorf("%T error reading struct: %s", p.Host, err)
890 }
891 return nil
892 }
893
894 func (p *TimelineAnnotation) ReadField4(iprot thrift.TProtocol) error {
895 if v, err := iprot.ReadI64(); err != nil {
896 return fmt.Errorf("error reading field 4: %s", err)
897 } else {
898 p.SpanId = v
899 }
900 return nil
901 }
902
903 func (p *TimelineAnnotation) ReadField5(iprot thrift.TProtocol) error {
904 if v, err := iprot.ReadI64(); err != nil {
905 return fmt.Errorf("error reading field 5: %s", err)
906 } else {
907 p.ParentId = &v
908 }
909 return nil
910 }
911
912 func (p *TimelineAnnotation) ReadField6(iprot thrift.TProtocol) error {
913 if v, err := iprot.ReadString(); err != nil {
914 return fmt.Errorf("error reading field 6: %s", err)
915 } else {
916 p.ServiceName = v
917 }
918 return nil
919 }
920
921 func (p *TimelineAnnotation) ReadField7(iprot thrift.TProtocol) error {
922 if v, err := iprot.ReadString(); err != nil {
923 return fmt.Errorf("error reading field 7: %s", err)
924 } else {
925 p.SpanName = v
926 }
927 return nil
928 }
929
930 func (p *TimelineAnnotation) Write(oprot thrift.TProtocol) error {
931 if err := oprot.WriteStructBegin("TimelineAnnotation"); err != nil {
932 return fmt.Errorf("%T write struct begin error: %s", p, err)
933 }
934 if err := p.writeField1(oprot); err != nil {
935 return err
936 }
937 if err := p.writeField2(oprot); err != nil {
938 return err
939 }
940 if err := p.writeField3(oprot); err != nil {
941 return err
942 }
943 if err := p.writeField4(oprot); err != nil {
944 return err
945 }
946 if err := p.writeField5(oprot); err != nil {
947 return err
948 }
949 if err := p.writeField6(oprot); err != nil {
950 return err
951 }
952 if err := p.writeField7(oprot); err != nil {
953 return err
954 }
955 if err := oprot.WriteFieldStop(); err != nil {
956 return fmt.Errorf("write field stop error: %s", err)
957 }
958 if err := oprot.WriteStructEnd(); err != nil {
959 return fmt.Errorf("write struct stop error: %s", err)
960 }
961 return nil
962 }
963
964 func (p *TimelineAnnotation) writeField1(oprot thrift.TProtocol) (err error) {
965 if err := oprot.WriteFieldBegin("timestamp", thrift.I64, 1); err != nil {
966 return fmt.Errorf("%T write field begin error 1:timestamp: %s", p, err)
967 }
968 if err := oprot.WriteI64(int64(p.Timestamp)); err != nil {
969 return fmt.Errorf("%T.timestamp (1) field write error: %s", p, err)
970 }
971 if err := oprot.WriteFieldEnd(); err != nil {
972 return fmt.Errorf("%T write field end error 1:timestamp: %s", p, err)
973 }
974 return err
975 }
976
977 func (p *TimelineAnnotation) writeField2(oprot thrift.TProtocol) (err error) {
978 if err := oprot.WriteFieldBegin("value", thrift.STRING, 2); err != nil {
979 return fmt.Errorf("%T write field begin error 2:value: %s", p, err)
980 }
981 if err := oprot.WriteString(string(p.Value)); err != nil {
982 return fmt.Errorf("%T.value (2) field write error: %s", p, err)
983 }
984 if err := oprot.WriteFieldEnd(); err != nil {
985 return fmt.Errorf("%T write field end error 2:value: %s", p, err)
986 }
987 return err
988 }
989
990 func (p *TimelineAnnotation) writeField3(oprot thrift.TProtocol) (err error) {
991 if err := oprot.WriteFieldBegin("host", thrift.STRUCT, 3); err != nil {
992 return fmt.Errorf("%T write field begin error 3:host: %s", p, err)
993 }
994 if err := p.Host.Write(oprot); err != nil {
995 return fmt.Errorf("%T error writing struct: %s", p.Host, err)
996 }
997 if err := oprot.WriteFieldEnd(); err != nil {
998 return fmt.Errorf("%T write field end error 3:host: %s", p, err)
999 }
1000 return err
1001 }
1002
1003 func (p *TimelineAnnotation) writeField4(oprot thrift.TProtocol) (err error) {
1004 if err := oprot.WriteFieldBegin("span_id", thrift.I64, 4); err != nil {
1005 return fmt.Errorf("%T write field begin error 4:span_id: %s", p, err)
1006 }
1007 if err := oprot.WriteI64(int64(p.SpanId)); err != nil {
1008 return fmt.Errorf("%T.span_id (4) field write error: %s", p, err)
1009 }
1010 if err := oprot.WriteFieldEnd(); err != nil {
1011 return fmt.Errorf("%T write field end error 4:span_id: %s", p, err)
1012 }
1013 return err
1014 }
1015
1016 func (p *TimelineAnnotation) writeField5(oprot thrift.TProtocol) (err error) {
1017 if p.IsSetParentId() {
1018 if err := oprot.WriteFieldBegin("parent_id", thrift.I64, 5); err != nil {
1019 return fmt.Errorf("%T write field begin error 5:parent_id: %s", p, err)
1020 }
1021 if err := oprot.WriteI64(int64(*p.ParentId)); err != nil {
1022 return fmt.Errorf("%T.parent_id (5) field write error: %s", p, err)
1023 }
1024 if err := oprot.WriteFieldEnd(); err != nil {
1025 return fmt.Errorf("%T write field end error 5:parent_id: %s", p, err)
1026 }
1027 }
1028 return err
1029 }
1030
1031 func (p *TimelineAnnotation) writeField6(oprot thrift.TProtocol) (err error) {
1032 if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 6); err != nil {
1033 return fmt.Errorf("%T write field begin error 6:service_name: %s", p, err)
1034 }
1035 if err := oprot.WriteString(string(p.ServiceName)); err != nil {
1036 return fmt.Errorf("%T.service_name (6) field write error: %s", p, err)
1037 }
1038 if err := oprot.WriteFieldEnd(); err != nil {
1039 return fmt.Errorf("%T write field end error 6:service_name: %s", p, err)
1040 }
1041 return err
1042 }
1043
1044 func (p *TimelineAnnotation) writeField7(oprot thrift.TProtocol) (err error) {
1045 if err := oprot.WriteFieldBegin("span_name", thrift.STRING, 7); err != nil {
1046 return fmt.Errorf("%T write field begin error 7:span_name: %s", p, err)
1047 }
1048 if err := oprot.WriteString(string(p.SpanName)); err != nil {
1049 return fmt.Errorf("%T.span_name (7) field write error: %s", p, err)
1050 }
1051 if err := oprot.WriteFieldEnd(); err != nil {
1052 return fmt.Errorf("%T write field end error 7:span_name: %s", p, err)
1053 }
1054 return err
1055 }
1056
1057 func (p *TimelineAnnotation) String() string {
1058 if p == nil {
1059 return "<nil>"
1060 }
1061 return fmt.Sprintf("TimelineAnnotation(%+v)", *p)
1062 }
1063
1064 type TraceTimeline struct {
1065 TraceId int64 `thrift:"trace_id,1" json:"trace_id"`
1066 RootMostSpanId int64 `thrift:"root_most_span_id,2" json:"root_most_span_id"`
1067 // unused fields # 3 to 5
1068 Annotations []*TimelineAnnotation `thrift:"annotations,6" json:"annotations"`
1069 BinaryAnnotations []*zipkincore.BinaryAnnotation `thrift:"binary_annotations,7" json:"binary_annotations"`
1070 }
1071
1072 func NewTraceTimeline() *TraceTimeline {
1073 return &TraceTimeline{}
1074 }
1075
1076 func (p *TraceTimeline) GetTraceId() int64 {
1077 return p.TraceId
1078 }
1079
1080 func (p *TraceTimeline) GetRootMostSpanId() int64 {
1081 return p.RootMostSpanId
1082 }
1083
1084 func (p *TraceTimeline) GetAnnotations() []*TimelineAnnotation {
1085 return p.Annotations
1086 }
1087
1088 func (p *TraceTimeline) GetBinaryAnnotations() []*zipkincore.BinaryAnnotation {
1089 return p.BinaryAnnotations
1090 }
1091 func (p *TraceTimeline) Read(iprot thrift.TProtocol) error {
1092 if _, err := iprot.ReadStructBegin(); err != nil {
1093 return fmt.Errorf("%T read error: %s", p, err)
1094 }
1095 for {
1096 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
1097 if err != nil {
1098 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
1099 }
1100 if fieldTypeId == thrift.STOP {
1101 break
1102 }
1103 switch fieldId {
1104 case 1:
1105 if err := p.ReadField1(iprot); err != nil {
1106 return err
1107 }
1108 case 2:
1109 if err := p.ReadField2(iprot); err != nil {
1110 return err
1111 }
1112 case 6:
1113 if err := p.ReadField6(iprot); err != nil {
1114 return err
1115 }
1116 case 7:
1117 if err := p.ReadField7(iprot); err != nil {
1118 return err
1119 }
1120 default:
1121 if err := iprot.Skip(fieldTypeId); err != nil {
1122 return err
1123 }
1124 }
1125 if err := iprot.ReadFieldEnd(); err != nil {
1126 return err
1127 }
1128 }
1129 if err := iprot.ReadStructEnd(); err != nil {
1130 return fmt.Errorf("%T read struct end error: %s", p, err)
1131 }
1132 return nil
1133 }
1134
1135 func (p *TraceTimeline) ReadField1(iprot thrift.TProtocol) error {
1136 if v, err := iprot.ReadI64(); err != nil {
1137 return fmt.Errorf("error reading field 1: %s", err)
1138 } else {
1139 p.TraceId = v
1140 }
1141 return nil
1142 }
1143
1144 func (p *TraceTimeline) ReadField2(iprot thrift.TProtocol) error {
1145 if v, err := iprot.ReadI64(); err != nil {
1146 return fmt.Errorf("error reading field 2: %s", err)
1147 } else {
1148 p.RootMostSpanId = v
1149 }
1150 return nil
1151 }
1152
1153 func (p *TraceTimeline) ReadField6(iprot thrift.TProtocol) error {
1154 _, size, err := iprot.ReadListBegin()
1155 if err != nil {
1156 return fmt.Errorf("error reading list begin: %s", err)
1157 }
1158 tSlice := make([]*TimelineAnnotation, 0, size)
1159 p.Annotations = tSlice
1160 for i := 0; i < size; i++ {
1161 _elem3 := &TimelineAnnotation{}
1162 if err := _elem3.Read(iprot); err != nil {
1163 return fmt.Errorf("%T error reading struct: %s", _elem3, err)
1164 }
1165 p.Annotations = append(p.Annotations, _elem3)
1166 }
1167 if err := iprot.ReadListEnd(); err != nil {
1168 return fmt.Errorf("error reading list end: %s", err)
1169 }
1170 return nil
1171 }
1172
1173 func (p *TraceTimeline) ReadField7(iprot thrift.TProtocol) error {
1174 _, size, err := iprot.ReadListBegin()
1175 if err != nil {
1176 return fmt.Errorf("error reading list begin: %s", err)
1177 }
1178 tSlice := make([]*zipkincore.BinaryAnnotation, 0, size)
1179 p.BinaryAnnotations = tSlice
1180 for i := 0; i < size; i++ {
1181 _elem4 := &zipkincore.BinaryAnnotation{}
1182 if err := _elem4.Read(iprot); err != nil {
1183 return fmt.Errorf("%T error reading struct: %s", _elem4, err)
1184 }
1185 p.BinaryAnnotations = append(p.BinaryAnnotations, _elem4)
1186 }
1187 if err := iprot.ReadListEnd(); err != nil {
1188 return fmt.Errorf("error reading list end: %s", err)
1189 }
1190 return nil
1191 }
1192
1193 func (p *TraceTimeline) Write(oprot thrift.TProtocol) error {
1194 if err := oprot.WriteStructBegin("TraceTimeline"); err != nil {
1195 return fmt.Errorf("%T write struct begin error: %s", p, err)
1196 }
1197 if err := p.writeField1(oprot); err != nil {
1198 return err
1199 }
1200 if err := p.writeField2(oprot); err != nil {
1201 return err
1202 }
1203 if err := p.writeField6(oprot); err != nil {
1204 return err
1205 }
1206 if err := p.writeField7(oprot); err != nil {
1207 return err
1208 }
1209 if err := oprot.WriteFieldStop(); err != nil {
1210 return fmt.Errorf("write field stop error: %s", err)
1211 }
1212 if err := oprot.WriteStructEnd(); err != nil {
1213 return fmt.Errorf("write struct stop error: %s", err)
1214 }
1215 return nil
1216 }
1217
1218 func (p *TraceTimeline) writeField1(oprot thrift.TProtocol) (err error) {
1219 if err := oprot.WriteFieldBegin("trace_id", thrift.I64, 1); err != nil {
1220 return fmt.Errorf("%T write field begin error 1:trace_id: %s", p, err)
1221 }
1222 if err := oprot.WriteI64(int64(p.TraceId)); err != nil {
1223 return fmt.Errorf("%T.trace_id (1) field write error: %s", p, err)
1224 }
1225 if err := oprot.WriteFieldEnd(); err != nil {
1226 return fmt.Errorf("%T write field end error 1:trace_id: %s", p, err)
1227 }
1228 return err
1229 }
1230
1231 func (p *TraceTimeline) writeField2(oprot thrift.TProtocol) (err error) {
1232 if err := oprot.WriteFieldBegin("root_most_span_id", thrift.I64, 2); err != nil {
1233 return fmt.Errorf("%T write field begin error 2:root_most_span_id: %s", p, err)
1234 }
1235 if err := oprot.WriteI64(int64(p.RootMostSpanId)); err != nil {
1236 return fmt.Errorf("%T.root_most_span_id (2) field write error: %s", p, err)
1237 }
1238 if err := oprot.WriteFieldEnd(); err != nil {
1239 return fmt.Errorf("%T write field end error 2:root_most_span_id: %s", p, err)
1240 }
1241 return err
1242 }
1243
1244 func (p *TraceTimeline) writeField6(oprot thrift.TProtocol) (err error) {
1245 if err := oprot.WriteFieldBegin("annotations", thrift.LIST, 6); err != nil {
1246 return fmt.Errorf("%T write field begin error 6:annotations: %s", p, err)
1247 }
1248 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Annotations)); err != nil {
1249 return fmt.Errorf("error writing list begin: %s", err)
1250 }
1251 for _, v := range p.Annotations {
1252 if err := v.Write(oprot); err != nil {
1253 return fmt.Errorf("%T error writing struct: %s", v, err)
1254 }
1255 }
1256 if err := oprot.WriteListEnd(); err != nil {
1257 return fmt.Errorf("error writing list end: %s", err)
1258 }
1259 if err := oprot.WriteFieldEnd(); err != nil {
1260 return fmt.Errorf("%T write field end error 6:annotations: %s", p, err)
1261 }
1262 return err
1263 }
1264
1265 func (p *TraceTimeline) writeField7(oprot thrift.TProtocol) (err error) {
1266 if err := oprot.WriteFieldBegin("binary_annotations", thrift.LIST, 7); err != nil {
1267 return fmt.Errorf("%T write field begin error 7:binary_annotations: %s", p, err)
1268 }
1269 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.BinaryAnnotations)); err != nil {
1270 return fmt.Errorf("error writing list begin: %s", err)
1271 }
1272 for _, v := range p.BinaryAnnotations {
1273 if err := v.Write(oprot); err != nil {
1274 return fmt.Errorf("%T error writing struct: %s", v, err)
1275 }
1276 }
1277 if err := oprot.WriteListEnd(); err != nil {
1278 return fmt.Errorf("error writing list end: %s", err)
1279 }
1280 if err := oprot.WriteFieldEnd(); err != nil {
1281 return fmt.Errorf("%T write field end error 7:binary_annotations: %s", p, err)
1282 }
1283 return err
1284 }
1285
1286 func (p *TraceTimeline) String() string {
1287 if p == nil {
1288 return "<nil>"
1289 }
1290 return fmt.Sprintf("TraceTimeline(%+v)", *p)
1291 }
1292
1293 type TraceCombo struct {
1294 Trace *Trace `thrift:"trace,1" json:"trace"`
1295 Summary *TraceSummary `thrift:"summary,2" json:"summary"`
1296 Timeline *TraceTimeline `thrift:"timeline,3" json:"timeline"`
1297 SpanDepths map[int64]int32 `thrift:"span_depths,4" json:"span_depths"`
1298 }
1299
1300 func NewTraceCombo() *TraceCombo {
1301 return &TraceCombo{}
1302 }
1303
1304 var TraceCombo_Trace_DEFAULT *Trace
1305
1306 func (p *TraceCombo) GetTrace() *Trace {
1307 if !p.IsSetTrace() {
1308 return TraceCombo_Trace_DEFAULT
1309 }
1310 return p.Trace
1311 }
1312
1313 var TraceCombo_Summary_DEFAULT *TraceSummary
1314
1315 func (p *TraceCombo) GetSummary() *TraceSummary {
1316 if !p.IsSetSummary() {
1317 return TraceCombo_Summary_DEFAULT
1318 }
1319 return p.Summary
1320 }
1321
1322 var TraceCombo_Timeline_DEFAULT *TraceTimeline
1323
1324 func (p *TraceCombo) GetTimeline() *TraceTimeline {
1325 if !p.IsSetTimeline() {
1326 return TraceCombo_Timeline_DEFAULT
1327 }
1328 return p.Timeline
1329 }
1330
1331 var TraceCombo_SpanDepths_DEFAULT map[int64]int32
1332
1333 func (p *TraceCombo) GetSpanDepths() map[int64]int32 {
1334 return p.SpanDepths
1335 }
1336 func (p *TraceCombo) IsSetTrace() bool {
1337 return p.Trace != nil
1338 }
1339
1340 func (p *TraceCombo) IsSetSummary() bool {
1341 return p.Summary != nil
1342 }
1343
1344 func (p *TraceCombo) IsSetTimeline() bool {
1345 return p.Timeline != nil
1346 }
1347
1348 func (p *TraceCombo) IsSetSpanDepths() bool {
1349 return p.SpanDepths != nil
1350 }
1351
1352 func (p *TraceCombo) Read(iprot thrift.TProtocol) error {
1353 if _, err := iprot.ReadStructBegin(); err != nil {
1354 return fmt.Errorf("%T read error: %s", p, err)
1355 }
1356 for {
1357 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
1358 if err != nil {
1359 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
1360 }
1361 if fieldTypeId == thrift.STOP {
1362 break
1363 }
1364 switch fieldId {
1365 case 1:
1366 if err := p.ReadField1(iprot); err != nil {
1367 return err
1368 }
1369 case 2:
1370 if err := p.ReadField2(iprot); err != nil {
1371 return err
1372 }
1373 case 3:
1374 if err := p.ReadField3(iprot); err != nil {
1375 return err
1376 }
1377 case 4:
1378 if err := p.ReadField4(iprot); err != nil {
1379 return err
1380 }
1381 default:
1382 if err := iprot.Skip(fieldTypeId); err != nil {
1383 return err
1384 }
1385 }
1386 if err := iprot.ReadFieldEnd(); err != nil {
1387 return err
1388 }
1389 }
1390 if err := iprot.ReadStructEnd(); err != nil {
1391 return fmt.Errorf("%T read struct end error: %s", p, err)
1392 }
1393 return nil
1394 }
1395
1396 func (p *TraceCombo) ReadField1(iprot thrift.TProtocol) error {
1397 p.Trace = &Trace{}
1398 if err := p.Trace.Read(iprot); err != nil {
1399 return fmt.Errorf("%T error reading struct: %s", p.Trace, err)
1400 }
1401 return nil
1402 }
1403
1404 func (p *TraceCombo) ReadField2(iprot thrift.TProtocol) error {
1405 p.Summary = &TraceSummary{}
1406 if err := p.Summary.Read(iprot); err != nil {
1407 return fmt.Errorf("%T error reading struct: %s", p.Summary, err)
1408 }
1409 return nil
1410 }
1411
1412 func (p *TraceCombo) ReadField3(iprot thrift.TProtocol) error {
1413 p.Timeline = &TraceTimeline{}
1414 if err := p.Timeline.Read(iprot); err != nil {
1415 return fmt.Errorf("%T error reading struct: %s", p.Timeline, err)
1416 }
1417 return nil
1418 }
1419
1420 func (p *TraceCombo) ReadField4(iprot thrift.TProtocol) error {
1421 _, _, size, err := iprot.ReadMapBegin()
1422 if err != nil {
1423 return fmt.Errorf("error reading map begin: %s", err)
1424 }
1425 tMap := make(map[int64]int32, size)
1426 p.SpanDepths = tMap
1427 for i := 0; i < size; i++ {
1428 var _key5 int64
1429 if v, err := iprot.ReadI64(); err != nil {
1430 return fmt.Errorf("error reading field 0: %s", err)
1431 } else {
1432 _key5 = v
1433 }
1434 var _val6 int32
1435 if v, err := iprot.ReadI32(); err != nil {
1436 return fmt.Errorf("error reading field 0: %s", err)
1437 } else {
1438 _val6 = v
1439 }
1440 p.SpanDepths[_key5] = _val6
1441 }
1442 if err := iprot.ReadMapEnd(); err != nil {
1443 return fmt.Errorf("error reading map end: %s", err)
1444 }
1445 return nil
1446 }
1447
1448 func (p *TraceCombo) Write(oprot thrift.TProtocol) error {
1449 if err := oprot.WriteStructBegin("TraceCombo"); err != nil {
1450 return fmt.Errorf("%T write struct begin error: %s", p, err)
1451 }
1452 if err := p.writeField1(oprot); err != nil {
1453 return err
1454 }
1455 if err := p.writeField2(oprot); err != nil {
1456 return err
1457 }
1458 if err := p.writeField3(oprot); err != nil {
1459 return err
1460 }
1461 if err := p.writeField4(oprot); err != nil {
1462 return err
1463 }
1464 if err := oprot.WriteFieldStop(); err != nil {
1465 return fmt.Errorf("write field stop error: %s", err)
1466 }
1467 if err := oprot.WriteStructEnd(); err != nil {
1468 return fmt.Errorf("write struct stop error: %s", err)
1469 }
1470 return nil
1471 }
1472
1473 func (p *TraceCombo) writeField1(oprot thrift.TProtocol) (err error) {
1474 if err := oprot.WriteFieldBegin("trace", thrift.STRUCT, 1); err != nil {
1475 return fmt.Errorf("%T write field begin error 1:trace: %s", p, err)
1476 }
1477 if err := p.Trace.Write(oprot); err != nil {
1478 return fmt.Errorf("%T error writing struct: %s", p.Trace, err)
1479 }
1480 if err := oprot.WriteFieldEnd(); err != nil {
1481 return fmt.Errorf("%T write field end error 1:trace: %s", p, err)
1482 }
1483 return err
1484 }
1485
1486 func (p *TraceCombo) writeField2(oprot thrift.TProtocol) (err error) {
1487 if p.IsSetSummary() {
1488 if err := oprot.WriteFieldBegin("summary", thrift.STRUCT, 2); err != nil {
1489 return fmt.Errorf("%T write field begin error 2:summary: %s", p, err)
1490 }
1491 if err := p.Summary.Write(oprot); err != nil {
1492 return fmt.Errorf("%T error writing struct: %s", p.Summary, err)
1493 }
1494 if err := oprot.WriteFieldEnd(); err != nil {
1495 return fmt.Errorf("%T write field end error 2:summary: %s", p, err)
1496 }
1497 }
1498 return err
1499 }
1500
1501 func (p *TraceCombo) writeField3(oprot thrift.TProtocol) (err error) {
1502 if p.IsSetTimeline() {
1503 if err := oprot.WriteFieldBegin("timeline", thrift.STRUCT, 3); err != nil {
1504 return fmt.Errorf("%T write field begin error 3:timeline: %s", p, err)
1505 }
1506 if err := p.Timeline.Write(oprot); err != nil {
1507 return fmt.Errorf("%T error writing struct: %s", p.Timeline, err)
1508 }
1509 if err := oprot.WriteFieldEnd(); err != nil {
1510 return fmt.Errorf("%T write field end error 3:timeline: %s", p, err)
1511 }
1512 }
1513 return err
1514 }
1515
1516 func (p *TraceCombo) writeField4(oprot thrift.TProtocol) (err error) {
1517 if p.IsSetSpanDepths() {
1518 if err := oprot.WriteFieldBegin("span_depths", thrift.MAP, 4); err != nil {
1519 return fmt.Errorf("%T write field begin error 4:span_depths: %s", p, err)
1520 }
1521 if err := oprot.WriteMapBegin(thrift.I64, thrift.I32, len(p.SpanDepths)); err != nil {
1522 return fmt.Errorf("error writing map begin: %s", err)
1523 }
1524 for k, v := range p.SpanDepths {
1525 if err := oprot.WriteI64(int64(k)); err != nil {
1526 return fmt.Errorf("%T. (0) field write error: %s", p, err)
1527 }
1528 if err := oprot.WriteI32(int32(v)); err != nil {
1529 return fmt.Errorf("%T. (0) field write error: %s", p, err)
1530 }
1531 }
1532 if err := oprot.WriteMapEnd(); err != nil {
1533 return fmt.Errorf("error writing map end: %s", err)
1534 }
1535 if err := oprot.WriteFieldEnd(); err != nil {
1536 return fmt.Errorf("%T write field end error 4:span_depths: %s", p, err)
1537 }
1538 }
1539 return err
1540 }
1541
1542 func (p *TraceCombo) String() string {
1543 if p == nil {
1544 return "<nil>"
1545 }
1546 return fmt.Sprintf("TraceCombo(%+v)", *p)
1547 }
1548
1549 type QueryRequest struct {
1550 ServiceName string `thrift:"service_name,1" json:"service_name"`
1551 SpanName *string `thrift:"span_name,2" json:"span_name"`
1552 Annotations []string `thrift:"annotations,3" json:"annotations"`
1553 BinaryAnnotations []*zipkincore.BinaryAnnotation `thrift:"binary_annotations,4" json:"binary_annotations"`
1554 EndTs int64 `thrift:"end_ts,5" json:"end_ts"`
1555 Limit int32 `thrift:"limit,6" json:"limit"`
1556 Order Order `thrift:"order,7" json:"order"`
1557 }
1558
1559 func NewQueryRequest() *QueryRequest {
1560 return &QueryRequest{}
1561 }
1562
1563 func (p *QueryRequest) GetServiceName() string {
1564 return p.ServiceName
1565 }
1566
1567 var QueryRequest_SpanName_DEFAULT string
1568
1569 func (p *QueryRequest) GetSpanName() string {
1570 if !p.IsSetSpanName() {
1571 return QueryRequest_SpanName_DEFAULT
1572 }
1573 return *p.SpanName
1574 }
1575
1576 var QueryRequest_Annotations_DEFAULT []string
1577
1578 func (p *QueryRequest) GetAnnotations() []string {
1579 return p.Annotations
1580 }
1581
1582 var QueryRequest_BinaryAnnotations_DEFAULT []*zipkincore.BinaryAnnotation
1583
1584 func (p *QueryRequest) GetBinaryAnnotations() []*zipkincore.BinaryAnnotation {
1585 return p.BinaryAnnotations
1586 }
1587
1588 func (p *QueryRequest) GetEndTs() int64 {
1589 return p.EndTs
1590 }
1591
1592 func (p *QueryRequest) GetLimit() int32 {
1593 return p.Limit
1594 }
1595
1596 func (p *QueryRequest) GetOrder() Order {
1597 return p.Order
1598 }
1599 func (p *QueryRequest) IsSetSpanName() bool {
1600 return p.SpanName != nil
1601 }
1602
1603 func (p *QueryRequest) IsSetAnnotations() bool {
1604 return p.Annotations != nil
1605 }
1606
1607 func (p *QueryRequest) IsSetBinaryAnnotations() bool {
1608 return p.BinaryAnnotations != nil
1609 }
1610
1611 func (p *QueryRequest) Read(iprot thrift.TProtocol) error {
1612 if _, err := iprot.ReadStructBegin(); err != nil {
1613 return fmt.Errorf("%T read error: %s", p, err)
1614 }
1615 for {
1616 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
1617 if err != nil {
1618 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
1619 }
1620 if fieldTypeId == thrift.STOP {
1621 break
1622 }
1623 switch fieldId {
1624 case 1:
1625 if err := p.ReadField1(iprot); err != nil {
1626 return err
1627 }
1628 case 2:
1629 if err := p.ReadField2(iprot); err != nil {
1630 return err
1631 }
1632 case 3:
1633 if err := p.ReadField3(iprot); err != nil {
1634 return err
1635 }
1636 case 4:
1637 if err := p.ReadField4(iprot); err != nil {
1638 return err
1639 }
1640 case 5:
1641 if err := p.ReadField5(iprot); err != nil {
1642 return err
1643 }
1644 case 6:
1645 if err := p.ReadField6(iprot); err != nil {
1646 return err
1647 }
1648 case 7:
1649 if err := p.ReadField7(iprot); err != nil {
1650 return err
1651 }
1652 default:
1653 if err := iprot.Skip(fieldTypeId); err != nil {
1654 return err
1655 }
1656 }
1657 if err := iprot.ReadFieldEnd(); err != nil {
1658 return err
1659 }
1660 }
1661 if err := iprot.ReadStructEnd(); err != nil {
1662 return fmt.Errorf("%T read struct end error: %s", p, err)
1663 }
1664 return nil
1665 }
1666
1667 func (p *QueryRequest) ReadField1(iprot thrift.TProtocol) error {
1668 if v, err := iprot.ReadString(); err != nil {
1669 return fmt.Errorf("error reading field 1: %s", err)
1670 } else {
1671 p.ServiceName = v
1672 }
1673 return nil
1674 }
1675
1676 func (p *QueryRequest) ReadField2(iprot thrift.TProtocol) error {
1677 if v, err := iprot.ReadString(); err != nil {
1678 return fmt.Errorf("error reading field 2: %s", err)
1679 } else {
1680 p.SpanName = &v
1681 }
1682 return nil
1683 }
1684
1685 func (p *QueryRequest) ReadField3(iprot thrift.TProtocol) error {
1686 _, size, err := iprot.ReadListBegin()
1687 if err != nil {
1688 return fmt.Errorf("error reading list begin: %s", err)
1689 }
1690 tSlice := make([]string, 0, size)
1691 p.Annotations = tSlice
1692 for i := 0; i < size; i++ {
1693 var _elem7 string
1694 if v, err := iprot.ReadString(); err != nil {
1695 return fmt.Errorf("error reading field 0: %s", err)
1696 } else {
1697 _elem7 = v
1698 }
1699 p.Annotations = append(p.Annotations, _elem7)
1700 }
1701 if err := iprot.ReadListEnd(); err != nil {
1702 return fmt.Errorf("error reading list end: %s", err)
1703 }
1704 return nil
1705 }
1706
1707 func (p *QueryRequest) ReadField4(iprot thrift.TProtocol) error {
1708 _, size, err := iprot.ReadListBegin()
1709 if err != nil {
1710 return fmt.Errorf("error reading list begin: %s", err)
1711 }
1712 tSlice := make([]*zipkincore.BinaryAnnotation, 0, size)
1713 p.BinaryAnnotations = tSlice
1714 for i := 0; i < size; i++ {
1715 _elem8 := &zipkincore.BinaryAnnotation{}
1716 if err := _elem8.Read(iprot); err != nil {
1717 return fmt.Errorf("%T error reading struct: %s", _elem8, err)
1718 }
1719 p.BinaryAnnotations = append(p.BinaryAnnotations, _elem8)
1720 }
1721 if err := iprot.ReadListEnd(); err != nil {
1722 return fmt.Errorf("error reading list end: %s", err)
1723 }
1724 return nil
1725 }
1726
1727 func (p *QueryRequest) ReadField5(iprot thrift.TProtocol) error {
1728 if v, err := iprot.ReadI64(); err != nil {
1729 return fmt.Errorf("error reading field 5: %s", err)
1730 } else {
1731 p.EndTs = v
1732 }
1733 return nil
1734 }
1735
1736 func (p *QueryRequest) ReadField6(iprot thrift.TProtocol) error {
1737 if v, err := iprot.ReadI32(); err != nil {
1738 return fmt.Errorf("error reading field 6: %s", err)
1739 } else {
1740 p.Limit = v
1741 }
1742 return nil
1743 }
1744
1745 func (p *QueryRequest) ReadField7(iprot thrift.TProtocol) error {
1746 if v, err := iprot.ReadI32(); err != nil {
1747 return fmt.Errorf("error reading field 7: %s", err)
1748 } else {
1749 temp := Order(v)
1750 p.Order = temp
1751 }
1752 return nil
1753 }
1754
1755 func (p *QueryRequest) Write(oprot thrift.TProtocol) error {
1756 if err := oprot.WriteStructBegin("QueryRequest"); err != nil {
1757 return fmt.Errorf("%T write struct begin error: %s", p, err)
1758 }
1759 if err := p.writeField1(oprot); err != nil {
1760 return err
1761 }
1762 if err := p.writeField2(oprot); err != nil {
1763 return err
1764 }
1765 if err := p.writeField3(oprot); err != nil {
1766 return err
1767 }
1768 if err := p.writeField4(oprot); err != nil {
1769 return err
1770 }
1771 if err := p.writeField5(oprot); err != nil {
1772 return err
1773 }
1774 if err := p.writeField6(oprot); err != nil {
1775 return err
1776 }
1777 if err := p.writeField7(oprot); err != nil {
1778 return err
1779 }
1780 if err := oprot.WriteFieldStop(); err != nil {
1781 return fmt.Errorf("write field stop error: %s", err)
1782 }
1783 if err := oprot.WriteStructEnd(); err != nil {
1784 return fmt.Errorf("write struct stop error: %s", err)
1785 }
1786 return nil
1787 }
1788
1789 func (p *QueryRequest) writeField1(oprot thrift.TProtocol) (err error) {
1790 if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil {
1791 return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err)
1792 }
1793 if err := oprot.WriteString(string(p.ServiceName)); err != nil {
1794 return fmt.Errorf("%T.service_name (1) field write error: %s", p, err)
1795 }
1796 if err := oprot.WriteFieldEnd(); err != nil {
1797 return fmt.Errorf("%T write field end error 1:service_name: %s", p, err)
1798 }
1799 return err
1800 }
1801
1802 func (p *QueryRequest) writeField2(oprot thrift.TProtocol) (err error) {
1803 if p.IsSetSpanName() {
1804 if err := oprot.WriteFieldBegin("span_name", thrift.STRING, 2); err != nil {
1805 return fmt.Errorf("%T write field begin error 2:span_name: %s", p, err)
1806 }
1807 if err := oprot.WriteString(string(*p.SpanName)); err != nil {
1808 return fmt.Errorf("%T.span_name (2) field write error: %s", p, err)
1809 }
1810 if err := oprot.WriteFieldEnd(); err != nil {
1811 return fmt.Errorf("%T write field end error 2:span_name: %s", p, err)
1812 }
1813 }
1814 return err
1815 }
1816
1817 func (p *QueryRequest) writeField3(oprot thrift.TProtocol) (err error) {
1818 if p.IsSetAnnotations() {
1819 if err := oprot.WriteFieldBegin("annotations", thrift.LIST, 3); err != nil {
1820 return fmt.Errorf("%T write field begin error 3:annotations: %s", p, err)
1821 }
1822 if err := oprot.WriteListBegin(thrift.STRING, len(p.Annotations)); err != nil {
1823 return fmt.Errorf("error writing list begin: %s", err)
1824 }
1825 for _, v := range p.Annotations {
1826 if err := oprot.WriteString(string(v)); err != nil {
1827 return fmt.Errorf("%T. (0) field write error: %s", p, err)
1828 }
1829 }
1830 if err := oprot.WriteListEnd(); err != nil {
1831 return fmt.Errorf("error writing list end: %s", err)
1832 }
1833 if err := oprot.WriteFieldEnd(); err != nil {
1834 return fmt.Errorf("%T write field end error 3:annotations: %s", p, err)
1835 }
1836 }
1837 return err
1838 }
1839
1840 func (p *QueryRequest) writeField4(oprot thrift.TProtocol) (err error) {
1841 if p.IsSetBinaryAnnotations() {
1842 if err := oprot.WriteFieldBegin("binary_annotations", thrift.LIST, 4); err != nil {
1843 return fmt.Errorf("%T write field begin error 4:binary_annotations: %s", p, err)
1844 }
1845 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.BinaryAnnotations)); err != nil {
1846 return fmt.Errorf("error writing list begin: %s", err)
1847 }
1848 for _, v := range p.BinaryAnnotations {
1849 if err := v.Write(oprot); err != nil {
1850 return fmt.Errorf("%T error writing struct: %s", v, err)
1851 }
1852 }
1853 if err := oprot.WriteListEnd(); err != nil {
1854 return fmt.Errorf("error writing list end: %s", err)
1855 }
1856 if err := oprot.WriteFieldEnd(); err != nil {
1857 return fmt.Errorf("%T write field end error 4:binary_annotations: %s", p, err)
1858 }
1859 }
1860 return err
1861 }
1862
1863 func (p *QueryRequest) writeField5(oprot thrift.TProtocol) (err error) {
1864 if err := oprot.WriteFieldBegin("end_ts", thrift.I64, 5); err != nil {
1865 return fmt.Errorf("%T write field begin error 5:end_ts: %s", p, err)
1866 }
1867 if err := oprot.WriteI64(int64(p.EndTs)); err != nil {
1868 return fmt.Errorf("%T.end_ts (5) field write error: %s", p, err)
1869 }
1870 if err := oprot.WriteFieldEnd(); err != nil {
1871 return fmt.Errorf("%T write field end error 5:end_ts: %s", p, err)
1872 }
1873 return err
1874 }
1875
1876 func (p *QueryRequest) writeField6(oprot thrift.TProtocol) (err error) {
1877 if err := oprot.WriteFieldBegin("limit", thrift.I32, 6); err != nil {
1878 return fmt.Errorf("%T write field begin error 6:limit: %s", p, err)
1879 }
1880 if err := oprot.WriteI32(int32(p.Limit)); err != nil {
1881 return fmt.Errorf("%T.limit (6) field write error: %s", p, err)
1882 }
1883 if err := oprot.WriteFieldEnd(); err != nil {
1884 return fmt.Errorf("%T write field end error 6:limit: %s", p, err)
1885 }
1886 return err
1887 }
1888
1889 func (p *QueryRequest) writeField7(oprot thrift.TProtocol) (err error) {
1890 if err := oprot.WriteFieldBegin("order", thrift.I32, 7); err != nil {
1891 return fmt.Errorf("%T write field begin error 7:order: %s", p, err)
1892 }
1893 if err := oprot.WriteI32(int32(p.Order)); err != nil {
1894 return fmt.Errorf("%T.order (7) field write error: %s", p, err)
1895 }
1896 if err := oprot.WriteFieldEnd(); err != nil {
1897 return fmt.Errorf("%T write field end error 7:order: %s", p, err)
1898 }
1899 return err
1900 }
1901
1902 func (p *QueryRequest) String() string {
1903 if p == nil {
1904 return "<nil>"
1905 }
1906 return fmt.Sprintf("QueryRequest(%+v)", *p)
1907 }
1908
1909 type QueryResponse struct {
1910 TraceIds []int64 `thrift:"trace_ids,1" json:"trace_ids"`
1911 StartTs int64 `thrift:"start_ts,2" json:"start_ts"`
1912 EndTs int64 `thrift:"end_ts,3" json:"end_ts"`
1913 }
1914
1915 func NewQueryResponse() *QueryResponse {
1916 return &QueryResponse{}
1917 }
1918
1919 func (p *QueryResponse) GetTraceIds() []int64 {
1920 return p.TraceIds
1921 }
1922
1923 func (p *QueryResponse) GetStartTs() int64 {
1924 return p.StartTs
1925 }
1926
1927 func (p *QueryResponse) GetEndTs() int64 {
1928 return p.EndTs
1929 }
1930 func (p *QueryResponse) Read(iprot thrift.TProtocol) error {
1931 if _, err := iprot.ReadStructBegin(); err != nil {
1932 return fmt.Errorf("%T read error: %s", p, err)
1933 }
1934 for {
1935 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
1936 if err != nil {
1937 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
1938 }
1939 if fieldTypeId == thrift.STOP {
1940 break
1941 }
1942 switch fieldId {
1943 case 1:
1944 if err := p.ReadField1(iprot); err != nil {
1945 return err
1946 }
1947 case 2:
1948 if err := p.ReadField2(iprot); err != nil {
1949 return err
1950 }
1951 case 3:
1952 if err := p.ReadField3(iprot); err != nil {
1953 return err
1954 }
1955 default:
1956 if err := iprot.Skip(fieldTypeId); err != nil {
1957 return err
1958 }
1959 }
1960 if err := iprot.ReadFieldEnd(); err != nil {
1961 return err
1962 }
1963 }
1964 if err := iprot.ReadStructEnd(); err != nil {
1965 return fmt.Errorf("%T read struct end error: %s", p, err)
1966 }
1967 return nil
1968 }
1969
1970 func (p *QueryResponse) ReadField1(iprot thrift.TProtocol) error {
1971 _, size, err := iprot.ReadListBegin()
1972 if err != nil {
1973 return fmt.Errorf("error reading list begin: %s", err)
1974 }
1975 tSlice := make([]int64, 0, size)
1976 p.TraceIds = tSlice
1977 for i := 0; i < size; i++ {
1978 var _elem9 int64
1979 if v, err := iprot.ReadI64(); err != nil {
1980 return fmt.Errorf("error reading field 0: %s", err)
1981 } else {
1982 _elem9 = v
1983 }
1984 p.TraceIds = append(p.TraceIds, _elem9)
1985 }
1986 if err := iprot.ReadListEnd(); err != nil {
1987 return fmt.Errorf("error reading list end: %s", err)
1988 }
1989 return nil
1990 }
1991
1992 func (p *QueryResponse) ReadField2(iprot thrift.TProtocol) error {
1993 if v, err := iprot.ReadI64(); err != nil {
1994 return fmt.Errorf("error reading field 2: %s", err)
1995 } else {
1996 p.StartTs = v
1997 }
1998 return nil
1999 }
2000
2001 func (p *QueryResponse) ReadField3(iprot thrift.TProtocol) error {
2002 if v, err := iprot.ReadI64(); err != nil {
2003 return fmt.Errorf("error reading field 3: %s", err)
2004 } else {
2005 p.EndTs = v
2006 }
2007 return nil
2008 }
2009
2010 func (p *QueryResponse) Write(oprot thrift.TProtocol) error {
2011 if err := oprot.WriteStructBegin("QueryResponse"); err != nil {
2012 return fmt.Errorf("%T write struct begin error: %s", p, err)
2013 }
2014 if err := p.writeField1(oprot); err != nil {
2015 return err
2016 }
2017 if err := p.writeField2(oprot); err != nil {
2018 return err
2019 }
2020 if err := p.writeField3(oprot); err != nil {
2021 return err
2022 }
2023 if err := oprot.WriteFieldStop(); err != nil {
2024 return fmt.Errorf("write field stop error: %s", err)
2025 }
2026 if err := oprot.WriteStructEnd(); err != nil {
2027 return fmt.Errorf("write struct stop error: %s", err)
2028 }
2029 return nil
2030 }
2031
2032 func (p *QueryResponse) writeField1(oprot thrift.TProtocol) (err error) {
2033 if err := oprot.WriteFieldBegin("trace_ids", thrift.LIST, 1); err != nil {
2034 return fmt.Errorf("%T write field begin error 1:trace_ids: %s", p, err)
2035 }
2036 if err := oprot.WriteListBegin(thrift.I64, len(p.TraceIds)); err != nil {
2037 return fmt.Errorf("error writing list begin: %s", err)
2038 }
2039 for _, v := range p.TraceIds {
2040 if err := oprot.WriteI64(int64(v)); err != nil {
2041 return fmt.Errorf("%T. (0) field write error: %s", p, err)
2042 }
2043 }
2044 if err := oprot.WriteListEnd(); err != nil {
2045 return fmt.Errorf("error writing list end: %s", err)
2046 }
2047 if err := oprot.WriteFieldEnd(); err != nil {
2048 return fmt.Errorf("%T write field end error 1:trace_ids: %s", p, err)
2049 }
2050 return err
2051 }
2052
2053 func (p *QueryResponse) writeField2(oprot thrift.TProtocol) (err error) {
2054 if err := oprot.WriteFieldBegin("start_ts", thrift.I64, 2); err != nil {
2055 return fmt.Errorf("%T write field begin error 2:start_ts: %s", p, err)
2056 }
2057 if err := oprot.WriteI64(int64(p.StartTs)); err != nil {
2058 return fmt.Errorf("%T.start_ts (2) field write error: %s", p, err)
2059 }
2060 if err := oprot.WriteFieldEnd(); err != nil {
2061 return fmt.Errorf("%T write field end error 2:start_ts: %s", p, err)
2062 }
2063 return err
2064 }
2065
2066 func (p *QueryResponse) writeField3(oprot thrift.TProtocol) (err error) {
2067 if err := oprot.WriteFieldBegin("end_ts", thrift.I64, 3); err != nil {
2068 return fmt.Errorf("%T write field begin error 3:end_ts: %s", p, err)
2069 }
2070 if err := oprot.WriteI64(int64(p.EndTs)); err != nil {
2071 return fmt.Errorf("%T.end_ts (3) field write error: %s", p, err)
2072 }
2073 if err := oprot.WriteFieldEnd(); err != nil {
2074 return fmt.Errorf("%T write field end error 3:end_ts: %s", p, err)
2075 }
2076 return err
2077 }
2078
2079 func (p *QueryResponse) String() string {
2080 if p == nil {
2081 return "<nil>"
2082 }
2083 return fmt.Sprintf("QueryResponse(%+v)", *p)
2084 }
+0
-602
tracing/zipkin/_thrift/gen-go/zipkinquery/zipkin_query-remote/zipkin_query-remote.go less more
0 // Autogenerated by Thrift Compiler (0.9.2)
1 // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
2
3 package main
4
5 import (
6 "flag"
7 "fmt"
8 "github.com/apache/thrift/lib/go/thrift"
9 "math"
10 "net"
11 "net/url"
12 "os"
13 "strconv"
14 "strings"
15 "zipkinquery"
16 )
17
18 func Usage() {
19 fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:")
20 flag.PrintDefaults()
21 fmt.Fprintln(os.Stderr, "\nFunctions:")
22 fmt.Fprintln(os.Stderr, " QueryResponse getTraceIds(QueryRequest request)")
23 fmt.Fprintln(os.Stderr, " getTraceIdsBySpanName(string service_name, string span_name, i64 end_ts, i32 limit, Order order)")
24 fmt.Fprintln(os.Stderr, " getTraceIdsByServiceName(string service_name, i64 end_ts, i32 limit, Order order)")
25 fmt.Fprintln(os.Stderr, " getTraceIdsByAnnotation(string service_name, string annotation, string value, i64 end_ts, i32 limit, Order order)")
26 fmt.Fprintln(os.Stderr, " tracesExist( trace_ids)")
27 fmt.Fprintln(os.Stderr, " getTracesByIds( trace_ids, adjust)")
28 fmt.Fprintln(os.Stderr, " getTraceTimelinesByIds( trace_ids, adjust)")
29 fmt.Fprintln(os.Stderr, " getTraceSummariesByIds( trace_ids, adjust)")
30 fmt.Fprintln(os.Stderr, " getTraceCombosByIds( trace_ids, adjust)")
31 fmt.Fprintln(os.Stderr, " getServiceNames()")
32 fmt.Fprintln(os.Stderr, " getSpanNames(string service_name)")
33 fmt.Fprintln(os.Stderr, " void setTraceTimeToLive(i64 trace_id, i32 ttl_seconds)")
34 fmt.Fprintln(os.Stderr, " i32 getTraceTimeToLive(i64 trace_id)")
35 fmt.Fprintln(os.Stderr, " i32 getDataTimeToLive()")
36 fmt.Fprintln(os.Stderr, " Dependencies getDependencies(i64 start_time, i64 end_time)")
37 fmt.Fprintln(os.Stderr, " getTopAnnotations(string service_name)")
38 fmt.Fprintln(os.Stderr, " getTopKeyValueAnnotations(string service_name)")
39 fmt.Fprintln(os.Stderr, " getSpanDurations(i64 time_stamp, string service_name, string rpc_name)")
40 fmt.Fprintln(os.Stderr, " getServiceNamesToTraceIds(i64 time_stamp, string service_name, string rpc_name)")
41 fmt.Fprintln(os.Stderr)
42 os.Exit(0)
43 }
44
45 func main() {
46 flag.Usage = Usage
47 var host string
48 var port int
49 var protocol string
50 var urlString string
51 var framed bool
52 var useHttp bool
53 var parsedUrl url.URL
54 var trans thrift.TTransport
55 _ = strconv.Atoi
56 _ = math.Abs
57 flag.Usage = Usage
58 flag.StringVar(&host, "h", "localhost", "Specify host and port")
59 flag.IntVar(&port, "p", 9090, "Specify port")
60 flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
61 flag.StringVar(&urlString, "u", "", "Specify the url")
62 flag.BoolVar(&framed, "framed", false, "Use framed transport")
63 flag.BoolVar(&useHttp, "http", false, "Use http")
64 flag.Parse()
65
66 if len(urlString) > 0 {
67 parsedUrl, err := url.Parse(urlString)
68 if err != nil {
69 fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
70 flag.Usage()
71 }
72 host = parsedUrl.Host
73 useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
74 } else if useHttp {
75 _, err := url.Parse(fmt.Sprint("http://", host, ":", port))
76 if err != nil {
77 fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
78 flag.Usage()
79 }
80 }
81
82 cmd := flag.Arg(0)
83 var err error
84 if useHttp {
85 trans, err = thrift.NewTHttpClient(parsedUrl.String())
86 } else {
87 portStr := fmt.Sprint(port)
88 if strings.Contains(host, ":") {
89 host, portStr, err = net.SplitHostPort(host)
90 if err != nil {
91 fmt.Fprintln(os.Stderr, "error with host:", err)
92 os.Exit(1)
93 }
94 }
95 trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
96 if err != nil {
97 fmt.Fprintln(os.Stderr, "error resolving address:", err)
98 os.Exit(1)
99 }
100 if framed {
101 trans = thrift.NewTFramedTransport(trans)
102 }
103 }
104 if err != nil {
105 fmt.Fprintln(os.Stderr, "Error creating transport", err)
106 os.Exit(1)
107 }
108 defer trans.Close()
109 var protocolFactory thrift.TProtocolFactory
110 switch protocol {
111 case "compact":
112 protocolFactory = thrift.NewTCompactProtocolFactory()
113 break
114 case "simplejson":
115 protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
116 break
117 case "json":
118 protocolFactory = thrift.NewTJSONProtocolFactory()
119 break
120 case "binary", "":
121 protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
122 break
123 default:
124 fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
125 Usage()
126 os.Exit(1)
127 }
128 client := zipkinquery.NewZipkinQueryClientFactory(trans, protocolFactory)
129 if err := trans.Open(); err != nil {
130 fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
131 os.Exit(1)
132 }
133
134 switch cmd {
135 case "getTraceIds":
136 if flag.NArg()-1 != 1 {
137 fmt.Fprintln(os.Stderr, "GetTraceIds requires 1 args")
138 flag.Usage()
139 }
140 arg77 := flag.Arg(1)
141 mbTrans78 := thrift.NewTMemoryBufferLen(len(arg77))
142 defer mbTrans78.Close()
143 _, err79 := mbTrans78.WriteString(arg77)
144 if err79 != nil {
145 Usage()
146 return
147 }
148 factory80 := thrift.NewTSimpleJSONProtocolFactory()
149 jsProt81 := factory80.GetProtocol(mbTrans78)
150 argvalue0 := zipkinquery.NewQueryRequest()
151 err82 := argvalue0.Read(jsProt81)
152 if err82 != nil {
153 Usage()
154 return
155 }
156 value0 := argvalue0
157 fmt.Print(client.GetTraceIds(value0))
158 fmt.Print("\n")
159 break
160 case "getTraceIdsBySpanName":
161 if flag.NArg()-1 != 5 {
162 fmt.Fprintln(os.Stderr, "GetTraceIdsBySpanName requires 5 args")
163 flag.Usage()
164 }
165 argvalue0 := flag.Arg(1)
166 value0 := argvalue0
167 argvalue1 := flag.Arg(2)
168 value1 := argvalue1
169 argvalue2, err85 := (strconv.ParseInt(flag.Arg(3), 10, 64))
170 if err85 != nil {
171 Usage()
172 return
173 }
174 value2 := argvalue2
175 tmp3, err86 := (strconv.Atoi(flag.Arg(4)))
176 if err86 != nil {
177 Usage()
178 return
179 }
180 argvalue3 := int32(tmp3)
181 value3 := argvalue3
182 tmp4, err := (strconv.Atoi(flag.Arg(5)))
183 if err != nil {
184 Usage()
185 return
186 }
187 argvalue4 := zipkinquery.Order(tmp4)
188 value4 := argvalue4
189 fmt.Print(client.GetTraceIdsBySpanName(value0, value1, value2, value3, value4))
190 fmt.Print("\n")
191 break
192 case "getTraceIdsByServiceName":
193 if flag.NArg()-1 != 4 {
194 fmt.Fprintln(os.Stderr, "GetTraceIdsByServiceName requires 4 args")
195 flag.Usage()
196 }
197 argvalue0 := flag.Arg(1)
198 value0 := argvalue0
199 argvalue1, err88 := (strconv.ParseInt(flag.Arg(2), 10, 64))
200 if err88 != nil {
201 Usage()
202 return
203 }
204 value1 := argvalue1
205 tmp2, err89 := (strconv.Atoi(flag.Arg(3)))
206 if err89 != nil {
207 Usage()
208 return
209 }
210 argvalue2 := int32(tmp2)
211 value2 := argvalue2
212 tmp3, err := (strconv.Atoi(flag.Arg(4)))
213 if err != nil {
214 Usage()
215 return
216 }
217 argvalue3 := zipkinquery.Order(tmp3)
218 value3 := argvalue3
219 fmt.Print(client.GetTraceIdsByServiceName(value0, value1, value2, value3))
220 fmt.Print("\n")
221 break
222 case "getTraceIdsByAnnotation":
223 if flag.NArg()-1 != 6 {
224 fmt.Fprintln(os.Stderr, "GetTraceIdsByAnnotation requires 6 args")
225 flag.Usage()
226 }
227 argvalue0 := flag.Arg(1)
228 value0 := argvalue0
229 argvalue1 := flag.Arg(2)
230 value1 := argvalue1
231 argvalue2 := []byte(flag.Arg(3))
232 value2 := argvalue2
233 argvalue3, err93 := (strconv.ParseInt(flag.Arg(4), 10, 64))
234 if err93 != nil {
235 Usage()
236 return
237 }
238 value3 := argvalue3
239 tmp4, err94 := (strconv.Atoi(flag.Arg(5)))
240 if err94 != nil {
241 Usage()
242 return
243 }
244 argvalue4 := int32(tmp4)
245 value4 := argvalue4
246 tmp5, err := (strconv.Atoi(flag.Arg(6)))
247 if err != nil {
248 Usage()
249 return
250 }
251 argvalue5 := zipkinquery.Order(tmp5)
252 value5 := argvalue5
253 fmt.Print(client.GetTraceIdsByAnnotation(value0, value1, value2, value3, value4, value5))
254 fmt.Print("\n")
255 break
256 case "tracesExist":
257 if flag.NArg()-1 != 1 {
258 fmt.Fprintln(os.Stderr, "TracesExist requires 1 args")
259 flag.Usage()
260 }
261 arg95 := flag.Arg(1)
262 mbTrans96 := thrift.NewTMemoryBufferLen(len(arg95))
263 defer mbTrans96.Close()
264 _, err97 := mbTrans96.WriteString(arg95)
265 if err97 != nil {
266 Usage()
267 return
268 }
269 factory98 := thrift.NewTSimpleJSONProtocolFactory()
270 jsProt99 := factory98.GetProtocol(mbTrans96)
271 containerStruct0 := zipkinquery.NewTracesExistArgs()
272 err100 := containerStruct0.ReadField1(jsProt99)
273 if err100 != nil {
274 Usage()
275 return
276 }
277 argvalue0 := containerStruct0.TraceIds
278 value0 := argvalue0
279 fmt.Print(client.TracesExist(value0))
280 fmt.Print("\n")
281 break
282 case "getTracesByIds":
283 if flag.NArg()-1 != 2 {
284 fmt.Fprintln(os.Stderr, "GetTracesByIds requires 2 args")
285 flag.Usage()
286 }
287 arg101 := flag.Arg(1)
288 mbTrans102 := thrift.NewTMemoryBufferLen(len(arg101))
289 defer mbTrans102.Close()
290 _, err103 := mbTrans102.WriteString(arg101)
291 if err103 != nil {
292 Usage()
293 return
294 }
295 factory104 := thrift.NewTSimpleJSONProtocolFactory()
296 jsProt105 := factory104.GetProtocol(mbTrans102)
297 containerStruct0 := zipkinquery.NewGetTracesByIdsArgs()
298 err106 := containerStruct0.ReadField1(jsProt105)
299 if err106 != nil {
300 Usage()
301 return
302 }
303 argvalue0 := containerStruct0.TraceIds
304 value0 := argvalue0
305 arg107 := flag.Arg(2)
306 mbTrans108 := thrift.NewTMemoryBufferLen(len(arg107))
307 defer mbTrans108.Close()
308 _, err109 := mbTrans108.WriteString(arg107)
309 if err109 != nil {
310 Usage()
311 return
312 }
313 factory110 := thrift.NewTSimpleJSONProtocolFactory()
314 jsProt111 := factory110.GetProtocol(mbTrans108)
315 containerStruct1 := zipkinquery.NewGetTracesByIdsArgs()
316 err112 := containerStruct1.ReadField2(jsProt111)
317 if err112 != nil {
318 Usage()
319 return
320 }
321 argvalue1 := containerStruct1.Adjust
322 value1 := argvalue1
323 fmt.Print(client.GetTracesByIds(value0, value1))
324 fmt.Print("\n")
325 break
326 case "getTraceTimelinesByIds":
327 if flag.NArg()-1 != 2 {
328 fmt.Fprintln(os.Stderr, "GetTraceTimelinesByIds requires 2 args")
329 flag.Usage()
330 }
331 arg113 := flag.Arg(1)
332 mbTrans114 := thrift.NewTMemoryBufferLen(len(arg113))
333 defer mbTrans114.Close()
334 _, err115 := mbTrans114.WriteString(arg113)
335 if err115 != nil {
336 Usage()
337 return
338 }
339 factory116 := thrift.NewTSimpleJSONProtocolFactory()
340 jsProt117 := factory116.GetProtocol(mbTrans114)
341 containerStruct0 := zipkinquery.NewGetTraceTimelinesByIdsArgs()
342 err118 := containerStruct0.ReadField1(jsProt117)
343 if err118 != nil {
344 Usage()
345 return
346 }
347 argvalue0 := containerStruct0.TraceIds
348 value0 := argvalue0
349 arg119 := flag.Arg(2)
350 mbTrans120 := thrift.NewTMemoryBufferLen(len(arg119))
351 defer mbTrans120.Close()
352 _, err121 := mbTrans120.WriteString(arg119)
353 if err121 != nil {
354 Usage()
355 return
356 }
357 factory122 := thrift.NewTSimpleJSONProtocolFactory()
358 jsProt123 := factory122.GetProtocol(mbTrans120)
359 containerStruct1 := zipkinquery.NewGetTraceTimelinesByIdsArgs()
360 err124 := containerStruct1.ReadField2(jsProt123)
361 if err124 != nil {
362 Usage()
363 return
364 }
365 argvalue1 := containerStruct1.Adjust
366 value1 := argvalue1
367 fmt.Print(client.GetTraceTimelinesByIds(value0, value1))
368 fmt.Print("\n")
369 break
370 case "getTraceSummariesByIds":
371 if flag.NArg()-1 != 2 {
372 fmt.Fprintln(os.Stderr, "GetTraceSummariesByIds requires 2 args")
373 flag.Usage()
374 }
375 arg125 := flag.Arg(1)
376 mbTrans126 := thrift.NewTMemoryBufferLen(len(arg125))
377 defer mbTrans126.Close()
378 _, err127 := mbTrans126.WriteString(arg125)
379 if err127 != nil {
380 Usage()
381 return
382 }
383 factory128 := thrift.NewTSimpleJSONProtocolFactory()
384 jsProt129 := factory128.GetProtocol(mbTrans126)
385 containerStruct0 := zipkinquery.NewGetTraceSummariesByIdsArgs()
386 err130 := containerStruct0.ReadField1(jsProt129)
387 if err130 != nil {
388 Usage()
389 return
390 }
391 argvalue0 := containerStruct0.TraceIds
392 value0 := argvalue0
393 arg131 := flag.Arg(2)
394 mbTrans132 := thrift.NewTMemoryBufferLen(len(arg131))
395 defer mbTrans132.Close()
396 _, err133 := mbTrans132.WriteString(arg131)
397 if err133 != nil {
398 Usage()
399 return
400 }
401 factory134 := thrift.NewTSimpleJSONProtocolFactory()
402 jsProt135 := factory134.GetProtocol(mbTrans132)
403 containerStruct1 := zipkinquery.NewGetTraceSummariesByIdsArgs()
404 err136 := containerStruct1.ReadField2(jsProt135)
405 if err136 != nil {
406 Usage()
407 return
408 }
409 argvalue1 := containerStruct1.Adjust
410 value1 := argvalue1
411 fmt.Print(client.GetTraceSummariesByIds(value0, value1))
412 fmt.Print("\n")
413 break
414 case "getTraceCombosByIds":
415 if flag.NArg()-1 != 2 {
416 fmt.Fprintln(os.Stderr, "GetTraceCombosByIds requires 2 args")
417 flag.Usage()
418 }
419 arg137 := flag.Arg(1)
420 mbTrans138 := thrift.NewTMemoryBufferLen(len(arg137))
421 defer mbTrans138.Close()
422 _, err139 := mbTrans138.WriteString(arg137)
423 if err139 != nil {
424 Usage()
425 return
426 }
427 factory140 := thrift.NewTSimpleJSONProtocolFactory()
428 jsProt141 := factory140.GetProtocol(mbTrans138)
429 containerStruct0 := zipkinquery.NewGetTraceCombosByIdsArgs()
430 err142 := containerStruct0.ReadField1(jsProt141)
431 if err142 != nil {
432 Usage()
433 return
434 }
435 argvalue0 := containerStruct0.TraceIds
436 value0 := argvalue0
437 arg143 := flag.Arg(2)
438 mbTrans144 := thrift.NewTMemoryBufferLen(len(arg143))
439 defer mbTrans144.Close()
440 _, err145 := mbTrans144.WriteString(arg143)
441 if err145 != nil {
442 Usage()
443 return
444 }
445 factory146 := thrift.NewTSimpleJSONProtocolFactory()
446 jsProt147 := factory146.GetProtocol(mbTrans144)
447 containerStruct1 := zipkinquery.NewGetTraceCombosByIdsArgs()
448 err148 := containerStruct1.ReadField2(jsProt147)
449 if err148 != nil {
450 Usage()
451 return
452 }
453 argvalue1 := containerStruct1.Adjust
454 value1 := argvalue1
455 fmt.Print(client.GetTraceCombosByIds(value0, value1))
456 fmt.Print("\n")
457 break
458 case "getServiceNames":
459 if flag.NArg()-1 != 0 {
460 fmt.Fprintln(os.Stderr, "GetServiceNames requires 0 args")
461 flag.Usage()
462 }
463 fmt.Print(client.GetServiceNames())
464 fmt.Print("\n")
465 break
466 case "getSpanNames":
467 if flag.NArg()-1 != 1 {
468 fmt.Fprintln(os.Stderr, "GetSpanNames requires 1 args")
469 flag.Usage()
470 }
471 argvalue0 := flag.Arg(1)
472 value0 := argvalue0
473 fmt.Print(client.GetSpanNames(value0))
474 fmt.Print("\n")
475 break
476 case "setTraceTimeToLive":
477 if flag.NArg()-1 != 2 {
478 fmt.Fprintln(os.Stderr, "SetTraceTimeToLive requires 2 args")
479 flag.Usage()
480 }
481 argvalue0, err150 := (strconv.ParseInt(flag.Arg(1), 10, 64))
482 if err150 != nil {
483 Usage()
484 return
485 }
486 value0 := argvalue0
487 tmp1, err151 := (strconv.Atoi(flag.Arg(2)))
488 if err151 != nil {
489 Usage()
490 return
491 }
492 argvalue1 := int32(tmp1)
493 value1 := argvalue1
494 fmt.Print(client.SetTraceTimeToLive(value0, value1))
495 fmt.Print("\n")
496 break
497 case "getTraceTimeToLive":
498 if flag.NArg()-1 != 1 {
499 fmt.Fprintln(os.Stderr, "GetTraceTimeToLive requires 1 args")
500 flag.Usage()
501 }
502 argvalue0, err152 := (strconv.ParseInt(flag.Arg(1), 10, 64))
503 if err152 != nil {
504 Usage()
505 return
506 }
507 value0 := argvalue0
508 fmt.Print(client.GetTraceTimeToLive(value0))
509 fmt.Print("\n")
510 break
511 case "getDataTimeToLive":
512 if flag.NArg()-1 != 0 {
513 fmt.Fprintln(os.Stderr, "GetDataTimeToLive requires 0 args")
514 flag.Usage()
515 }
516 fmt.Print(client.GetDataTimeToLive())
517 fmt.Print("\n")
518 break
519 case "getDependencies":
520 if flag.NArg()-1 != 2 {
521 fmt.Fprintln(os.Stderr, "GetDependencies requires 2 args")
522 flag.Usage()
523 }
524 argvalue0, err153 := (strconv.ParseInt(flag.Arg(1), 10, 64))
525 if err153 != nil {
526 Usage()
527 return
528 }
529 value0 := argvalue0
530 argvalue1, err154 := (strconv.ParseInt(flag.Arg(2), 10, 64))
531 if err154 != nil {
532 Usage()
533 return
534 }
535 value1 := argvalue1
536 fmt.Print(client.GetDependencies(value0, value1))
537 fmt.Print("\n")
538 break
539 case "getTopAnnotations":
540 if flag.NArg()-1 != 1 {
541 fmt.Fprintln(os.Stderr, "GetTopAnnotations requires 1 args")
542 flag.Usage()
543 }
544 argvalue0 := flag.Arg(1)
545 value0 := argvalue0
546 fmt.Print(client.GetTopAnnotations(value0))
547 fmt.Print("\n")
548 break
549 case "getTopKeyValueAnnotations":
550 if flag.NArg()-1 != 1 {
551 fmt.Fprintln(os.Stderr, "GetTopKeyValueAnnotations requires 1 args")
552 flag.Usage()
553 }
554 argvalue0 := flag.Arg(1)
555 value0 := argvalue0
556 fmt.Print(client.GetTopKeyValueAnnotations(value0))
557 fmt.Print("\n")
558 break
559 case "getSpanDurations":
560 if flag.NArg()-1 != 3 {
561 fmt.Fprintln(os.Stderr, "GetSpanDurations requires 3 args")
562 flag.Usage()
563 }
564 argvalue0, err157 := (strconv.ParseInt(flag.Arg(1), 10, 64))
565 if err157 != nil {
566 Usage()
567 return
568 }
569 value0 := argvalue0
570 argvalue1 := flag.Arg(2)
571 value1 := argvalue1
572 argvalue2 := flag.Arg(3)
573 value2 := argvalue2
574 fmt.Print(client.GetSpanDurations(value0, value1, value2))
575 fmt.Print("\n")
576 break
577 case "getServiceNamesToTraceIds":
578 if flag.NArg()-1 != 3 {
579 fmt.Fprintln(os.Stderr, "GetServiceNamesToTraceIds requires 3 args")
580 flag.Usage()
581 }
582 argvalue0, err160 := (strconv.ParseInt(flag.Arg(1), 10, 64))
583 if err160 != nil {
584 Usage()
585 return
586 }
587 value0 := argvalue0
588 argvalue1 := flag.Arg(2)
589 value1 := argvalue1
590 argvalue2 := flag.Arg(3)
591 value2 := argvalue2
592 fmt.Print(client.GetServiceNamesToTraceIds(value0, value1, value2))
593 fmt.Print("\n")
594 break
595 case "":
596 Usage()
597 break
598 default:
599 fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
600 }
601 }
+0
-8183
tracing/zipkin/_thrift/gen-go/zipkinquery/zipkinquery.go less more
0 // Autogenerated by Thrift Compiler (0.9.2)
1 // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
2
3 package zipkinquery
4
5 import (
6 "bytes"
7 "fmt"
8 "github.com/apache/thrift/lib/go/thrift"
9 "zipkincore"
10 "zipkindependencies"
11 )
12
13 // (needed to ensure safety because of naive import list construction.)
14 var _ = thrift.ZERO
15 var _ = fmt.Printf
16 var _ = bytes.Equal
17
18 var _ = zipkincore.GoUnusedProtection__
19 var _ = zipkindependencies.GoUnusedProtection__
20
21 type ZipkinQuery interface {
22 // Parameters:
23 // - Request
24 GetTraceIds(request *QueryRequest) (r *QueryResponse, err error)
25 // Fetch trace ids by service and span name.
26 // Gets "limit" number of entries from before the "end_ts".
27 //
28 // Span name is optional.
29 // Timestamps are in microseconds.
30 //
31 // Parameters:
32 // - ServiceName
33 // - SpanName
34 // - EndTs
35 // - Limit
36 // - Order
37 GetTraceIdsBySpanName(service_name string, span_name string, end_ts int64, limit int32, order Order) (r []int64, err error)
38 // Fetch trace ids by service name.
39 // Gets "limit" number of entries from before the "end_ts".
40 //
41 // Timestamps are in microseconds.
42 //
43 // Parameters:
44 // - ServiceName
45 // - EndTs
46 // - Limit
47 // - Order
48 GetTraceIdsByServiceName(service_name string, end_ts int64, limit int32, order Order) (r []int64, err error)
49 // Fetch trace ids with a particular annotation.
50 // Gets "limit" number of entries from before the "end_ts".
51 //
52 // When requesting based on time based annotations only pass in the first parameter, "annotation" and leave out
53 // the second "value". If looking for a key-value binary annotation provide both, "annotation" is then the
54 // key in the key-value.
55 //
56 // Timestamps are in microseconds.
57 //
58 // Parameters:
59 // - ServiceName
60 // - Annotation
61 // - Value
62 // - EndTs
63 // - Limit
64 // - Order
65 GetTraceIdsByAnnotation(service_name string, annotation string, value []byte, end_ts int64, limit int32, order Order) (r []int64, err error)
66 // Get the traces that are in the database from the given list of trace ids.
67 //
68 // Parameters:
69 // - TraceIds
70 TracesExist(trace_ids []int64) (r map[int64]bool, err error)
71 // Get the full traces associated with the given trace ids.
72 //
73 // Second argument is a list of methods of adjusting the trace
74 // data before returning it. Can be empty.
75 //
76 // Parameters:
77 // - TraceIds
78 // - Adjust
79 GetTracesByIds(trace_ids []int64, adjust []Adjust) (r []*Trace, err error)
80 // Get the trace timelines associated with the given trace ids.
81 // This is a convenience method for users that just want to know
82 // the annotations and the (assumed) order they happened in.
83 //
84 // Second argument is a list of methods of adjusting the trace
85 // data before returning it. Can be empty.
86 //
87 // Note that if one of the trace ids does not have any data associated with it, it will not be
88 // represented in the output list.
89 //
90 // Parameters:
91 // - TraceIds
92 // - Adjust
93 GetTraceTimelinesByIds(trace_ids []int64, adjust []Adjust) (r []*TraceTimeline, err error)
94 // Fetch trace summaries for the given trace ids.
95 //
96 // Second argument is a list of methods of adjusting the trace
97 // data before returning it. Can be empty.
98 //
99 // Note that if one of the trace ids does not have any data associated with it, it will not be
100 // represented in the output list.
101 //
102 // Parameters:
103 // - TraceIds
104 // - Adjust
105 GetTraceSummariesByIds(trace_ids []int64, adjust []Adjust) (r []*TraceSummary, err error)
106 // Not content with just one of traces, summaries or timelines? Want it all? This is the method for you.
107 //
108 // Parameters:
109 // - TraceIds
110 // - Adjust
111 GetTraceCombosByIds(trace_ids []int64, adjust []Adjust) (r []*TraceCombo, err error)
112 // Fetch all the service names we have seen from now all the way back to the set ttl.
113 GetServiceNames() (r map[string]bool, err error)
114 // Get all the seen span names for a particular service, from now back until the set ttl.
115 //
116 // Parameters:
117 // - ServiceName
118 GetSpanNames(service_name string) (r map[string]bool, err error)
119 // Change the TTL of a trace. If we find an interesting trace we want to keep around for further
120 // investigation.
121 //
122 // Parameters:
123 // - TraceId
124 // - TtlSeconds
125 SetTraceTimeToLive(trace_id int64, ttl_seconds int32) (err error)
126 // Get the TTL in seconds of a specific trace.
127 //
128 // Parameters:
129 // - TraceId
130 GetTraceTimeToLive(trace_id int64) (r int32, err error)
131 // Get the data ttl. This is the number of seconds we keep the data around before deleting it.
132 GetDataTimeToLive() (r int32, err error)
133 // Get an aggregate representation of all services paired with every service they call in to.
134 // This includes information on call counts and mean/stdDev/etc of call durations. The two arguments
135 // specify epoch time in microseconds. The end time is optional and defaults to one day after the
136 // start time.
137 //
138 // Parameters:
139 // - StartTime
140 // - EndTime
141 GetDependencies(start_time int64, end_time int64) (r *zipkindependencies.Dependencies, err error)
142 // Parameters:
143 // - ServiceName
144 GetTopAnnotations(service_name string) (r []string, err error)
145 // Parameters:
146 // - ServiceName
147 GetTopKeyValueAnnotations(service_name string) (r []string, err error)
148 // Given a time stamp, server service name, and rpc name, fetch all of the client services calling in paired
149 // with the lists of every span duration (list<i64>) from the server to client. The lists of span durations
150 // include information on call counts and mean/stdDev/etc of call durations.
151 //
152 // The three arguments specify epoch time in microseconds, server side service name and rpc name. The return maps
153 // contains the key - client_service_name and value - list<span_durations>.
154 //
155 // Parameters:
156 // - TimeStamp
157 // - ServiceName
158 // - RpcName
159 GetSpanDurations(time_stamp int64, service_name string, rpc_name string) (r map[string][]int64, err error)
160 // Given a time stamp, server service name, and rpc name, fetch all of the client services calling in paired
161 // with the lists of every trace Ids (list<i64>) from the server to client.
162 //
163 // The three arguments specify epoch time in microseconds, server side service name and rpc name. The return maps
164 // contains the key - client_service_name and value - list<trace_id>.
165 //
166 // Parameters:
167 // - TimeStamp
168 // - ServiceName
169 // - RpcName
170 GetServiceNamesToTraceIds(time_stamp int64, service_name string, rpc_name string) (r map[string][]int64, err error)
171 }
172
173 type ZipkinQueryClient struct {
174 Transport thrift.TTransport
175 ProtocolFactory thrift.TProtocolFactory
176 InputProtocol thrift.TProtocol
177 OutputProtocol thrift.TProtocol
178 SeqId int32
179 }
180
181 func NewZipkinQueryClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ZipkinQueryClient {
182 return &ZipkinQueryClient{Transport: t,
183 ProtocolFactory: f,
184 InputProtocol: f.GetProtocol(t),
185 OutputProtocol: f.GetProtocol(t),
186 SeqId: 0,
187 }
188 }
189
190 func NewZipkinQueryClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ZipkinQueryClient {
191 return &ZipkinQueryClient{Transport: t,
192 ProtocolFactory: nil,
193 InputProtocol: iprot,
194 OutputProtocol: oprot,
195 SeqId: 0,
196 }
197 }
198
199 // Parameters:
200 // - Request
201 func (p *ZipkinQueryClient) GetTraceIds(request *QueryRequest) (r *QueryResponse, err error) {
202 if err = p.sendGetTraceIds(request); err != nil {
203 return
204 }
205 return p.recvGetTraceIds()
206 }
207
208 func (p *ZipkinQueryClient) sendGetTraceIds(request *QueryRequest) (err error) {
209 oprot := p.OutputProtocol
210 if oprot == nil {
211 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
212 p.OutputProtocol = oprot
213 }
214 p.SeqId++
215 if err = oprot.WriteMessageBegin("getTraceIds", thrift.CALL, p.SeqId); err != nil {
216 return
217 }
218 args := GetTraceIdsArgs{
219 Request: request,
220 }
221 if err = args.Write(oprot); err != nil {
222 return
223 }
224 if err = oprot.WriteMessageEnd(); err != nil {
225 return
226 }
227 return oprot.Flush()
228 }
229
230 func (p *ZipkinQueryClient) recvGetTraceIds() (value *QueryResponse, err error) {
231 iprot := p.InputProtocol
232 if iprot == nil {
233 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
234 p.InputProtocol = iprot
235 }
236 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
237 if err != nil {
238 return
239 }
240 if mTypeId == thrift.EXCEPTION {
241 error10 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
242 var error11 error
243 error11, err = error10.Read(iprot)
244 if err != nil {
245 return
246 }
247 if err = iprot.ReadMessageEnd(); err != nil {
248 return
249 }
250 err = error11
251 return
252 }
253 if p.SeqId != seqId {
254 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTraceIds failed: out of sequence response")
255 return
256 }
257 result := GetTraceIdsResult{}
258 if err = result.Read(iprot); err != nil {
259 return
260 }
261 if err = iprot.ReadMessageEnd(); err != nil {
262 return
263 }
264 if result.Qe != nil {
265 err = result.Qe
266 return
267 }
268 value = result.GetSuccess()
269 return
270 }
271
272 // Fetch trace ids by service and span name.
273 // Gets "limit" number of entries from before the "end_ts".
274 //
275 // Span name is optional.
276 // Timestamps are in microseconds.
277 //
278 // Parameters:
279 // - ServiceName
280 // - SpanName
281 // - EndTs
282 // - Limit
283 // - Order
284 func (p *ZipkinQueryClient) GetTraceIdsBySpanName(service_name string, span_name string, end_ts int64, limit int32, order Order) (r []int64, err error) {
285 if err = p.sendGetTraceIdsBySpanName(service_name, span_name, end_ts, limit, order); err != nil {
286 return
287 }
288 return p.recvGetTraceIdsBySpanName()
289 }
290
291 func (p *ZipkinQueryClient) sendGetTraceIdsBySpanName(service_name string, span_name string, end_ts int64, limit int32, order Order) (err error) {
292 oprot := p.OutputProtocol
293 if oprot == nil {
294 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
295 p.OutputProtocol = oprot
296 }
297 p.SeqId++
298 if err = oprot.WriteMessageBegin("getTraceIdsBySpanName", thrift.CALL, p.SeqId); err != nil {
299 return
300 }
301 args := GetTraceIdsBySpanNameArgs{
302 ServiceName: service_name,
303 SpanName: span_name,
304 EndTs: end_ts,
305 Limit: limit,
306 Order: order,
307 }
308 if err = args.Write(oprot); err != nil {
309 return
310 }
311 if err = oprot.WriteMessageEnd(); err != nil {
312 return
313 }
314 return oprot.Flush()
315 }
316
317 func (p *ZipkinQueryClient) recvGetTraceIdsBySpanName() (value []int64, err error) {
318 iprot := p.InputProtocol
319 if iprot == nil {
320 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
321 p.InputProtocol = iprot
322 }
323 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
324 if err != nil {
325 return
326 }
327 if mTypeId == thrift.EXCEPTION {
328 error12 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
329 var error13 error
330 error13, err = error12.Read(iprot)
331 if err != nil {
332 return
333 }
334 if err = iprot.ReadMessageEnd(); err != nil {
335 return
336 }
337 err = error13
338 return
339 }
340 if p.SeqId != seqId {
341 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTraceIdsBySpanName failed: out of sequence response")
342 return
343 }
344 result := GetTraceIdsBySpanNameResult{}
345 if err = result.Read(iprot); err != nil {
346 return
347 }
348 if err = iprot.ReadMessageEnd(); err != nil {
349 return
350 }
351 if result.Qe != nil {
352 err = result.Qe
353 return
354 }
355 value = result.GetSuccess()
356 return
357 }
358
359 // Fetch trace ids by service name.
360 // Gets "limit" number of entries from before the "end_ts".
361 //
362 // Timestamps are in microseconds.
363 //
364 // Parameters:
365 // - ServiceName
366 // - EndTs
367 // - Limit
368 // - Order
369 func (p *ZipkinQueryClient) GetTraceIdsByServiceName(service_name string, end_ts int64, limit int32, order Order) (r []int64, err error) {
370 if err = p.sendGetTraceIdsByServiceName(service_name, end_ts, limit, order); err != nil {
371 return
372 }
373 return p.recvGetTraceIdsByServiceName()
374 }
375
376 func (p *ZipkinQueryClient) sendGetTraceIdsByServiceName(service_name string, end_ts int64, limit int32, order Order) (err error) {
377 oprot := p.OutputProtocol
378 if oprot == nil {
379 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
380 p.OutputProtocol = oprot
381 }
382 p.SeqId++
383 if err = oprot.WriteMessageBegin("getTraceIdsByServiceName", thrift.CALL, p.SeqId); err != nil {
384 return
385 }
386 args := GetTraceIdsByServiceNameArgs{
387 ServiceName: service_name,
388 EndTs: end_ts,
389 Limit: limit,
390 Order: order,
391 }
392 if err = args.Write(oprot); err != nil {
393 return
394 }
395 if err = oprot.WriteMessageEnd(); err != nil {
396 return
397 }
398 return oprot.Flush()
399 }
400
401 func (p *ZipkinQueryClient) recvGetTraceIdsByServiceName() (value []int64, err error) {
402 iprot := p.InputProtocol
403 if iprot == nil {
404 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
405 p.InputProtocol = iprot
406 }
407 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
408 if err != nil {
409 return
410 }
411 if mTypeId == thrift.EXCEPTION {
412 error14 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
413 var error15 error
414 error15, err = error14.Read(iprot)
415 if err != nil {
416 return
417 }
418 if err = iprot.ReadMessageEnd(); err != nil {
419 return
420 }
421 err = error15
422 return
423 }
424 if p.SeqId != seqId {
425 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTraceIdsByServiceName failed: out of sequence response")
426 return
427 }
428 result := GetTraceIdsByServiceNameResult{}
429 if err = result.Read(iprot); err != nil {
430 return
431 }
432 if err = iprot.ReadMessageEnd(); err != nil {
433 return
434 }
435 if result.Qe != nil {
436 err = result.Qe
437 return
438 }
439 value = result.GetSuccess()
440 return
441 }
442
443 // Fetch trace ids with a particular annotation.
444 // Gets "limit" number of entries from before the "end_ts".
445 //
446 // When requesting based on time based annotations only pass in the first parameter, "annotation" and leave out
447 // the second "value". If looking for a key-value binary annotation provide both, "annotation" is then the
448 // key in the key-value.
449 //
450 // Timestamps are in microseconds.
451 //
452 // Parameters:
453 // - ServiceName
454 // - Annotation
455 // - Value
456 // - EndTs
457 // - Limit
458 // - Order
459 func (p *ZipkinQueryClient) GetTraceIdsByAnnotation(service_name string, annotation string, value []byte, end_ts int64, limit int32, order Order) (r []int64, err error) {
460 if err = p.sendGetTraceIdsByAnnotation(service_name, annotation, value, end_ts, limit, order); err != nil {
461 return
462 }
463 return p.recvGetTraceIdsByAnnotation()
464 }
465
466 func (p *ZipkinQueryClient) sendGetTraceIdsByAnnotation(service_name string, annotation string, value []byte, end_ts int64, limit int32, order Order) (err error) {
467 oprot := p.OutputProtocol
468 if oprot == nil {
469 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
470 p.OutputProtocol = oprot
471 }
472 p.SeqId++
473 if err = oprot.WriteMessageBegin("getTraceIdsByAnnotation", thrift.CALL, p.SeqId); err != nil {
474 return
475 }
476 args := GetTraceIdsByAnnotationArgs{
477 ServiceName: service_name,
478 Annotation: annotation,
479 Value: value,
480 EndTs: end_ts,
481 Limit: limit,
482 Order: order,
483 }
484 if err = args.Write(oprot); err != nil {
485 return
486 }
487 if err = oprot.WriteMessageEnd(); err != nil {
488 return
489 }
490 return oprot.Flush()
491 }
492
493 func (p *ZipkinQueryClient) recvGetTraceIdsByAnnotation() (value []int64, err error) {
494 iprot := p.InputProtocol
495 if iprot == nil {
496 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
497 p.InputProtocol = iprot
498 }
499 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
500 if err != nil {
501 return
502 }
503 if mTypeId == thrift.EXCEPTION {
504 error16 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
505 var error17 error
506 error17, err = error16.Read(iprot)
507 if err != nil {
508 return
509 }
510 if err = iprot.ReadMessageEnd(); err != nil {
511 return
512 }
513 err = error17
514 return
515 }
516 if p.SeqId != seqId {
517 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTraceIdsByAnnotation failed: out of sequence response")
518 return
519 }
520 result := GetTraceIdsByAnnotationResult{}
521 if err = result.Read(iprot); err != nil {
522 return
523 }
524 if err = iprot.ReadMessageEnd(); err != nil {
525 return
526 }
527 if result.Qe != nil {
528 err = result.Qe
529 return
530 }
531 value = result.GetSuccess()
532 return
533 }
534
535 // Get the traces that are in the database from the given list of trace ids.
536 //
537 // Parameters:
538 // - TraceIds
539 func (p *ZipkinQueryClient) TracesExist(trace_ids []int64) (r map[int64]bool, err error) {
540 if err = p.sendTracesExist(trace_ids); err != nil {
541 return
542 }
543 return p.recvTracesExist()
544 }
545
546 func (p *ZipkinQueryClient) sendTracesExist(trace_ids []int64) (err error) {
547 oprot := p.OutputProtocol
548 if oprot == nil {
549 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
550 p.OutputProtocol = oprot
551 }
552 p.SeqId++
553 if err = oprot.WriteMessageBegin("tracesExist", thrift.CALL, p.SeqId); err != nil {
554 return
555 }
556 args := TracesExistArgs{
557 TraceIds: trace_ids,
558 }
559 if err = args.Write(oprot); err != nil {
560 return
561 }
562 if err = oprot.WriteMessageEnd(); err != nil {
563 return
564 }
565 return oprot.Flush()
566 }
567
568 func (p *ZipkinQueryClient) recvTracesExist() (value map[int64]bool, err error) {
569 iprot := p.InputProtocol
570 if iprot == nil {
571 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
572 p.InputProtocol = iprot
573 }
574 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
575 if err != nil {
576 return
577 }
578 if mTypeId == thrift.EXCEPTION {
579 error18 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
580 var error19 error
581 error19, err = error18.Read(iprot)
582 if err != nil {
583 return
584 }
585 if err = iprot.ReadMessageEnd(); err != nil {
586 return
587 }
588 err = error19
589 return
590 }
591 if p.SeqId != seqId {
592 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "tracesExist failed: out of sequence response")
593 return
594 }
595 result := TracesExistResult{}
596 if err = result.Read(iprot); err != nil {
597 return
598 }
599 if err = iprot.ReadMessageEnd(); err != nil {
600 return
601 }
602 if result.Qe != nil {
603 err = result.Qe
604 return
605 }
606 value = result.GetSuccess()
607 return
608 }
609
610 // Get the full traces associated with the given trace ids.
611 //
612 // Second argument is a list of methods of adjusting the trace
613 // data before returning it. Can be empty.
614 //
615 // Parameters:
616 // - TraceIds
617 // - Adjust
618 func (p *ZipkinQueryClient) GetTracesByIds(trace_ids []int64, adjust []Adjust) (r []*Trace, err error) {
619 if err = p.sendGetTracesByIds(trace_ids, adjust); err != nil {
620 return
621 }
622 return p.recvGetTracesByIds()
623 }
624
625 func (p *ZipkinQueryClient) sendGetTracesByIds(trace_ids []int64, adjust []Adjust) (err error) {
626 oprot := p.OutputProtocol
627 if oprot == nil {
628 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
629 p.OutputProtocol = oprot
630 }
631 p.SeqId++
632 if err = oprot.WriteMessageBegin("getTracesByIds", thrift.CALL, p.SeqId); err != nil {
633 return
634 }
635 args := GetTracesByIdsArgs{
636 TraceIds: trace_ids,
637 Adjust: adjust,
638 }
639 if err = args.Write(oprot); err != nil {
640 return
641 }
642 if err = oprot.WriteMessageEnd(); err != nil {
643 return
644 }
645 return oprot.Flush()
646 }
647
648 func (p *ZipkinQueryClient) recvGetTracesByIds() (value []*Trace, err error) {
649 iprot := p.InputProtocol
650 if iprot == nil {
651 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
652 p.InputProtocol = iprot
653 }
654 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
655 if err != nil {
656 return
657 }
658 if mTypeId == thrift.EXCEPTION {
659 error20 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
660 var error21 error
661 error21, err = error20.Read(iprot)
662 if err != nil {
663 return
664 }
665 if err = iprot.ReadMessageEnd(); err != nil {
666 return
667 }
668 err = error21
669 return
670 }
671 if p.SeqId != seqId {
672 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTracesByIds failed: out of sequence response")
673 return
674 }
675 result := GetTracesByIdsResult{}
676 if err = result.Read(iprot); err != nil {
677 return
678 }
679 if err = iprot.ReadMessageEnd(); err != nil {
680 return
681 }
682 if result.Qe != nil {
683 err = result.Qe
684 return
685 }
686 value = result.GetSuccess()
687 return
688 }
689
690 // Get the trace timelines associated with the given trace ids.
691 // This is a convenience method for users that just want to know
692 // the annotations and the (assumed) order they happened in.
693 //
694 // Second argument is a list of methods of adjusting the trace
695 // data before returning it. Can be empty.
696 //
697 // Note that if one of the trace ids does not have any data associated with it, it will not be
698 // represented in the output list.
699 //
700 // Parameters:
701 // - TraceIds
702 // - Adjust
703 func (p *ZipkinQueryClient) GetTraceTimelinesByIds(trace_ids []int64, adjust []Adjust) (r []*TraceTimeline, err error) {
704 if err = p.sendGetTraceTimelinesByIds(trace_ids, adjust); err != nil {
705 return
706 }
707 return p.recvGetTraceTimelinesByIds()
708 }
709
710 func (p *ZipkinQueryClient) sendGetTraceTimelinesByIds(trace_ids []int64, adjust []Adjust) (err error) {
711 oprot := p.OutputProtocol
712 if oprot == nil {
713 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
714 p.OutputProtocol = oprot
715 }
716 p.SeqId++
717 if err = oprot.WriteMessageBegin("getTraceTimelinesByIds", thrift.CALL, p.SeqId); err != nil {
718 return
719 }
720 args := GetTraceTimelinesByIdsArgs{
721 TraceIds: trace_ids,
722 Adjust: adjust,
723 }
724 if err = args.Write(oprot); err != nil {
725 return
726 }
727 if err = oprot.WriteMessageEnd(); err != nil {
728 return
729 }
730 return oprot.Flush()
731 }
732
733 func (p *ZipkinQueryClient) recvGetTraceTimelinesByIds() (value []*TraceTimeline, err error) {
734 iprot := p.InputProtocol
735 if iprot == nil {
736 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
737 p.InputProtocol = iprot
738 }
739 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
740 if err != nil {
741 return
742 }
743 if mTypeId == thrift.EXCEPTION {
744 error22 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
745 var error23 error
746 error23, err = error22.Read(iprot)
747 if err != nil {
748 return
749 }
750 if err = iprot.ReadMessageEnd(); err != nil {
751 return
752 }
753 err = error23
754 return
755 }
756 if p.SeqId != seqId {
757 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTraceTimelinesByIds failed: out of sequence response")
758 return
759 }
760 result := GetTraceTimelinesByIdsResult{}
761 if err = result.Read(iprot); err != nil {
762 return
763 }
764 if err = iprot.ReadMessageEnd(); err != nil {
765 return
766 }
767 if result.Qe != nil {
768 err = result.Qe
769 return
770 }
771 value = result.GetSuccess()
772 return
773 }
774
775 // Fetch trace summaries for the given trace ids.
776 //
777 // Second argument is a list of methods of adjusting the trace
778 // data before returning it. Can be empty.
779 //
780 // Note that if one of the trace ids does not have any data associated with it, it will not be
781 // represented in the output list.
782 //
783 // Parameters:
784 // - TraceIds
785 // - Adjust
786 func (p *ZipkinQueryClient) GetTraceSummariesByIds(trace_ids []int64, adjust []Adjust) (r []*TraceSummary, err error) {
787 if err = p.sendGetTraceSummariesByIds(trace_ids, adjust); err != nil {
788 return
789 }
790 return p.recvGetTraceSummariesByIds()
791 }
792
793 func (p *ZipkinQueryClient) sendGetTraceSummariesByIds(trace_ids []int64, adjust []Adjust) (err error) {
794 oprot := p.OutputProtocol
795 if oprot == nil {
796 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
797 p.OutputProtocol = oprot
798 }
799 p.SeqId++
800 if err = oprot.WriteMessageBegin("getTraceSummariesByIds", thrift.CALL, p.SeqId); err != nil {
801 return
802 }
803 args := GetTraceSummariesByIdsArgs{
804 TraceIds: trace_ids,
805 Adjust: adjust,
806 }
807 if err = args.Write(oprot); err != nil {
808 return
809 }
810 if err = oprot.WriteMessageEnd(); err != nil {
811 return
812 }
813 return oprot.Flush()
814 }
815
816 func (p *ZipkinQueryClient) recvGetTraceSummariesByIds() (value []*TraceSummary, err error) {
817 iprot := p.InputProtocol
818 if iprot == nil {
819 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
820 p.InputProtocol = iprot
821 }
822 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
823 if err != nil {
824 return
825 }
826 if mTypeId == thrift.EXCEPTION {
827 error24 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
828 var error25 error
829 error25, err = error24.Read(iprot)
830 if err != nil {
831 return
832 }
833 if err = iprot.ReadMessageEnd(); err != nil {
834 return
835 }
836 err = error25
837 return
838 }
839 if p.SeqId != seqId {
840 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTraceSummariesByIds failed: out of sequence response")
841 return
842 }
843 result := GetTraceSummariesByIdsResult{}
844 if err = result.Read(iprot); err != nil {
845 return
846 }
847 if err = iprot.ReadMessageEnd(); err != nil {
848 return
849 }
850 if result.Qe != nil {
851 err = result.Qe
852 return
853 }
854 value = result.GetSuccess()
855 return
856 }
857
858 // Not content with just one of traces, summaries or timelines? Want it all? This is the method for you.
859 //
860 // Parameters:
861 // - TraceIds
862 // - Adjust
863 func (p *ZipkinQueryClient) GetTraceCombosByIds(trace_ids []int64, adjust []Adjust) (r []*TraceCombo, err error) {
864 if err = p.sendGetTraceCombosByIds(trace_ids, adjust); err != nil {
865 return
866 }
867 return p.recvGetTraceCombosByIds()
868 }
869
870 func (p *ZipkinQueryClient) sendGetTraceCombosByIds(trace_ids []int64, adjust []Adjust) (err error) {
871 oprot := p.OutputProtocol
872 if oprot == nil {
873 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
874 p.OutputProtocol = oprot
875 }
876 p.SeqId++
877 if err = oprot.WriteMessageBegin("getTraceCombosByIds", thrift.CALL, p.SeqId); err != nil {
878 return
879 }
880 args := GetTraceCombosByIdsArgs{
881 TraceIds: trace_ids,
882 Adjust: adjust,
883 }
884 if err = args.Write(oprot); err != nil {
885 return
886 }
887 if err = oprot.WriteMessageEnd(); err != nil {
888 return
889 }
890 return oprot.Flush()
891 }
892
893 func (p *ZipkinQueryClient) recvGetTraceCombosByIds() (value []*TraceCombo, err error) {
894 iprot := p.InputProtocol
895 if iprot == nil {
896 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
897 p.InputProtocol = iprot
898 }
899 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
900 if err != nil {
901 return
902 }
903 if mTypeId == thrift.EXCEPTION {
904 error26 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
905 var error27 error
906 error27, err = error26.Read(iprot)
907 if err != nil {
908 return
909 }
910 if err = iprot.ReadMessageEnd(); err != nil {
911 return
912 }
913 err = error27
914 return
915 }
916 if p.SeqId != seqId {
917 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTraceCombosByIds failed: out of sequence response")
918 return
919 }
920 result := GetTraceCombosByIdsResult{}
921 if err = result.Read(iprot); err != nil {
922 return
923 }
924 if err = iprot.ReadMessageEnd(); err != nil {
925 return
926 }
927 if result.Qe != nil {
928 err = result.Qe
929 return
930 }
931 value = result.GetSuccess()
932 return
933 }
934
935 // Fetch all the service names we have seen from now all the way back to the set ttl.
936 func (p *ZipkinQueryClient) GetServiceNames() (r map[string]bool, err error) {
937 if err = p.sendGetServiceNames(); err != nil {
938 return
939 }
940 return p.recvGetServiceNames()
941 }
942
943 func (p *ZipkinQueryClient) sendGetServiceNames() (err error) {
944 oprot := p.OutputProtocol
945 if oprot == nil {
946 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
947 p.OutputProtocol = oprot
948 }
949 p.SeqId++
950 if err = oprot.WriteMessageBegin("getServiceNames", thrift.CALL, p.SeqId); err != nil {
951 return
952 }
953 args := GetServiceNamesArgs{}
954 if err = args.Write(oprot); err != nil {
955 return
956 }
957 if err = oprot.WriteMessageEnd(); err != nil {
958 return
959 }
960 return oprot.Flush()
961 }
962
963 func (p *ZipkinQueryClient) recvGetServiceNames() (value map[string]bool, err error) {
964 iprot := p.InputProtocol
965 if iprot == nil {
966 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
967 p.InputProtocol = iprot
968 }
969 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
970 if err != nil {
971 return
972 }
973 if mTypeId == thrift.EXCEPTION {
974 error28 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
975 var error29 error
976 error29, err = error28.Read(iprot)
977 if err != nil {
978 return
979 }
980 if err = iprot.ReadMessageEnd(); err != nil {
981 return
982 }
983 err = error29
984 return
985 }
986 if p.SeqId != seqId {
987 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getServiceNames failed: out of sequence response")
988 return
989 }
990 result := GetServiceNamesResult{}
991 if err = result.Read(iprot); err != nil {
992 return
993 }
994 if err = iprot.ReadMessageEnd(); err != nil {
995 return
996 }
997 if result.Qe != nil {
998 err = result.Qe
999 return
1000 }
1001 value = result.GetSuccess()
1002 return
1003 }
1004
1005 // Get all the seen span names for a particular service, from now back until the set ttl.
1006 //
1007 // Parameters:
1008 // - ServiceName
1009 func (p *ZipkinQueryClient) GetSpanNames(service_name string) (r map[string]bool, err error) {
1010 if err = p.sendGetSpanNames(service_name); err != nil {
1011 return
1012 }
1013 return p.recvGetSpanNames()
1014 }
1015
1016 func (p *ZipkinQueryClient) sendGetSpanNames(service_name string) (err error) {
1017 oprot := p.OutputProtocol
1018 if oprot == nil {
1019 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
1020 p.OutputProtocol = oprot
1021 }
1022 p.SeqId++
1023 if err = oprot.WriteMessageBegin("getSpanNames", thrift.CALL, p.SeqId); err != nil {
1024 return
1025 }
1026 args := GetSpanNamesArgs{
1027 ServiceName: service_name,
1028 }
1029 if err = args.Write(oprot); err != nil {
1030 return
1031 }
1032 if err = oprot.WriteMessageEnd(); err != nil {
1033 return
1034 }
1035 return oprot.Flush()
1036 }
1037
1038 func (p *ZipkinQueryClient) recvGetSpanNames() (value map[string]bool, err error) {
1039 iprot := p.InputProtocol
1040 if iprot == nil {
1041 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
1042 p.InputProtocol = iprot
1043 }
1044 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
1045 if err != nil {
1046 return
1047 }
1048 if mTypeId == thrift.EXCEPTION {
1049 error30 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
1050 var error31 error
1051 error31, err = error30.Read(iprot)
1052 if err != nil {
1053 return
1054 }
1055 if err = iprot.ReadMessageEnd(); err != nil {
1056 return
1057 }
1058 err = error31
1059 return
1060 }
1061 if p.SeqId != seqId {
1062 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getSpanNames failed: out of sequence response")
1063 return
1064 }
1065 result := GetSpanNamesResult{}
1066 if err = result.Read(iprot); err != nil {
1067 return
1068 }
1069 if err = iprot.ReadMessageEnd(); err != nil {
1070 return
1071 }
1072 if result.Qe != nil {
1073 err = result.Qe
1074 return
1075 }
1076 value = result.GetSuccess()
1077 return
1078 }
1079
1080 // Change the TTL of a trace. If we find an interesting trace we want to keep around for further
1081 // investigation.
1082 //
1083 // Parameters:
1084 // - TraceId
1085 // - TtlSeconds
1086 func (p *ZipkinQueryClient) SetTraceTimeToLive(trace_id int64, ttl_seconds int32) (err error) {
1087 if err = p.sendSetTraceTimeToLive(trace_id, ttl_seconds); err != nil {
1088 return
1089 }
1090 return p.recvSetTraceTimeToLive()
1091 }
1092
1093 func (p *ZipkinQueryClient) sendSetTraceTimeToLive(trace_id int64, ttl_seconds int32) (err error) {
1094 oprot := p.OutputProtocol
1095 if oprot == nil {
1096 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
1097 p.OutputProtocol = oprot
1098 }
1099 p.SeqId++
1100 if err = oprot.WriteMessageBegin("setTraceTimeToLive", thrift.CALL, p.SeqId); err != nil {
1101 return
1102 }
1103 args := SetTraceTimeToLiveArgs{
1104 TraceId: trace_id,
1105 TtlSeconds: ttl_seconds,
1106 }
1107 if err = args.Write(oprot); err != nil {
1108 return
1109 }
1110 if err = oprot.WriteMessageEnd(); err != nil {
1111 return
1112 }
1113 return oprot.Flush()
1114 }
1115
1116 func (p *ZipkinQueryClient) recvSetTraceTimeToLive() (err error) {
1117 iprot := p.InputProtocol
1118 if iprot == nil {
1119 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
1120 p.InputProtocol = iprot
1121 }
1122 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
1123 if err != nil {
1124 return
1125 }
1126 if mTypeId == thrift.EXCEPTION {
1127 error32 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
1128 var error33 error
1129 error33, err = error32.Read(iprot)
1130 if err != nil {
1131 return
1132 }
1133 if err = iprot.ReadMessageEnd(); err != nil {
1134 return
1135 }
1136 err = error33
1137 return
1138 }
1139 if p.SeqId != seqId {
1140 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "setTraceTimeToLive failed: out of sequence response")
1141 return
1142 }
1143 result := SetTraceTimeToLiveResult{}
1144 if err = result.Read(iprot); err != nil {
1145 return
1146 }
1147 if err = iprot.ReadMessageEnd(); err != nil {
1148 return
1149 }
1150 if result.Qe != nil {
1151 err = result.Qe
1152 return
1153 }
1154 return
1155 }
1156
1157 // Get the TTL in seconds of a specific trace.
1158 //
1159 // Parameters:
1160 // - TraceId
1161 func (p *ZipkinQueryClient) GetTraceTimeToLive(trace_id int64) (r int32, err error) {
1162 if err = p.sendGetTraceTimeToLive(trace_id); err != nil {
1163 return
1164 }
1165 return p.recvGetTraceTimeToLive()
1166 }
1167
1168 func (p *ZipkinQueryClient) sendGetTraceTimeToLive(trace_id int64) (err error) {
1169 oprot := p.OutputProtocol
1170 if oprot == nil {
1171 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
1172 p.OutputProtocol = oprot
1173 }
1174 p.SeqId++
1175 if err = oprot.WriteMessageBegin("getTraceTimeToLive", thrift.CALL, p.SeqId); err != nil {
1176 return
1177 }
1178 args := GetTraceTimeToLiveArgs{
1179 TraceId: trace_id,
1180 }
1181 if err = args.Write(oprot); err != nil {
1182 return
1183 }
1184 if err = oprot.WriteMessageEnd(); err != nil {
1185 return
1186 }
1187 return oprot.Flush()
1188 }
1189
1190 func (p *ZipkinQueryClient) recvGetTraceTimeToLive() (value int32, err error) {
1191 iprot := p.InputProtocol
1192 if iprot == nil {
1193 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
1194 p.InputProtocol = iprot
1195 }
1196 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
1197 if err != nil {
1198 return
1199 }
1200 if mTypeId == thrift.EXCEPTION {
1201 error34 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
1202 var error35 error
1203 error35, err = error34.Read(iprot)
1204 if err != nil {
1205 return
1206 }
1207 if err = iprot.ReadMessageEnd(); err != nil {
1208 return
1209 }
1210 err = error35
1211 return
1212 }
1213 if p.SeqId != seqId {
1214 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTraceTimeToLive failed: out of sequence response")
1215 return
1216 }
1217 result := GetTraceTimeToLiveResult{}
1218 if err = result.Read(iprot); err != nil {
1219 return
1220 }
1221 if err = iprot.ReadMessageEnd(); err != nil {
1222 return
1223 }
1224 if result.Qe != nil {
1225 err = result.Qe
1226 return
1227 }
1228 value = result.GetSuccess()
1229 return
1230 }
1231
1232 // Get the data ttl. This is the number of seconds we keep the data around before deleting it.
1233 func (p *ZipkinQueryClient) GetDataTimeToLive() (r int32, err error) {
1234 if err = p.sendGetDataTimeToLive(); err != nil {
1235 return
1236 }
1237 return p.recvGetDataTimeToLive()
1238 }
1239
1240 func (p *ZipkinQueryClient) sendGetDataTimeToLive() (err error) {
1241 oprot := p.OutputProtocol
1242 if oprot == nil {
1243 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
1244 p.OutputProtocol = oprot
1245 }
1246 p.SeqId++
1247 if err = oprot.WriteMessageBegin("getDataTimeToLive", thrift.CALL, p.SeqId); err != nil {
1248 return
1249 }
1250 args := GetDataTimeToLiveArgs{}
1251 if err = args.Write(oprot); err != nil {
1252 return
1253 }
1254 if err = oprot.WriteMessageEnd(); err != nil {
1255 return
1256 }
1257 return oprot.Flush()
1258 }
1259
1260 func (p *ZipkinQueryClient) recvGetDataTimeToLive() (value int32, err error) {
1261 iprot := p.InputProtocol
1262 if iprot == nil {
1263 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
1264 p.InputProtocol = iprot
1265 }
1266 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
1267 if err != nil {
1268 return
1269 }
1270 if mTypeId == thrift.EXCEPTION {
1271 error36 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
1272 var error37 error
1273 error37, err = error36.Read(iprot)
1274 if err != nil {
1275 return
1276 }
1277 if err = iprot.ReadMessageEnd(); err != nil {
1278 return
1279 }
1280 err = error37
1281 return
1282 }
1283 if p.SeqId != seqId {
1284 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getDataTimeToLive failed: out of sequence response")
1285 return
1286 }
1287 result := GetDataTimeToLiveResult{}
1288 if err = result.Read(iprot); err != nil {
1289 return
1290 }
1291 if err = iprot.ReadMessageEnd(); err != nil {
1292 return
1293 }
1294 if result.Qe != nil {
1295 err = result.Qe
1296 return
1297 }
1298 value = result.GetSuccess()
1299 return
1300 }
1301
1302 // Get an aggregate representation of all services paired with every service they call in to.
1303 // This includes information on call counts and mean/stdDev/etc of call durations. The two arguments
1304 // specify epoch time in microseconds. The end time is optional and defaults to one day after the
1305 // start time.
1306 //
1307 // Parameters:
1308 // - StartTime
1309 // - EndTime
1310 func (p *ZipkinQueryClient) GetDependencies(start_time int64, end_time int64) (r *zipkindependencies.Dependencies, err error) {
1311 if err = p.sendGetDependencies(start_time, end_time); err != nil {
1312 return
1313 }
1314 return p.recvGetDependencies()
1315 }
1316
1317 func (p *ZipkinQueryClient) sendGetDependencies(start_time int64, end_time int64) (err error) {
1318 oprot := p.OutputProtocol
1319 if oprot == nil {
1320 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
1321 p.OutputProtocol = oprot
1322 }
1323 p.SeqId++
1324 if err = oprot.WriteMessageBegin("getDependencies", thrift.CALL, p.SeqId); err != nil {
1325 return
1326 }
1327 args := GetDependenciesArgs{
1328 StartTime: start_time,
1329 EndTime: end_time,
1330 }
1331 if err = args.Write(oprot); err != nil {
1332 return
1333 }
1334 if err = oprot.WriteMessageEnd(); err != nil {
1335 return
1336 }
1337 return oprot.Flush()
1338 }
1339
1340 func (p *ZipkinQueryClient) recvGetDependencies() (value *zipkindependencies.Dependencies, err error) {
1341 iprot := p.InputProtocol
1342 if iprot == nil {
1343 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
1344 p.InputProtocol = iprot
1345 }
1346 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
1347 if err != nil {
1348 return
1349 }
1350 if mTypeId == thrift.EXCEPTION {
1351 error38 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
1352 var error39 error
1353 error39, err = error38.Read(iprot)
1354 if err != nil {
1355 return
1356 }
1357 if err = iprot.ReadMessageEnd(); err != nil {
1358 return
1359 }
1360 err = error39
1361 return
1362 }
1363 if p.SeqId != seqId {
1364 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getDependencies failed: out of sequence response")
1365 return
1366 }
1367 result := GetDependenciesResult{}
1368 if err = result.Read(iprot); err != nil {
1369 return
1370 }
1371 if err = iprot.ReadMessageEnd(); err != nil {
1372 return
1373 }
1374 if result.Qe != nil {
1375 err = result.Qe
1376 return
1377 }
1378 value = result.GetSuccess()
1379 return
1380 }
1381
1382 // Parameters:
1383 // - ServiceName
1384 func (p *ZipkinQueryClient) GetTopAnnotations(service_name string) (r []string, err error) {
1385 if err = p.sendGetTopAnnotations(service_name); err != nil {
1386 return
1387 }
1388 return p.recvGetTopAnnotations()
1389 }
1390
1391 func (p *ZipkinQueryClient) sendGetTopAnnotations(service_name string) (err error) {
1392 oprot := p.OutputProtocol
1393 if oprot == nil {
1394 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
1395 p.OutputProtocol = oprot
1396 }
1397 p.SeqId++
1398 if err = oprot.WriteMessageBegin("getTopAnnotations", thrift.CALL, p.SeqId); err != nil {
1399 return
1400 }
1401 args := GetTopAnnotationsArgs{
1402 ServiceName: service_name,
1403 }
1404 if err = args.Write(oprot); err != nil {
1405 return
1406 }
1407 if err = oprot.WriteMessageEnd(); err != nil {
1408 return
1409 }
1410 return oprot.Flush()
1411 }
1412
1413 func (p *ZipkinQueryClient) recvGetTopAnnotations() (value []string, err error) {
1414 iprot := p.InputProtocol
1415 if iprot == nil {
1416 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
1417 p.InputProtocol = iprot
1418 }
1419 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
1420 if err != nil {
1421 return
1422 }
1423 if mTypeId == thrift.EXCEPTION {
1424 error40 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
1425 var error41 error
1426 error41, err = error40.Read(iprot)
1427 if err != nil {
1428 return
1429 }
1430 if err = iprot.ReadMessageEnd(); err != nil {
1431 return
1432 }
1433 err = error41
1434 return
1435 }
1436 if p.SeqId != seqId {
1437 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTopAnnotations failed: out of sequence response")
1438 return
1439 }
1440 result := GetTopAnnotationsResult{}
1441 if err = result.Read(iprot); err != nil {
1442 return
1443 }
1444 if err = iprot.ReadMessageEnd(); err != nil {
1445 return
1446 }
1447 if result.Qe != nil {
1448 err = result.Qe
1449 return
1450 }
1451 value = result.GetSuccess()
1452 return
1453 }
1454
1455 // Parameters:
1456 // - ServiceName
1457 func (p *ZipkinQueryClient) GetTopKeyValueAnnotations(service_name string) (r []string, err error) {
1458 if err = p.sendGetTopKeyValueAnnotations(service_name); err != nil {
1459 return
1460 }
1461 return p.recvGetTopKeyValueAnnotations()
1462 }
1463
1464 func (p *ZipkinQueryClient) sendGetTopKeyValueAnnotations(service_name string) (err error) {
1465 oprot := p.OutputProtocol
1466 if oprot == nil {
1467 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
1468 p.OutputProtocol = oprot
1469 }
1470 p.SeqId++
1471 if err = oprot.WriteMessageBegin("getTopKeyValueAnnotations", thrift.CALL, p.SeqId); err != nil {
1472 return
1473 }
1474 args := GetTopKeyValueAnnotationsArgs{
1475 ServiceName: service_name,
1476 }
1477 if err = args.Write(oprot); err != nil {
1478 return
1479 }
1480 if err = oprot.WriteMessageEnd(); err != nil {
1481 return
1482 }
1483 return oprot.Flush()
1484 }
1485
1486 func (p *ZipkinQueryClient) recvGetTopKeyValueAnnotations() (value []string, err error) {
1487 iprot := p.InputProtocol
1488 if iprot == nil {
1489 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
1490 p.InputProtocol = iprot
1491 }
1492 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
1493 if err != nil {
1494 return
1495 }
1496 if mTypeId == thrift.EXCEPTION {
1497 error42 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
1498 var error43 error
1499 error43, err = error42.Read(iprot)
1500 if err != nil {
1501 return
1502 }
1503 if err = iprot.ReadMessageEnd(); err != nil {
1504 return
1505 }
1506 err = error43
1507 return
1508 }
1509 if p.SeqId != seqId {
1510 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getTopKeyValueAnnotations failed: out of sequence response")
1511 return
1512 }
1513 result := GetTopKeyValueAnnotationsResult{}
1514 if err = result.Read(iprot); err != nil {
1515 return
1516 }
1517 if err = iprot.ReadMessageEnd(); err != nil {
1518 return
1519 }
1520 if result.Qe != nil {
1521 err = result.Qe
1522 return
1523 }
1524 value = result.GetSuccess()
1525 return
1526 }
1527
1528 // Given a time stamp, server service name, and rpc name, fetch all of the client services calling in paired
1529 // with the lists of every span duration (list<i64>) from the server to client. The lists of span durations
1530 // include information on call counts and mean/stdDev/etc of call durations.
1531 //
1532 // The three arguments specify epoch time in microseconds, server side service name and rpc name. The return maps
1533 // contains the key - client_service_name and value - list<span_durations>.
1534 //
1535 // Parameters:
1536 // - TimeStamp
1537 // - ServiceName
1538 // - RpcName
1539 func (p *ZipkinQueryClient) GetSpanDurations(time_stamp int64, service_name string, rpc_name string) (r map[string][]int64, err error) {
1540 if err = p.sendGetSpanDurations(time_stamp, service_name, rpc_name); err != nil {
1541 return
1542 }
1543 return p.recvGetSpanDurations()
1544 }
1545
1546 func (p *ZipkinQueryClient) sendGetSpanDurations(time_stamp int64, service_name string, rpc_name string) (err error) {
1547 oprot := p.OutputProtocol
1548 if oprot == nil {
1549 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
1550 p.OutputProtocol = oprot
1551 }
1552 p.SeqId++
1553 if err = oprot.WriteMessageBegin("getSpanDurations", thrift.CALL, p.SeqId); err != nil {
1554 return
1555 }
1556 args := GetSpanDurationsArgs{
1557 TimeStamp: time_stamp,
1558 ServiceName: service_name,
1559 RpcName: rpc_name,
1560 }
1561 if err = args.Write(oprot); err != nil {
1562 return
1563 }
1564 if err = oprot.WriteMessageEnd(); err != nil {
1565 return
1566 }
1567 return oprot.Flush()
1568 }
1569
1570 func (p *ZipkinQueryClient) recvGetSpanDurations() (value map[string][]int64, err error) {
1571 iprot := p.InputProtocol
1572 if iprot == nil {
1573 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
1574 p.InputProtocol = iprot
1575 }
1576 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
1577 if err != nil {
1578 return
1579 }
1580 if mTypeId == thrift.EXCEPTION {
1581 error44 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
1582 var error45 error
1583 error45, err = error44.Read(iprot)
1584 if err != nil {
1585 return
1586 }
1587 if err = iprot.ReadMessageEnd(); err != nil {
1588 return
1589 }
1590 err = error45
1591 return
1592 }
1593 if p.SeqId != seqId {
1594 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getSpanDurations failed: out of sequence response")
1595 return
1596 }
1597 result := GetSpanDurationsResult{}
1598 if err = result.Read(iprot); err != nil {
1599 return
1600 }
1601 if err = iprot.ReadMessageEnd(); err != nil {
1602 return
1603 }
1604 value = result.GetSuccess()
1605 return
1606 }
1607
1608 // Given a time stamp, server service name, and rpc name, fetch all of the client services calling in paired
1609 // with the lists of every trace Ids (list<i64>) from the server to client.
1610 //
1611 // The three arguments specify epoch time in microseconds, server side service name and rpc name. The return maps
1612 // contains the key - client_service_name and value - list<trace_id>.
1613 //
1614 // Parameters:
1615 // - TimeStamp
1616 // - ServiceName
1617 // - RpcName
1618 func (p *ZipkinQueryClient) GetServiceNamesToTraceIds(time_stamp int64, service_name string, rpc_name string) (r map[string][]int64, err error) {
1619 if err = p.sendGetServiceNamesToTraceIds(time_stamp, service_name, rpc_name); err != nil {
1620 return
1621 }
1622 return p.recvGetServiceNamesToTraceIds()
1623 }
1624
1625 func (p *ZipkinQueryClient) sendGetServiceNamesToTraceIds(time_stamp int64, service_name string, rpc_name string) (err error) {
1626 oprot := p.OutputProtocol
1627 if oprot == nil {
1628 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
1629 p.OutputProtocol = oprot
1630 }
1631 p.SeqId++
1632 if err = oprot.WriteMessageBegin("getServiceNamesToTraceIds", thrift.CALL, p.SeqId); err != nil {
1633 return
1634 }
1635 args := GetServiceNamesToTraceIdsArgs{
1636 TimeStamp: time_stamp,
1637 ServiceName: service_name,
1638 RpcName: rpc_name,
1639 }
1640 if err = args.Write(oprot); err != nil {
1641 return
1642 }
1643 if err = oprot.WriteMessageEnd(); err != nil {
1644 return
1645 }
1646 return oprot.Flush()
1647 }
1648
1649 func (p *ZipkinQueryClient) recvGetServiceNamesToTraceIds() (value map[string][]int64, err error) {
1650 iprot := p.InputProtocol
1651 if iprot == nil {
1652 iprot = p.ProtocolFactory.GetProtocol(p.Transport)
1653 p.InputProtocol = iprot
1654 }
1655 _, mTypeId, seqId, err := iprot.ReadMessageBegin()
1656 if err != nil {
1657 return
1658 }
1659 if mTypeId == thrift.EXCEPTION {
1660 error46 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
1661 var error47 error
1662 error47, err = error46.Read(iprot)
1663 if err != nil {
1664 return
1665 }
1666 if err = iprot.ReadMessageEnd(); err != nil {
1667 return
1668 }
1669 err = error47
1670 return
1671 }
1672 if p.SeqId != seqId {
1673 err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "getServiceNamesToTraceIds failed: out of sequence response")
1674 return
1675 }
1676 result := GetServiceNamesToTraceIdsResult{}
1677 if err = result.Read(iprot); err != nil {
1678 return
1679 }
1680 if err = iprot.ReadMessageEnd(); err != nil {
1681 return
1682 }
1683 value = result.GetSuccess()
1684 return
1685 }
1686
1687 type ZipkinQueryProcessor struct {
1688 processorMap map[string]thrift.TProcessorFunction
1689 handler ZipkinQuery
1690 }
1691
1692 func (p *ZipkinQueryProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
1693 p.processorMap[key] = processor
1694 }
1695
1696 func (p *ZipkinQueryProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
1697 processor, ok = p.processorMap[key]
1698 return processor, ok
1699 }
1700
1701 func (p *ZipkinQueryProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
1702 return p.processorMap
1703 }
1704
1705 func NewZipkinQueryProcessor(handler ZipkinQuery) *ZipkinQueryProcessor {
1706
1707 self48 := &ZipkinQueryProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
1708 self48.processorMap["getTraceIds"] = &zipkinQueryProcessorGetTraceIds{handler: handler}
1709 self48.processorMap["getTraceIdsBySpanName"] = &zipkinQueryProcessorGetTraceIdsBySpanName{handler: handler}
1710 self48.processorMap["getTraceIdsByServiceName"] = &zipkinQueryProcessorGetTraceIdsByServiceName{handler: handler}
1711 self48.processorMap["getTraceIdsByAnnotation"] = &zipkinQueryProcessorGetTraceIdsByAnnotation{handler: handler}
1712 self48.processorMap["tracesExist"] = &zipkinQueryProcessorTracesExist{handler: handler}
1713 self48.processorMap["getTracesByIds"] = &zipkinQueryProcessorGetTracesByIds{handler: handler}
1714 self48.processorMap["getTraceTimelinesByIds"] = &zipkinQueryProcessorGetTraceTimelinesByIds{handler: handler}
1715 self48.processorMap["getTraceSummariesByIds"] = &zipkinQueryProcessorGetTraceSummariesByIds{handler: handler}
1716 self48.processorMap["getTraceCombosByIds"] = &zipkinQueryProcessorGetTraceCombosByIds{handler: handler}
1717 self48.processorMap["getServiceNames"] = &zipkinQueryProcessorGetServiceNames{handler: handler}
1718 self48.processorMap["getSpanNames"] = &zipkinQueryProcessorGetSpanNames{handler: handler}
1719 self48.processorMap["setTraceTimeToLive"] = &zipkinQueryProcessorSetTraceTimeToLive{handler: handler}
1720 self48.processorMap["getTraceTimeToLive"] = &zipkinQueryProcessorGetTraceTimeToLive{handler: handler}
1721 self48.processorMap["getDataTimeToLive"] = &zipkinQueryProcessorGetDataTimeToLive{handler: handler}
1722 self48.processorMap["getDependencies"] = &zipkinQueryProcessorGetDependencies{handler: handler}
1723 self48.processorMap["getTopAnnotations"] = &zipkinQueryProcessorGetTopAnnotations{handler: handler}
1724 self48.processorMap["getTopKeyValueAnnotations"] = &zipkinQueryProcessorGetTopKeyValueAnnotations{handler: handler}
1725 self48.processorMap["getSpanDurations"] = &zipkinQueryProcessorGetSpanDurations{handler: handler}
1726 self48.processorMap["getServiceNamesToTraceIds"] = &zipkinQueryProcessorGetServiceNamesToTraceIds{handler: handler}
1727 return self48
1728 }
1729
1730 func (p *ZipkinQueryProcessor) Process(iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
1731 name, _, seqId, err := iprot.ReadMessageBegin()
1732 if err != nil {
1733 return false, err
1734 }
1735 if processor, ok := p.GetProcessorFunction(name); ok {
1736 return processor.Process(seqId, iprot, oprot)
1737 }
1738 iprot.Skip(thrift.STRUCT)
1739 iprot.ReadMessageEnd()
1740 x49 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
1741 oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
1742 x49.Write(oprot)
1743 oprot.WriteMessageEnd()
1744 oprot.Flush()
1745 return false, x49
1746
1747 }
1748
1749 type zipkinQueryProcessorGetTraceIds struct {
1750 handler ZipkinQuery
1751 }
1752
1753 func (p *zipkinQueryProcessorGetTraceIds) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
1754 args := GetTraceIdsArgs{}
1755 if err = args.Read(iprot); err != nil {
1756 iprot.ReadMessageEnd()
1757 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
1758 oprot.WriteMessageBegin("getTraceIds", thrift.EXCEPTION, seqId)
1759 x.Write(oprot)
1760 oprot.WriteMessageEnd()
1761 oprot.Flush()
1762 return false, err
1763 }
1764
1765 iprot.ReadMessageEnd()
1766 result := GetTraceIdsResult{}
1767 var retval *QueryResponse
1768 var err2 error
1769 if retval, err2 = p.handler.GetTraceIds(args.Request); err2 != nil {
1770 switch v := err2.(type) {
1771 case *QueryException:
1772 result.Qe = v
1773 default:
1774 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTraceIds: "+err2.Error())
1775 oprot.WriteMessageBegin("getTraceIds", thrift.EXCEPTION, seqId)
1776 x.Write(oprot)
1777 oprot.WriteMessageEnd()
1778 oprot.Flush()
1779 return true, err2
1780 }
1781 } else {
1782 result.Success = retval
1783 }
1784 if err2 = oprot.WriteMessageBegin("getTraceIds", thrift.REPLY, seqId); err2 != nil {
1785 err = err2
1786 }
1787 if err2 = result.Write(oprot); err == nil && err2 != nil {
1788 err = err2
1789 }
1790 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
1791 err = err2
1792 }
1793 if err2 = oprot.Flush(); err == nil && err2 != nil {
1794 err = err2
1795 }
1796 if err != nil {
1797 return
1798 }
1799 return true, err
1800 }
1801
1802 type zipkinQueryProcessorGetTraceIdsBySpanName struct {
1803 handler ZipkinQuery
1804 }
1805
1806 func (p *zipkinQueryProcessorGetTraceIdsBySpanName) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
1807 args := GetTraceIdsBySpanNameArgs{}
1808 if err = args.Read(iprot); err != nil {
1809 iprot.ReadMessageEnd()
1810 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
1811 oprot.WriteMessageBegin("getTraceIdsBySpanName", thrift.EXCEPTION, seqId)
1812 x.Write(oprot)
1813 oprot.WriteMessageEnd()
1814 oprot.Flush()
1815 return false, err
1816 }
1817
1818 iprot.ReadMessageEnd()
1819 result := GetTraceIdsBySpanNameResult{}
1820 var retval []int64
1821 var err2 error
1822 if retval, err2 = p.handler.GetTraceIdsBySpanName(args.ServiceName, args.SpanName, args.EndTs, args.Limit, args.Order); err2 != nil {
1823 switch v := err2.(type) {
1824 case *QueryException:
1825 result.Qe = v
1826 default:
1827 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTraceIdsBySpanName: "+err2.Error())
1828 oprot.WriteMessageBegin("getTraceIdsBySpanName", thrift.EXCEPTION, seqId)
1829 x.Write(oprot)
1830 oprot.WriteMessageEnd()
1831 oprot.Flush()
1832 return true, err2
1833 }
1834 } else {
1835 result.Success = retval
1836 }
1837 if err2 = oprot.WriteMessageBegin("getTraceIdsBySpanName", thrift.REPLY, seqId); err2 != nil {
1838 err = err2
1839 }
1840 if err2 = result.Write(oprot); err == nil && err2 != nil {
1841 err = err2
1842 }
1843 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
1844 err = err2
1845 }
1846 if err2 = oprot.Flush(); err == nil && err2 != nil {
1847 err = err2
1848 }
1849 if err != nil {
1850 return
1851 }
1852 return true, err
1853 }
1854
1855 type zipkinQueryProcessorGetTraceIdsByServiceName struct {
1856 handler ZipkinQuery
1857 }
1858
1859 func (p *zipkinQueryProcessorGetTraceIdsByServiceName) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
1860 args := GetTraceIdsByServiceNameArgs{}
1861 if err = args.Read(iprot); err != nil {
1862 iprot.ReadMessageEnd()
1863 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
1864 oprot.WriteMessageBegin("getTraceIdsByServiceName", thrift.EXCEPTION, seqId)
1865 x.Write(oprot)
1866 oprot.WriteMessageEnd()
1867 oprot.Flush()
1868 return false, err
1869 }
1870
1871 iprot.ReadMessageEnd()
1872 result := GetTraceIdsByServiceNameResult{}
1873 var retval []int64
1874 var err2 error
1875 if retval, err2 = p.handler.GetTraceIdsByServiceName(args.ServiceName, args.EndTs, args.Limit, args.Order); err2 != nil {
1876 switch v := err2.(type) {
1877 case *QueryException:
1878 result.Qe = v
1879 default:
1880 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTraceIdsByServiceName: "+err2.Error())
1881 oprot.WriteMessageBegin("getTraceIdsByServiceName", thrift.EXCEPTION, seqId)
1882 x.Write(oprot)
1883 oprot.WriteMessageEnd()
1884 oprot.Flush()
1885 return true, err2
1886 }
1887 } else {
1888 result.Success = retval
1889 }
1890 if err2 = oprot.WriteMessageBegin("getTraceIdsByServiceName", thrift.REPLY, seqId); err2 != nil {
1891 err = err2
1892 }
1893 if err2 = result.Write(oprot); err == nil && err2 != nil {
1894 err = err2
1895 }
1896 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
1897 err = err2
1898 }
1899 if err2 = oprot.Flush(); err == nil && err2 != nil {
1900 err = err2
1901 }
1902 if err != nil {
1903 return
1904 }
1905 return true, err
1906 }
1907
1908 type zipkinQueryProcessorGetTraceIdsByAnnotation struct {
1909 handler ZipkinQuery
1910 }
1911
1912 func (p *zipkinQueryProcessorGetTraceIdsByAnnotation) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
1913 args := GetTraceIdsByAnnotationArgs{}
1914 if err = args.Read(iprot); err != nil {
1915 iprot.ReadMessageEnd()
1916 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
1917 oprot.WriteMessageBegin("getTraceIdsByAnnotation", thrift.EXCEPTION, seqId)
1918 x.Write(oprot)
1919 oprot.WriteMessageEnd()
1920 oprot.Flush()
1921 return false, err
1922 }
1923
1924 iprot.ReadMessageEnd()
1925 result := GetTraceIdsByAnnotationResult{}
1926 var retval []int64
1927 var err2 error
1928 if retval, err2 = p.handler.GetTraceIdsByAnnotation(args.ServiceName, args.Annotation, args.Value, args.EndTs, args.Limit, args.Order); err2 != nil {
1929 switch v := err2.(type) {
1930 case *QueryException:
1931 result.Qe = v
1932 default:
1933 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTraceIdsByAnnotation: "+err2.Error())
1934 oprot.WriteMessageBegin("getTraceIdsByAnnotation", thrift.EXCEPTION, seqId)
1935 x.Write(oprot)
1936 oprot.WriteMessageEnd()
1937 oprot.Flush()
1938 return true, err2
1939 }
1940 } else {
1941 result.Success = retval
1942 }
1943 if err2 = oprot.WriteMessageBegin("getTraceIdsByAnnotation", thrift.REPLY, seqId); err2 != nil {
1944 err = err2
1945 }
1946 if err2 = result.Write(oprot); err == nil && err2 != nil {
1947 err = err2
1948 }
1949 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
1950 err = err2
1951 }
1952 if err2 = oprot.Flush(); err == nil && err2 != nil {
1953 err = err2
1954 }
1955 if err != nil {
1956 return
1957 }
1958 return true, err
1959 }
1960
1961 type zipkinQueryProcessorTracesExist struct {
1962 handler ZipkinQuery
1963 }
1964
1965 func (p *zipkinQueryProcessorTracesExist) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
1966 args := TracesExistArgs{}
1967 if err = args.Read(iprot); err != nil {
1968 iprot.ReadMessageEnd()
1969 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
1970 oprot.WriteMessageBegin("tracesExist", thrift.EXCEPTION, seqId)
1971 x.Write(oprot)
1972 oprot.WriteMessageEnd()
1973 oprot.Flush()
1974 return false, err
1975 }
1976
1977 iprot.ReadMessageEnd()
1978 result := TracesExistResult{}
1979 var retval map[int64]bool
1980 var err2 error
1981 if retval, err2 = p.handler.TracesExist(args.TraceIds); err2 != nil {
1982 switch v := err2.(type) {
1983 case *QueryException:
1984 result.Qe = v
1985 default:
1986 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing tracesExist: "+err2.Error())
1987 oprot.WriteMessageBegin("tracesExist", thrift.EXCEPTION, seqId)
1988 x.Write(oprot)
1989 oprot.WriteMessageEnd()
1990 oprot.Flush()
1991 return true, err2
1992 }
1993 } else {
1994 result.Success = retval
1995 }
1996 if err2 = oprot.WriteMessageBegin("tracesExist", thrift.REPLY, seqId); err2 != nil {
1997 err = err2
1998 }
1999 if err2 = result.Write(oprot); err == nil && err2 != nil {
2000 err = err2
2001 }
2002 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
2003 err = err2
2004 }
2005 if err2 = oprot.Flush(); err == nil && err2 != nil {
2006 err = err2
2007 }
2008 if err != nil {
2009 return
2010 }
2011 return true, err
2012 }
2013
2014 type zipkinQueryProcessorGetTracesByIds struct {
2015 handler ZipkinQuery
2016 }
2017
2018 func (p *zipkinQueryProcessorGetTracesByIds) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
2019 args := GetTracesByIdsArgs{}
2020 if err = args.Read(iprot); err != nil {
2021 iprot.ReadMessageEnd()
2022 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
2023 oprot.WriteMessageBegin("getTracesByIds", thrift.EXCEPTION, seqId)
2024 x.Write(oprot)
2025 oprot.WriteMessageEnd()
2026 oprot.Flush()
2027 return false, err
2028 }
2029
2030 iprot.ReadMessageEnd()
2031 result := GetTracesByIdsResult{}
2032 var retval []*Trace
2033 var err2 error
2034 if retval, err2 = p.handler.GetTracesByIds(args.TraceIds, args.Adjust); err2 != nil {
2035 switch v := err2.(type) {
2036 case *QueryException:
2037 result.Qe = v
2038 default:
2039 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTracesByIds: "+err2.Error())
2040 oprot.WriteMessageBegin("getTracesByIds", thrift.EXCEPTION, seqId)
2041 x.Write(oprot)
2042 oprot.WriteMessageEnd()
2043 oprot.Flush()
2044 return true, err2
2045 }
2046 } else {
2047 result.Success = retval
2048 }
2049 if err2 = oprot.WriteMessageBegin("getTracesByIds", thrift.REPLY, seqId); err2 != nil {
2050 err = err2
2051 }
2052 if err2 = result.Write(oprot); err == nil && err2 != nil {
2053 err = err2
2054 }
2055 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
2056 err = err2
2057 }
2058 if err2 = oprot.Flush(); err == nil && err2 != nil {
2059 err = err2
2060 }
2061 if err != nil {
2062 return
2063 }
2064 return true, err
2065 }
2066
2067 type zipkinQueryProcessorGetTraceTimelinesByIds struct {
2068 handler ZipkinQuery
2069 }
2070
2071 func (p *zipkinQueryProcessorGetTraceTimelinesByIds) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
2072 args := GetTraceTimelinesByIdsArgs{}
2073 if err = args.Read(iprot); err != nil {
2074 iprot.ReadMessageEnd()
2075 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
2076 oprot.WriteMessageBegin("getTraceTimelinesByIds", thrift.EXCEPTION, seqId)
2077 x.Write(oprot)
2078 oprot.WriteMessageEnd()
2079 oprot.Flush()
2080 return false, err
2081 }
2082
2083 iprot.ReadMessageEnd()
2084 result := GetTraceTimelinesByIdsResult{}
2085 var retval []*TraceTimeline
2086 var err2 error
2087 if retval, err2 = p.handler.GetTraceTimelinesByIds(args.TraceIds, args.Adjust); err2 != nil {
2088 switch v := err2.(type) {
2089 case *QueryException:
2090 result.Qe = v
2091 default:
2092 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTraceTimelinesByIds: "+err2.Error())
2093 oprot.WriteMessageBegin("getTraceTimelinesByIds", thrift.EXCEPTION, seqId)
2094 x.Write(oprot)
2095 oprot.WriteMessageEnd()
2096 oprot.Flush()
2097 return true, err2
2098 }
2099 } else {
2100 result.Success = retval
2101 }
2102 if err2 = oprot.WriteMessageBegin("getTraceTimelinesByIds", thrift.REPLY, seqId); err2 != nil {
2103 err = err2
2104 }
2105 if err2 = result.Write(oprot); err == nil && err2 != nil {
2106 err = err2
2107 }
2108 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
2109 err = err2
2110 }
2111 if err2 = oprot.Flush(); err == nil && err2 != nil {
2112 err = err2
2113 }
2114 if err != nil {
2115 return
2116 }
2117 return true, err
2118 }
2119
2120 type zipkinQueryProcessorGetTraceSummariesByIds struct {
2121 handler ZipkinQuery
2122 }
2123
2124 func (p *zipkinQueryProcessorGetTraceSummariesByIds) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
2125 args := GetTraceSummariesByIdsArgs{}
2126 if err = args.Read(iprot); err != nil {
2127 iprot.ReadMessageEnd()
2128 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
2129 oprot.WriteMessageBegin("getTraceSummariesByIds", thrift.EXCEPTION, seqId)
2130 x.Write(oprot)
2131 oprot.WriteMessageEnd()
2132 oprot.Flush()
2133 return false, err
2134 }
2135
2136 iprot.ReadMessageEnd()
2137 result := GetTraceSummariesByIdsResult{}
2138 var retval []*TraceSummary
2139 var err2 error
2140 if retval, err2 = p.handler.GetTraceSummariesByIds(args.TraceIds, args.Adjust); err2 != nil {
2141 switch v := err2.(type) {
2142 case *QueryException:
2143 result.Qe = v
2144 default:
2145 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTraceSummariesByIds: "+err2.Error())
2146 oprot.WriteMessageBegin("getTraceSummariesByIds", thrift.EXCEPTION, seqId)
2147 x.Write(oprot)
2148 oprot.WriteMessageEnd()
2149 oprot.Flush()
2150 return true, err2
2151 }
2152 } else {
2153 result.Success = retval
2154 }
2155 if err2 = oprot.WriteMessageBegin("getTraceSummariesByIds", thrift.REPLY, seqId); err2 != nil {
2156 err = err2
2157 }
2158 if err2 = result.Write(oprot); err == nil && err2 != nil {
2159 err = err2
2160 }
2161 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
2162 err = err2
2163 }
2164 if err2 = oprot.Flush(); err == nil && err2 != nil {
2165 err = err2
2166 }
2167 if err != nil {
2168 return
2169 }
2170 return true, err
2171 }
2172
2173 type zipkinQueryProcessorGetTraceCombosByIds struct {
2174 handler ZipkinQuery
2175 }
2176
2177 func (p *zipkinQueryProcessorGetTraceCombosByIds) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
2178 args := GetTraceCombosByIdsArgs{}
2179 if err = args.Read(iprot); err != nil {
2180 iprot.ReadMessageEnd()
2181 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
2182 oprot.WriteMessageBegin("getTraceCombosByIds", thrift.EXCEPTION, seqId)
2183 x.Write(oprot)
2184 oprot.WriteMessageEnd()
2185 oprot.Flush()
2186 return false, err
2187 }
2188
2189 iprot.ReadMessageEnd()
2190 result := GetTraceCombosByIdsResult{}
2191 var retval []*TraceCombo
2192 var err2 error
2193 if retval, err2 = p.handler.GetTraceCombosByIds(args.TraceIds, args.Adjust); err2 != nil {
2194 switch v := err2.(type) {
2195 case *QueryException:
2196 result.Qe = v
2197 default:
2198 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTraceCombosByIds: "+err2.Error())
2199 oprot.WriteMessageBegin("getTraceCombosByIds", thrift.EXCEPTION, seqId)
2200 x.Write(oprot)
2201 oprot.WriteMessageEnd()
2202 oprot.Flush()
2203 return true, err2
2204 }
2205 } else {
2206 result.Success = retval
2207 }
2208 if err2 = oprot.WriteMessageBegin("getTraceCombosByIds", thrift.REPLY, seqId); err2 != nil {
2209 err = err2
2210 }
2211 if err2 = result.Write(oprot); err == nil && err2 != nil {
2212 err = err2
2213 }
2214 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
2215 err = err2
2216 }
2217 if err2 = oprot.Flush(); err == nil && err2 != nil {
2218 err = err2
2219 }
2220 if err != nil {
2221 return
2222 }
2223 return true, err
2224 }
2225
2226 type zipkinQueryProcessorGetServiceNames struct {
2227 handler ZipkinQuery
2228 }
2229
2230 func (p *zipkinQueryProcessorGetServiceNames) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
2231 args := GetServiceNamesArgs{}
2232 if err = args.Read(iprot); err != nil {
2233 iprot.ReadMessageEnd()
2234 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
2235 oprot.WriteMessageBegin("getServiceNames", thrift.EXCEPTION, seqId)
2236 x.Write(oprot)
2237 oprot.WriteMessageEnd()
2238 oprot.Flush()
2239 return false, err
2240 }
2241
2242 iprot.ReadMessageEnd()
2243 result := GetServiceNamesResult{}
2244 var retval map[string]bool
2245 var err2 error
2246 if retval, err2 = p.handler.GetServiceNames(); err2 != nil {
2247 switch v := err2.(type) {
2248 case *QueryException:
2249 result.Qe = v
2250 default:
2251 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getServiceNames: "+err2.Error())
2252 oprot.WriteMessageBegin("getServiceNames", thrift.EXCEPTION, seqId)
2253 x.Write(oprot)
2254 oprot.WriteMessageEnd()
2255 oprot.Flush()
2256 return true, err2
2257 }
2258 } else {
2259 result.Success = retval
2260 }
2261 if err2 = oprot.WriteMessageBegin("getServiceNames", thrift.REPLY, seqId); err2 != nil {
2262 err = err2
2263 }
2264 if err2 = result.Write(oprot); err == nil && err2 != nil {
2265 err = err2
2266 }
2267 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
2268 err = err2
2269 }
2270 if err2 = oprot.Flush(); err == nil && err2 != nil {
2271 err = err2
2272 }
2273 if err != nil {
2274 return
2275 }
2276 return true, err
2277 }
2278
2279 type zipkinQueryProcessorGetSpanNames struct {
2280 handler ZipkinQuery
2281 }
2282
2283 func (p *zipkinQueryProcessorGetSpanNames) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
2284 args := GetSpanNamesArgs{}
2285 if err = args.Read(iprot); err != nil {
2286 iprot.ReadMessageEnd()
2287 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
2288 oprot.WriteMessageBegin("getSpanNames", thrift.EXCEPTION, seqId)
2289 x.Write(oprot)
2290 oprot.WriteMessageEnd()
2291 oprot.Flush()
2292 return false, err
2293 }
2294
2295 iprot.ReadMessageEnd()
2296 result := GetSpanNamesResult{}
2297 var retval map[string]bool
2298 var err2 error
2299 if retval, err2 = p.handler.GetSpanNames(args.ServiceName); err2 != nil {
2300 switch v := err2.(type) {
2301 case *QueryException:
2302 result.Qe = v
2303 default:
2304 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getSpanNames: "+err2.Error())
2305 oprot.WriteMessageBegin("getSpanNames", thrift.EXCEPTION, seqId)
2306 x.Write(oprot)
2307 oprot.WriteMessageEnd()
2308 oprot.Flush()
2309 return true, err2
2310 }
2311 } else {
2312 result.Success = retval
2313 }
2314 if err2 = oprot.WriteMessageBegin("getSpanNames", thrift.REPLY, seqId); err2 != nil {
2315 err = err2
2316 }
2317 if err2 = result.Write(oprot); err == nil && err2 != nil {
2318 err = err2
2319 }
2320 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
2321 err = err2
2322 }
2323 if err2 = oprot.Flush(); err == nil && err2 != nil {
2324 err = err2
2325 }
2326 if err != nil {
2327 return
2328 }
2329 return true, err
2330 }
2331
2332 type zipkinQueryProcessorSetTraceTimeToLive struct {
2333 handler ZipkinQuery
2334 }
2335
2336 func (p *zipkinQueryProcessorSetTraceTimeToLive) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
2337 args := SetTraceTimeToLiveArgs{}
2338 if err = args.Read(iprot); err != nil {
2339 iprot.ReadMessageEnd()
2340 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
2341 oprot.WriteMessageBegin("setTraceTimeToLive", thrift.EXCEPTION, seqId)
2342 x.Write(oprot)
2343 oprot.WriteMessageEnd()
2344 oprot.Flush()
2345 return false, err
2346 }
2347
2348 iprot.ReadMessageEnd()
2349 result := SetTraceTimeToLiveResult{}
2350 var err2 error
2351 if err2 = p.handler.SetTraceTimeToLive(args.TraceId, args.TtlSeconds); err2 != nil {
2352 switch v := err2.(type) {
2353 case *QueryException:
2354 result.Qe = v
2355 default:
2356 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing setTraceTimeToLive: "+err2.Error())
2357 oprot.WriteMessageBegin("setTraceTimeToLive", thrift.EXCEPTION, seqId)
2358 x.Write(oprot)
2359 oprot.WriteMessageEnd()
2360 oprot.Flush()
2361 return true, err2
2362 }
2363 }
2364 if err2 = oprot.WriteMessageBegin("setTraceTimeToLive", thrift.REPLY, seqId); err2 != nil {
2365 err = err2
2366 }
2367 if err2 = result.Write(oprot); err == nil && err2 != nil {
2368 err = err2
2369 }
2370 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
2371 err = err2
2372 }
2373 if err2 = oprot.Flush(); err == nil && err2 != nil {
2374 err = err2
2375 }
2376 if err != nil {
2377 return
2378 }
2379 return true, err
2380 }
2381
2382 type zipkinQueryProcessorGetTraceTimeToLive struct {
2383 handler ZipkinQuery
2384 }
2385
2386 func (p *zipkinQueryProcessorGetTraceTimeToLive) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
2387 args := GetTraceTimeToLiveArgs{}
2388 if err = args.Read(iprot); err != nil {
2389 iprot.ReadMessageEnd()
2390 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
2391 oprot.WriteMessageBegin("getTraceTimeToLive", thrift.EXCEPTION, seqId)
2392 x.Write(oprot)
2393 oprot.WriteMessageEnd()
2394 oprot.Flush()
2395 return false, err
2396 }
2397
2398 iprot.ReadMessageEnd()
2399 result := GetTraceTimeToLiveResult{}
2400 var retval int32
2401 var err2 error
2402 if retval, err2 = p.handler.GetTraceTimeToLive(args.TraceId); err2 != nil {
2403 switch v := err2.(type) {
2404 case *QueryException:
2405 result.Qe = v
2406 default:
2407 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTraceTimeToLive: "+err2.Error())
2408 oprot.WriteMessageBegin("getTraceTimeToLive", thrift.EXCEPTION, seqId)
2409 x.Write(oprot)
2410 oprot.WriteMessageEnd()
2411 oprot.Flush()
2412 return true, err2
2413 }
2414 } else {
2415 result.Success = &retval
2416 }
2417 if err2 = oprot.WriteMessageBegin("getTraceTimeToLive", thrift.REPLY, seqId); err2 != nil {
2418 err = err2
2419 }
2420 if err2 = result.Write(oprot); err == nil && err2 != nil {
2421 err = err2
2422 }
2423 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
2424 err = err2
2425 }
2426 if err2 = oprot.Flush(); err == nil && err2 != nil {
2427 err = err2
2428 }
2429 if err != nil {
2430 return
2431 }
2432 return true, err
2433 }
2434
2435 type zipkinQueryProcessorGetDataTimeToLive struct {
2436 handler ZipkinQuery
2437 }
2438
2439 func (p *zipkinQueryProcessorGetDataTimeToLive) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
2440 args := GetDataTimeToLiveArgs{}
2441 if err = args.Read(iprot); err != nil {
2442 iprot.ReadMessageEnd()
2443 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
2444 oprot.WriteMessageBegin("getDataTimeToLive", thrift.EXCEPTION, seqId)
2445 x.Write(oprot)
2446 oprot.WriteMessageEnd()
2447 oprot.Flush()
2448 return false, err
2449 }
2450
2451 iprot.ReadMessageEnd()
2452 result := GetDataTimeToLiveResult{}
2453 var retval int32
2454 var err2 error
2455 if retval, err2 = p.handler.GetDataTimeToLive(); err2 != nil {
2456 switch v := err2.(type) {
2457 case *QueryException:
2458 result.Qe = v
2459 default:
2460 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getDataTimeToLive: "+err2.Error())
2461 oprot.WriteMessageBegin("getDataTimeToLive", thrift.EXCEPTION, seqId)
2462 x.Write(oprot)
2463 oprot.WriteMessageEnd()
2464 oprot.Flush()
2465 return true, err2
2466 }
2467 } else {
2468 result.Success = &retval
2469 }
2470 if err2 = oprot.WriteMessageBegin("getDataTimeToLive", thrift.REPLY, seqId); err2 != nil {
2471 err = err2
2472 }
2473 if err2 = result.Write(oprot); err == nil && err2 != nil {
2474 err = err2
2475 }
2476 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
2477 err = err2
2478 }
2479 if err2 = oprot.Flush(); err == nil && err2 != nil {
2480 err = err2
2481 }
2482 if err != nil {
2483 return
2484 }
2485 return true, err
2486 }
2487
2488 type zipkinQueryProcessorGetDependencies struct {
2489 handler ZipkinQuery
2490 }
2491
2492 func (p *zipkinQueryProcessorGetDependencies) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
2493 args := GetDependenciesArgs{}
2494 if err = args.Read(iprot); err != nil {
2495 iprot.ReadMessageEnd()
2496 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
2497 oprot.WriteMessageBegin("getDependencies", thrift.EXCEPTION, seqId)
2498 x.Write(oprot)
2499 oprot.WriteMessageEnd()
2500 oprot.Flush()
2501 return false, err
2502 }
2503
2504 iprot.ReadMessageEnd()
2505 result := GetDependenciesResult{}
2506 var retval *zipkindependencies.Dependencies
2507 var err2 error
2508 if retval, err2 = p.handler.GetDependencies(args.StartTime, args.EndTime); err2 != nil {
2509 switch v := err2.(type) {
2510 case *QueryException:
2511 result.Qe = v
2512 default:
2513 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getDependencies: "+err2.Error())
2514 oprot.WriteMessageBegin("getDependencies", thrift.EXCEPTION, seqId)
2515 x.Write(oprot)
2516 oprot.WriteMessageEnd()
2517 oprot.Flush()
2518 return true, err2
2519 }
2520 } else {
2521 result.Success = retval
2522 }
2523 if err2 = oprot.WriteMessageBegin("getDependencies", thrift.REPLY, seqId); err2 != nil {
2524 err = err2
2525 }
2526 if err2 = result.Write(oprot); err == nil && err2 != nil {
2527 err = err2
2528 }
2529 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
2530 err = err2
2531 }
2532 if err2 = oprot.Flush(); err == nil && err2 != nil {
2533 err = err2
2534 }
2535 if err != nil {
2536 return
2537 }
2538 return true, err
2539 }
2540
2541 type zipkinQueryProcessorGetTopAnnotations struct {
2542 handler ZipkinQuery
2543 }
2544
2545 func (p *zipkinQueryProcessorGetTopAnnotations) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
2546 args := GetTopAnnotationsArgs{}
2547 if err = args.Read(iprot); err != nil {
2548 iprot.ReadMessageEnd()
2549 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
2550 oprot.WriteMessageBegin("getTopAnnotations", thrift.EXCEPTION, seqId)
2551 x.Write(oprot)
2552 oprot.WriteMessageEnd()
2553 oprot.Flush()
2554 return false, err
2555 }
2556
2557 iprot.ReadMessageEnd()
2558 result := GetTopAnnotationsResult{}
2559 var retval []string
2560 var err2 error
2561 if retval, err2 = p.handler.GetTopAnnotations(args.ServiceName); err2 != nil {
2562 switch v := err2.(type) {
2563 case *QueryException:
2564 result.Qe = v
2565 default:
2566 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTopAnnotations: "+err2.Error())
2567 oprot.WriteMessageBegin("getTopAnnotations", thrift.EXCEPTION, seqId)
2568 x.Write(oprot)
2569 oprot.WriteMessageEnd()
2570 oprot.Flush()
2571 return true, err2
2572 }
2573 } else {
2574 result.Success = retval
2575 }
2576 if err2 = oprot.WriteMessageBegin("getTopAnnotations", thrift.REPLY, seqId); err2 != nil {
2577 err = err2
2578 }
2579 if err2 = result.Write(oprot); err == nil && err2 != nil {
2580 err = err2
2581 }
2582 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
2583 err = err2
2584 }
2585 if err2 = oprot.Flush(); err == nil && err2 != nil {
2586 err = err2
2587 }
2588 if err != nil {
2589 return
2590 }
2591 return true, err
2592 }
2593
2594 type zipkinQueryProcessorGetTopKeyValueAnnotations struct {
2595 handler ZipkinQuery
2596 }
2597
2598 func (p *zipkinQueryProcessorGetTopKeyValueAnnotations) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
2599 args := GetTopKeyValueAnnotationsArgs{}
2600 if err = args.Read(iprot); err != nil {
2601 iprot.ReadMessageEnd()
2602 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
2603 oprot.WriteMessageBegin("getTopKeyValueAnnotations", thrift.EXCEPTION, seqId)
2604 x.Write(oprot)
2605 oprot.WriteMessageEnd()
2606 oprot.Flush()
2607 return false, err
2608 }
2609
2610 iprot.ReadMessageEnd()
2611 result := GetTopKeyValueAnnotationsResult{}
2612 var retval []string
2613 var err2 error
2614 if retval, err2 = p.handler.GetTopKeyValueAnnotations(args.ServiceName); err2 != nil {
2615 switch v := err2.(type) {
2616 case *QueryException:
2617 result.Qe = v
2618 default:
2619 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTopKeyValueAnnotations: "+err2.Error())
2620 oprot.WriteMessageBegin("getTopKeyValueAnnotations", thrift.EXCEPTION, seqId)
2621 x.Write(oprot)
2622 oprot.WriteMessageEnd()
2623 oprot.Flush()
2624 return true, err2
2625 }
2626 } else {
2627 result.Success = retval
2628 }
2629 if err2 = oprot.WriteMessageBegin("getTopKeyValueAnnotations", thrift.REPLY, seqId); err2 != nil {
2630 err = err2
2631 }
2632 if err2 = result.Write(oprot); err == nil && err2 != nil {
2633 err = err2
2634 }
2635 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
2636 err = err2
2637 }
2638 if err2 = oprot.Flush(); err == nil && err2 != nil {
2639 err = err2
2640 }
2641 if err != nil {
2642 return
2643 }
2644 return true, err
2645 }
2646
2647 type zipkinQueryProcessorGetSpanDurations struct {
2648 handler ZipkinQuery
2649 }
2650
2651 func (p *zipkinQueryProcessorGetSpanDurations) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
2652 args := GetSpanDurationsArgs{}
2653 if err = args.Read(iprot); err != nil {
2654 iprot.ReadMessageEnd()
2655 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
2656 oprot.WriteMessageBegin("getSpanDurations", thrift.EXCEPTION, seqId)
2657 x.Write(oprot)
2658 oprot.WriteMessageEnd()
2659 oprot.Flush()
2660 return false, err
2661 }
2662
2663 iprot.ReadMessageEnd()
2664 result := GetSpanDurationsResult{}
2665 var retval map[string][]int64
2666 var err2 error
2667 if retval, err2 = p.handler.GetSpanDurations(args.TimeStamp, args.ServiceName, args.RpcName); err2 != nil {
2668 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getSpanDurations: "+err2.Error())
2669 oprot.WriteMessageBegin("getSpanDurations", thrift.EXCEPTION, seqId)
2670 x.Write(oprot)
2671 oprot.WriteMessageEnd()
2672 oprot.Flush()
2673 return true, err2
2674 } else {
2675 result.Success = retval
2676 }
2677 if err2 = oprot.WriteMessageBegin("getSpanDurations", thrift.REPLY, seqId); err2 != nil {
2678 err = err2
2679 }
2680 if err2 = result.Write(oprot); err == nil && err2 != nil {
2681 err = err2
2682 }
2683 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
2684 err = err2
2685 }
2686 if err2 = oprot.Flush(); err == nil && err2 != nil {
2687 err = err2
2688 }
2689 if err != nil {
2690 return
2691 }
2692 return true, err
2693 }
2694
2695 type zipkinQueryProcessorGetServiceNamesToTraceIds struct {
2696 handler ZipkinQuery
2697 }
2698
2699 func (p *zipkinQueryProcessorGetServiceNamesToTraceIds) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
2700 args := GetServiceNamesToTraceIdsArgs{}
2701 if err = args.Read(iprot); err != nil {
2702 iprot.ReadMessageEnd()
2703 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
2704 oprot.WriteMessageBegin("getServiceNamesToTraceIds", thrift.EXCEPTION, seqId)
2705 x.Write(oprot)
2706 oprot.WriteMessageEnd()
2707 oprot.Flush()
2708 return false, err
2709 }
2710
2711 iprot.ReadMessageEnd()
2712 result := GetServiceNamesToTraceIdsResult{}
2713 var retval map[string][]int64
2714 var err2 error
2715 if retval, err2 = p.handler.GetServiceNamesToTraceIds(args.TimeStamp, args.ServiceName, args.RpcName); err2 != nil {
2716 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getServiceNamesToTraceIds: "+err2.Error())
2717 oprot.WriteMessageBegin("getServiceNamesToTraceIds", thrift.EXCEPTION, seqId)
2718 x.Write(oprot)
2719 oprot.WriteMessageEnd()
2720 oprot.Flush()
2721 return true, err2
2722 } else {
2723 result.Success = retval
2724 }
2725 if err2 = oprot.WriteMessageBegin("getServiceNamesToTraceIds", thrift.REPLY, seqId); err2 != nil {
2726 err = err2
2727 }
2728 if err2 = result.Write(oprot); err == nil && err2 != nil {
2729 err = err2
2730 }
2731 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
2732 err = err2
2733 }
2734 if err2 = oprot.Flush(); err == nil && err2 != nil {
2735 err = err2
2736 }
2737 if err != nil {
2738 return
2739 }
2740 return true, err
2741 }
2742
2743 // HELPER FUNCTIONS AND STRUCTURES
2744
2745 type GetTraceIdsArgs struct {
2746 Request *QueryRequest `thrift:"request,1" json:"request"`
2747 }
2748
2749 func NewGetTraceIdsArgs() *GetTraceIdsArgs {
2750 return &GetTraceIdsArgs{}
2751 }
2752
2753 var GetTraceIdsArgs_Request_DEFAULT *QueryRequest
2754
2755 func (p *GetTraceIdsArgs) GetRequest() *QueryRequest {
2756 if !p.IsSetRequest() {
2757 return GetTraceIdsArgs_Request_DEFAULT
2758 }
2759 return p.Request
2760 }
2761 func (p *GetTraceIdsArgs) IsSetRequest() bool {
2762 return p.Request != nil
2763 }
2764
2765 func (p *GetTraceIdsArgs) Read(iprot thrift.TProtocol) error {
2766 if _, err := iprot.ReadStructBegin(); err != nil {
2767 return fmt.Errorf("%T read error: %s", p, err)
2768 }
2769 for {
2770 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
2771 if err != nil {
2772 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
2773 }
2774 if fieldTypeId == thrift.STOP {
2775 break
2776 }
2777 switch fieldId {
2778 case 1:
2779 if err := p.ReadField1(iprot); err != nil {
2780 return err
2781 }
2782 default:
2783 if err := iprot.Skip(fieldTypeId); err != nil {
2784 return err
2785 }
2786 }
2787 if err := iprot.ReadFieldEnd(); err != nil {
2788 return err
2789 }
2790 }
2791 if err := iprot.ReadStructEnd(); err != nil {
2792 return fmt.Errorf("%T read struct end error: %s", p, err)
2793 }
2794 return nil
2795 }
2796
2797 func (p *GetTraceIdsArgs) ReadField1(iprot thrift.TProtocol) error {
2798 p.Request = &QueryRequest{}
2799 if err := p.Request.Read(iprot); err != nil {
2800 return fmt.Errorf("%T error reading struct: %s", p.Request, err)
2801 }
2802 return nil
2803 }
2804
2805 func (p *GetTraceIdsArgs) Write(oprot thrift.TProtocol) error {
2806 if err := oprot.WriteStructBegin("getTraceIds_args"); err != nil {
2807 return fmt.Errorf("%T write struct begin error: %s", p, err)
2808 }
2809 if err := p.writeField1(oprot); err != nil {
2810 return err
2811 }
2812 if err := oprot.WriteFieldStop(); err != nil {
2813 return fmt.Errorf("write field stop error: %s", err)
2814 }
2815 if err := oprot.WriteStructEnd(); err != nil {
2816 return fmt.Errorf("write struct stop error: %s", err)
2817 }
2818 return nil
2819 }
2820
2821 func (p *GetTraceIdsArgs) writeField1(oprot thrift.TProtocol) (err error) {
2822 if err := oprot.WriteFieldBegin("request", thrift.STRUCT, 1); err != nil {
2823 return fmt.Errorf("%T write field begin error 1:request: %s", p, err)
2824 }
2825 if err := p.Request.Write(oprot); err != nil {
2826 return fmt.Errorf("%T error writing struct: %s", p.Request, err)
2827 }
2828 if err := oprot.WriteFieldEnd(); err != nil {
2829 return fmt.Errorf("%T write field end error 1:request: %s", p, err)
2830 }
2831 return err
2832 }
2833
2834 func (p *GetTraceIdsArgs) String() string {
2835 if p == nil {
2836 return "<nil>"
2837 }
2838 return fmt.Sprintf("GetTraceIdsArgs(%+v)", *p)
2839 }
2840
2841 type GetTraceIdsResult struct {
2842 Success *QueryResponse `thrift:"success,0" json:"success"`
2843 Qe *QueryException `thrift:"qe,1" json:"qe"`
2844 }
2845
2846 func NewGetTraceIdsResult() *GetTraceIdsResult {
2847 return &GetTraceIdsResult{}
2848 }
2849
2850 var GetTraceIdsResult_Success_DEFAULT *QueryResponse
2851
2852 func (p *GetTraceIdsResult) GetSuccess() *QueryResponse {
2853 if !p.IsSetSuccess() {
2854 return GetTraceIdsResult_Success_DEFAULT
2855 }
2856 return p.Success
2857 }
2858
2859 var GetTraceIdsResult_Qe_DEFAULT *QueryException
2860
2861 func (p *GetTraceIdsResult) GetQe() *QueryException {
2862 if !p.IsSetQe() {
2863 return GetTraceIdsResult_Qe_DEFAULT
2864 }
2865 return p.Qe
2866 }
2867 func (p *GetTraceIdsResult) IsSetSuccess() bool {
2868 return p.Success != nil
2869 }
2870
2871 func (p *GetTraceIdsResult) IsSetQe() bool {
2872 return p.Qe != nil
2873 }
2874
2875 func (p *GetTraceIdsResult) Read(iprot thrift.TProtocol) error {
2876 if _, err := iprot.ReadStructBegin(); err != nil {
2877 return fmt.Errorf("%T read error: %s", p, err)
2878 }
2879 for {
2880 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
2881 if err != nil {
2882 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
2883 }
2884 if fieldTypeId == thrift.STOP {
2885 break
2886 }
2887 switch fieldId {
2888 case 0:
2889 if err := p.ReadField0(iprot); err != nil {
2890 return err
2891 }
2892 case 1:
2893 if err := p.ReadField1(iprot); err != nil {
2894 return err
2895 }
2896 default:
2897 if err := iprot.Skip(fieldTypeId); err != nil {
2898 return err
2899 }
2900 }
2901 if err := iprot.ReadFieldEnd(); err != nil {
2902 return err
2903 }
2904 }
2905 if err := iprot.ReadStructEnd(); err != nil {
2906 return fmt.Errorf("%T read struct end error: %s", p, err)
2907 }
2908 return nil
2909 }
2910
2911 func (p *GetTraceIdsResult) ReadField0(iprot thrift.TProtocol) error {
2912 p.Success = &QueryResponse{}
2913 if err := p.Success.Read(iprot); err != nil {
2914 return fmt.Errorf("%T error reading struct: %s", p.Success, err)
2915 }
2916 return nil
2917 }
2918
2919 func (p *GetTraceIdsResult) ReadField1(iprot thrift.TProtocol) error {
2920 p.Qe = &QueryException{}
2921 if err := p.Qe.Read(iprot); err != nil {
2922 return fmt.Errorf("%T error reading struct: %s", p.Qe, err)
2923 }
2924 return nil
2925 }
2926
2927 func (p *GetTraceIdsResult) Write(oprot thrift.TProtocol) error {
2928 if err := oprot.WriteStructBegin("getTraceIds_result"); err != nil {
2929 return fmt.Errorf("%T write struct begin error: %s", p, err)
2930 }
2931 if err := p.writeField0(oprot); err != nil {
2932 return err
2933 }
2934 if err := p.writeField1(oprot); err != nil {
2935 return err
2936 }
2937 if err := oprot.WriteFieldStop(); err != nil {
2938 return fmt.Errorf("write field stop error: %s", err)
2939 }
2940 if err := oprot.WriteStructEnd(); err != nil {
2941 return fmt.Errorf("write struct stop error: %s", err)
2942 }
2943 return nil
2944 }
2945
2946 func (p *GetTraceIdsResult) writeField0(oprot thrift.TProtocol) (err error) {
2947 if p.IsSetSuccess() {
2948 if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
2949 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
2950 }
2951 if err := p.Success.Write(oprot); err != nil {
2952 return fmt.Errorf("%T error writing struct: %s", p.Success, err)
2953 }
2954 if err := oprot.WriteFieldEnd(); err != nil {
2955 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
2956 }
2957 }
2958 return err
2959 }
2960
2961 func (p *GetTraceIdsResult) writeField1(oprot thrift.TProtocol) (err error) {
2962 if p.IsSetQe() {
2963 if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil {
2964 return fmt.Errorf("%T write field begin error 1:qe: %s", p, err)
2965 }
2966 if err := p.Qe.Write(oprot); err != nil {
2967 return fmt.Errorf("%T error writing struct: %s", p.Qe, err)
2968 }
2969 if err := oprot.WriteFieldEnd(); err != nil {
2970 return fmt.Errorf("%T write field end error 1:qe: %s", p, err)
2971 }
2972 }
2973 return err
2974 }
2975
2976 func (p *GetTraceIdsResult) String() string {
2977 if p == nil {
2978 return "<nil>"
2979 }
2980 return fmt.Sprintf("GetTraceIdsResult(%+v)", *p)
2981 }
2982
2983 type GetTraceIdsBySpanNameArgs struct {
2984 ServiceName string `thrift:"service_name,1" json:"service_name"`
2985 SpanName string `thrift:"span_name,2" json:"span_name"`
2986 // unused field # 3
2987 EndTs int64 `thrift:"end_ts,4" json:"end_ts"`
2988 Limit int32 `thrift:"limit,5" json:"limit"`
2989 Order Order `thrift:"order,6" json:"order"`
2990 }
2991
2992 func NewGetTraceIdsBySpanNameArgs() *GetTraceIdsBySpanNameArgs {
2993 return &GetTraceIdsBySpanNameArgs{}
2994 }
2995
2996 func (p *GetTraceIdsBySpanNameArgs) GetServiceName() string {
2997 return p.ServiceName
2998 }
2999
3000 func (p *GetTraceIdsBySpanNameArgs) GetSpanName() string {
3001 return p.SpanName
3002 }
3003
3004 func (p *GetTraceIdsBySpanNameArgs) GetEndTs() int64 {
3005 return p.EndTs
3006 }
3007
3008 func (p *GetTraceIdsBySpanNameArgs) GetLimit() int32 {
3009 return p.Limit
3010 }
3011
3012 func (p *GetTraceIdsBySpanNameArgs) GetOrder() Order {
3013 return p.Order
3014 }
3015 func (p *GetTraceIdsBySpanNameArgs) Read(iprot thrift.TProtocol) error {
3016 if _, err := iprot.ReadStructBegin(); err != nil {
3017 return fmt.Errorf("%T read error: %s", p, err)
3018 }
3019 for {
3020 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
3021 if err != nil {
3022 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
3023 }
3024 if fieldTypeId == thrift.STOP {
3025 break
3026 }
3027 switch fieldId {
3028 case 1:
3029 if err := p.ReadField1(iprot); err != nil {
3030 return err
3031 }
3032 case 2:
3033 if err := p.ReadField2(iprot); err != nil {
3034 return err
3035 }
3036 case 4:
3037 if err := p.ReadField4(iprot); err != nil {
3038 return err
3039 }
3040 case 5:
3041 if err := p.ReadField5(iprot); err != nil {
3042 return err
3043 }
3044 case 6:
3045 if err := p.ReadField6(iprot); err != nil {
3046 return err
3047 }
3048 default:
3049 if err := iprot.Skip(fieldTypeId); err != nil {
3050 return err
3051 }
3052 }
3053 if err := iprot.ReadFieldEnd(); err != nil {
3054 return err
3055 }
3056 }
3057 if err := iprot.ReadStructEnd(); err != nil {
3058 return fmt.Errorf("%T read struct end error: %s", p, err)
3059 }
3060 return nil
3061 }
3062
3063 func (p *GetTraceIdsBySpanNameArgs) ReadField1(iprot thrift.TProtocol) error {
3064 if v, err := iprot.ReadString(); err != nil {
3065 return fmt.Errorf("error reading field 1: %s", err)
3066 } else {
3067 p.ServiceName = v
3068 }
3069 return nil
3070 }
3071
3072 func (p *GetTraceIdsBySpanNameArgs) ReadField2(iprot thrift.TProtocol) error {
3073 if v, err := iprot.ReadString(); err != nil {
3074 return fmt.Errorf("error reading field 2: %s", err)
3075 } else {
3076 p.SpanName = v
3077 }
3078 return nil
3079 }
3080
3081 func (p *GetTraceIdsBySpanNameArgs) ReadField4(iprot thrift.TProtocol) error {
3082 if v, err := iprot.ReadI64(); err != nil {
3083 return fmt.Errorf("error reading field 4: %s", err)
3084 } else {
3085 p.EndTs = v
3086 }
3087 return nil
3088 }
3089
3090 func (p *GetTraceIdsBySpanNameArgs) ReadField5(iprot thrift.TProtocol) error {
3091 if v, err := iprot.ReadI32(); err != nil {
3092 return fmt.Errorf("error reading field 5: %s", err)
3093 } else {
3094 p.Limit = v
3095 }
3096 return nil
3097 }
3098
3099 func (p *GetTraceIdsBySpanNameArgs) ReadField6(iprot thrift.TProtocol) error {
3100 if v, err := iprot.ReadI32(); err != nil {
3101 return fmt.Errorf("error reading field 6: %s", err)
3102 } else {
3103 temp := Order(v)
3104 p.Order = temp
3105 }
3106 return nil
3107 }
3108
3109 func (p *GetTraceIdsBySpanNameArgs) Write(oprot thrift.TProtocol) error {
3110 if err := oprot.WriteStructBegin("getTraceIdsBySpanName_args"); err != nil {
3111 return fmt.Errorf("%T write struct begin error: %s", p, err)
3112 }
3113 if err := p.writeField1(oprot); err != nil {
3114 return err
3115 }
3116 if err := p.writeField2(oprot); err != nil {
3117 return err
3118 }
3119 if err := p.writeField4(oprot); err != nil {
3120 return err
3121 }
3122 if err := p.writeField5(oprot); err != nil {
3123 return err
3124 }
3125 if err := p.writeField6(oprot); err != nil {
3126 return err
3127 }
3128 if err := oprot.WriteFieldStop(); err != nil {
3129 return fmt.Errorf("write field stop error: %s", err)
3130 }
3131 if err := oprot.WriteStructEnd(); err != nil {
3132 return fmt.Errorf("write struct stop error: %s", err)
3133 }
3134 return nil
3135 }
3136
3137 func (p *GetTraceIdsBySpanNameArgs) writeField1(oprot thrift.TProtocol) (err error) {
3138 if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil {
3139 return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err)
3140 }
3141 if err := oprot.WriteString(string(p.ServiceName)); err != nil {
3142 return fmt.Errorf("%T.service_name (1) field write error: %s", p, err)
3143 }
3144 if err := oprot.WriteFieldEnd(); err != nil {
3145 return fmt.Errorf("%T write field end error 1:service_name: %s", p, err)
3146 }
3147 return err
3148 }
3149
3150 func (p *GetTraceIdsBySpanNameArgs) writeField2(oprot thrift.TProtocol) (err error) {
3151 if err := oprot.WriteFieldBegin("span_name", thrift.STRING, 2); err != nil {
3152 return fmt.Errorf("%T write field begin error 2:span_name: %s", p, err)
3153 }
3154 if err := oprot.WriteString(string(p.SpanName)); err != nil {
3155 return fmt.Errorf("%T.span_name (2) field write error: %s", p, err)
3156 }
3157 if err := oprot.WriteFieldEnd(); err != nil {
3158 return fmt.Errorf("%T write field end error 2:span_name: %s", p, err)
3159 }
3160 return err
3161 }
3162
3163 func (p *GetTraceIdsBySpanNameArgs) writeField4(oprot thrift.TProtocol) (err error) {
3164 if err := oprot.WriteFieldBegin("end_ts", thrift.I64, 4); err != nil {
3165 return fmt.Errorf("%T write field begin error 4:end_ts: %s", p, err)
3166 }
3167 if err := oprot.WriteI64(int64(p.EndTs)); err != nil {
3168 return fmt.Errorf("%T.end_ts (4) field write error: %s", p, err)
3169 }
3170 if err := oprot.WriteFieldEnd(); err != nil {
3171 return fmt.Errorf("%T write field end error 4:end_ts: %s", p, err)
3172 }
3173 return err
3174 }
3175
3176 func (p *GetTraceIdsBySpanNameArgs) writeField5(oprot thrift.TProtocol) (err error) {
3177 if err := oprot.WriteFieldBegin("limit", thrift.I32, 5); err != nil {
3178 return fmt.Errorf("%T write field begin error 5:limit: %s", p, err)
3179 }
3180 if err := oprot.WriteI32(int32(p.Limit)); err != nil {
3181 return fmt.Errorf("%T.limit (5) field write error: %s", p, err)
3182 }
3183 if err := oprot.WriteFieldEnd(); err != nil {
3184 return fmt.Errorf("%T write field end error 5:limit: %s", p, err)
3185 }
3186 return err
3187 }
3188
3189 func (p *GetTraceIdsBySpanNameArgs) writeField6(oprot thrift.TProtocol) (err error) {
3190 if err := oprot.WriteFieldBegin("order", thrift.I32, 6); err != nil {
3191 return fmt.Errorf("%T write field begin error 6:order: %s", p, err)
3192 }
3193 if err := oprot.WriteI32(int32(p.Order)); err != nil {
3194 return fmt.Errorf("%T.order (6) field write error: %s", p, err)
3195 }
3196 if err := oprot.WriteFieldEnd(); err != nil {
3197 return fmt.Errorf("%T write field end error 6:order: %s", p, err)
3198 }
3199 return err
3200 }
3201
3202 func (p *GetTraceIdsBySpanNameArgs) String() string {
3203 if p == nil {
3204 return "<nil>"
3205 }
3206 return fmt.Sprintf("GetTraceIdsBySpanNameArgs(%+v)", *p)
3207 }
3208
3209 type GetTraceIdsBySpanNameResult struct {
3210 Success []int64 `thrift:"success,0" json:"success"`
3211 Qe *QueryException `thrift:"qe,1" json:"qe"`
3212 }
3213
3214 func NewGetTraceIdsBySpanNameResult() *GetTraceIdsBySpanNameResult {
3215 return &GetTraceIdsBySpanNameResult{}
3216 }
3217
3218 var GetTraceIdsBySpanNameResult_Success_DEFAULT []int64
3219
3220 func (p *GetTraceIdsBySpanNameResult) GetSuccess() []int64 {
3221 return p.Success
3222 }
3223
3224 var GetTraceIdsBySpanNameResult_Qe_DEFAULT *QueryException
3225
3226 func (p *GetTraceIdsBySpanNameResult) GetQe() *QueryException {
3227 if !p.IsSetQe() {
3228 return GetTraceIdsBySpanNameResult_Qe_DEFAULT
3229 }
3230 return p.Qe
3231 }
3232 func (p *GetTraceIdsBySpanNameResult) IsSetSuccess() bool {
3233 return p.Success != nil
3234 }
3235
3236 func (p *GetTraceIdsBySpanNameResult) IsSetQe() bool {
3237 return p.Qe != nil
3238 }
3239
3240 func (p *GetTraceIdsBySpanNameResult) Read(iprot thrift.TProtocol) error {
3241 if _, err := iprot.ReadStructBegin(); err != nil {
3242 return fmt.Errorf("%T read error: %s", p, err)
3243 }
3244 for {
3245 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
3246 if err != nil {
3247 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
3248 }
3249 if fieldTypeId == thrift.STOP {
3250 break
3251 }
3252 switch fieldId {
3253 case 0:
3254 if err := p.ReadField0(iprot); err != nil {
3255 return err
3256 }
3257 case 1:
3258 if err := p.ReadField1(iprot); err != nil {
3259 return err
3260 }
3261 default:
3262 if err := iprot.Skip(fieldTypeId); err != nil {
3263 return err
3264 }
3265 }
3266 if err := iprot.ReadFieldEnd(); err != nil {
3267 return err
3268 }
3269 }
3270 if err := iprot.ReadStructEnd(); err != nil {
3271 return fmt.Errorf("%T read struct end error: %s", p, err)
3272 }
3273 return nil
3274 }
3275
3276 func (p *GetTraceIdsBySpanNameResult) ReadField0(iprot thrift.TProtocol) error {
3277 _, size, err := iprot.ReadListBegin()
3278 if err != nil {
3279 return fmt.Errorf("error reading list begin: %s", err)
3280 }
3281 tSlice := make([]int64, 0, size)
3282 p.Success = tSlice
3283 for i := 0; i < size; i++ {
3284 var _elem50 int64
3285 if v, err := iprot.ReadI64(); err != nil {
3286 return fmt.Errorf("error reading field 0: %s", err)
3287 } else {
3288 _elem50 = v
3289 }
3290 p.Success = append(p.Success, _elem50)
3291 }
3292 if err := iprot.ReadListEnd(); err != nil {
3293 return fmt.Errorf("error reading list end: %s", err)
3294 }
3295 return nil
3296 }
3297
3298 func (p *GetTraceIdsBySpanNameResult) ReadField1(iprot thrift.TProtocol) error {
3299 p.Qe = &QueryException{}
3300 if err := p.Qe.Read(iprot); err != nil {
3301 return fmt.Errorf("%T error reading struct: %s", p.Qe, err)
3302 }
3303 return nil
3304 }
3305
3306 func (p *GetTraceIdsBySpanNameResult) Write(oprot thrift.TProtocol) error {
3307 if err := oprot.WriteStructBegin("getTraceIdsBySpanName_result"); err != nil {
3308 return fmt.Errorf("%T write struct begin error: %s", p, err)
3309 }
3310 if err := p.writeField0(oprot); err != nil {
3311 return err
3312 }
3313 if err := p.writeField1(oprot); err != nil {
3314 return err
3315 }
3316 if err := oprot.WriteFieldStop(); err != nil {
3317 return fmt.Errorf("write field stop error: %s", err)
3318 }
3319 if err := oprot.WriteStructEnd(); err != nil {
3320 return fmt.Errorf("write struct stop error: %s", err)
3321 }
3322 return nil
3323 }
3324
3325 func (p *GetTraceIdsBySpanNameResult) writeField0(oprot thrift.TProtocol) (err error) {
3326 if p.IsSetSuccess() {
3327 if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil {
3328 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
3329 }
3330 if err := oprot.WriteListBegin(thrift.I64, len(p.Success)); err != nil {
3331 return fmt.Errorf("error writing list begin: %s", err)
3332 }
3333 for _, v := range p.Success {
3334 if err := oprot.WriteI64(int64(v)); err != nil {
3335 return fmt.Errorf("%T. (0) field write error: %s", p, err)
3336 }
3337 }
3338 if err := oprot.WriteListEnd(); err != nil {
3339 return fmt.Errorf("error writing list end: %s", err)
3340 }
3341 if err := oprot.WriteFieldEnd(); err != nil {
3342 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
3343 }
3344 }
3345 return err
3346 }
3347
3348 func (p *GetTraceIdsBySpanNameResult) writeField1(oprot thrift.TProtocol) (err error) {
3349 if p.IsSetQe() {
3350 if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil {
3351 return fmt.Errorf("%T write field begin error 1:qe: %s", p, err)
3352 }
3353 if err := p.Qe.Write(oprot); err != nil {
3354 return fmt.Errorf("%T error writing struct: %s", p.Qe, err)
3355 }
3356 if err := oprot.WriteFieldEnd(); err != nil {
3357 return fmt.Errorf("%T write field end error 1:qe: %s", p, err)
3358 }
3359 }
3360 return err
3361 }
3362
3363 func (p *GetTraceIdsBySpanNameResult) String() string {
3364 if p == nil {
3365 return "<nil>"
3366 }
3367 return fmt.Sprintf("GetTraceIdsBySpanNameResult(%+v)", *p)
3368 }
3369
3370 type GetTraceIdsByServiceNameArgs struct {
3371 ServiceName string `thrift:"service_name,1" json:"service_name"`
3372 // unused field # 2
3373 EndTs int64 `thrift:"end_ts,3" json:"end_ts"`
3374 Limit int32 `thrift:"limit,4" json:"limit"`
3375 Order Order `thrift:"order,5" json:"order"`
3376 }
3377
3378 func NewGetTraceIdsByServiceNameArgs() *GetTraceIdsByServiceNameArgs {
3379 return &GetTraceIdsByServiceNameArgs{}
3380 }
3381
3382 func (p *GetTraceIdsByServiceNameArgs) GetServiceName() string {
3383 return p.ServiceName
3384 }
3385
3386 func (p *GetTraceIdsByServiceNameArgs) GetEndTs() int64 {
3387 return p.EndTs
3388 }
3389
3390 func (p *GetTraceIdsByServiceNameArgs) GetLimit() int32 {
3391 return p.Limit
3392 }
3393
3394 func (p *GetTraceIdsByServiceNameArgs) GetOrder() Order {
3395 return p.Order
3396 }
3397 func (p *GetTraceIdsByServiceNameArgs) Read(iprot thrift.TProtocol) error {
3398 if _, err := iprot.ReadStructBegin(); err != nil {
3399 return fmt.Errorf("%T read error: %s", p, err)
3400 }
3401 for {
3402 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
3403 if err != nil {
3404 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
3405 }
3406 if fieldTypeId == thrift.STOP {
3407 break
3408 }
3409 switch fieldId {
3410 case 1:
3411 if err := p.ReadField1(iprot); err != nil {
3412 return err
3413 }
3414 case 3:
3415 if err := p.ReadField3(iprot); err != nil {
3416 return err
3417 }
3418 case 4:
3419 if err := p.ReadField4(iprot); err != nil {
3420 return err
3421 }
3422 case 5:
3423 if err := p.ReadField5(iprot); err != nil {
3424 return err
3425 }
3426 default:
3427 if err := iprot.Skip(fieldTypeId); err != nil {
3428 return err
3429 }
3430 }
3431 if err := iprot.ReadFieldEnd(); err != nil {
3432 return err
3433 }
3434 }
3435 if err := iprot.ReadStructEnd(); err != nil {
3436 return fmt.Errorf("%T read struct end error: %s", p, err)
3437 }
3438 return nil
3439 }
3440
3441 func (p *GetTraceIdsByServiceNameArgs) ReadField1(iprot thrift.TProtocol) error {
3442 if v, err := iprot.ReadString(); err != nil {
3443 return fmt.Errorf("error reading field 1: %s", err)
3444 } else {
3445 p.ServiceName = v
3446 }
3447 return nil
3448 }
3449
3450 func (p *GetTraceIdsByServiceNameArgs) ReadField3(iprot thrift.TProtocol) error {
3451 if v, err := iprot.ReadI64(); err != nil {
3452 return fmt.Errorf("error reading field 3: %s", err)
3453 } else {
3454 p.EndTs = v
3455 }
3456 return nil
3457 }
3458
3459 func (p *GetTraceIdsByServiceNameArgs) ReadField4(iprot thrift.TProtocol) error {
3460 if v, err := iprot.ReadI32(); err != nil {
3461 return fmt.Errorf("error reading field 4: %s", err)
3462 } else {
3463 p.Limit = v
3464 }
3465 return nil
3466 }
3467
3468 func (p *GetTraceIdsByServiceNameArgs) ReadField5(iprot thrift.TProtocol) error {
3469 if v, err := iprot.ReadI32(); err != nil {
3470 return fmt.Errorf("error reading field 5: %s", err)
3471 } else {
3472 temp := Order(v)
3473 p.Order = temp
3474 }
3475 return nil
3476 }
3477
3478 func (p *GetTraceIdsByServiceNameArgs) Write(oprot thrift.TProtocol) error {
3479 if err := oprot.WriteStructBegin("getTraceIdsByServiceName_args"); err != nil {
3480 return fmt.Errorf("%T write struct begin error: %s", p, err)
3481 }
3482 if err := p.writeField1(oprot); err != nil {
3483 return err
3484 }
3485 if err := p.writeField3(oprot); err != nil {
3486 return err
3487 }
3488 if err := p.writeField4(oprot); err != nil {
3489 return err
3490 }
3491 if err := p.writeField5(oprot); err != nil {
3492 return err
3493 }
3494 if err := oprot.WriteFieldStop(); err != nil {
3495 return fmt.Errorf("write field stop error: %s", err)
3496 }
3497 if err := oprot.WriteStructEnd(); err != nil {
3498 return fmt.Errorf("write struct stop error: %s", err)
3499 }
3500 return nil
3501 }
3502
3503 func (p *GetTraceIdsByServiceNameArgs) writeField1(oprot thrift.TProtocol) (err error) {
3504 if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil {
3505 return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err)
3506 }
3507 if err := oprot.WriteString(string(p.ServiceName)); err != nil {
3508 return fmt.Errorf("%T.service_name (1) field write error: %s", p, err)
3509 }
3510 if err := oprot.WriteFieldEnd(); err != nil {
3511 return fmt.Errorf("%T write field end error 1:service_name: %s", p, err)
3512 }
3513 return err
3514 }
3515
3516 func (p *GetTraceIdsByServiceNameArgs) writeField3(oprot thrift.TProtocol) (err error) {
3517 if err := oprot.WriteFieldBegin("end_ts", thrift.I64, 3); err != nil {
3518 return fmt.Errorf("%T write field begin error 3:end_ts: %s", p, err)
3519 }
3520 if err := oprot.WriteI64(int64(p.EndTs)); err != nil {
3521 return fmt.Errorf("%T.end_ts (3) field write error: %s", p, err)
3522 }
3523 if err := oprot.WriteFieldEnd(); err != nil {
3524 return fmt.Errorf("%T write field end error 3:end_ts: %s", p, err)
3525 }
3526 return err
3527 }
3528
3529 func (p *GetTraceIdsByServiceNameArgs) writeField4(oprot thrift.TProtocol) (err error) {
3530 if err := oprot.WriteFieldBegin("limit", thrift.I32, 4); err != nil {
3531 return fmt.Errorf("%T write field begin error 4:limit: %s", p, err)
3532 }
3533 if err := oprot.WriteI32(int32(p.Limit)); err != nil {
3534 return fmt.Errorf("%T.limit (4) field write error: %s", p, err)
3535 }
3536 if err := oprot.WriteFieldEnd(); err != nil {
3537 return fmt.Errorf("%T write field end error 4:limit: %s", p, err)
3538 }
3539 return err
3540 }
3541
3542 func (p *GetTraceIdsByServiceNameArgs) writeField5(oprot thrift.TProtocol) (err error) {
3543 if err := oprot.WriteFieldBegin("order", thrift.I32, 5); err != nil {
3544 return fmt.Errorf("%T write field begin error 5:order: %s", p, err)
3545 }
3546 if err := oprot.WriteI32(int32(p.Order)); err != nil {
3547 return fmt.Errorf("%T.order (5) field write error: %s", p, err)
3548 }
3549 if err := oprot.WriteFieldEnd(); err != nil {
3550 return fmt.Errorf("%T write field end error 5:order: %s", p, err)
3551 }
3552 return err
3553 }
3554
3555 func (p *GetTraceIdsByServiceNameArgs) String() string {
3556 if p == nil {
3557 return "<nil>"
3558 }
3559 return fmt.Sprintf("GetTraceIdsByServiceNameArgs(%+v)", *p)
3560 }
3561
3562 type GetTraceIdsByServiceNameResult struct {
3563 Success []int64 `thrift:"success,0" json:"success"`
3564 Qe *QueryException `thrift:"qe,1" json:"qe"`
3565 }
3566
3567 func NewGetTraceIdsByServiceNameResult() *GetTraceIdsByServiceNameResult {
3568 return &GetTraceIdsByServiceNameResult{}
3569 }
3570
3571 var GetTraceIdsByServiceNameResult_Success_DEFAULT []int64
3572
3573 func (p *GetTraceIdsByServiceNameResult) GetSuccess() []int64 {
3574 return p.Success
3575 }
3576
3577 var GetTraceIdsByServiceNameResult_Qe_DEFAULT *QueryException
3578
3579 func (p *GetTraceIdsByServiceNameResult) GetQe() *QueryException {
3580 if !p.IsSetQe() {
3581 return GetTraceIdsByServiceNameResult_Qe_DEFAULT
3582 }
3583 return p.Qe
3584 }
3585 func (p *GetTraceIdsByServiceNameResult) IsSetSuccess() bool {
3586 return p.Success != nil
3587 }
3588
3589 func (p *GetTraceIdsByServiceNameResult) IsSetQe() bool {
3590 return p.Qe != nil
3591 }
3592
3593 func (p *GetTraceIdsByServiceNameResult) Read(iprot thrift.TProtocol) error {
3594 if _, err := iprot.ReadStructBegin(); err != nil {
3595 return fmt.Errorf("%T read error: %s", p, err)
3596 }
3597 for {
3598 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
3599 if err != nil {
3600 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
3601 }
3602 if fieldTypeId == thrift.STOP {
3603 break
3604 }
3605 switch fieldId {
3606 case 0:
3607 if err := p.ReadField0(iprot); err != nil {
3608 return err
3609 }
3610 case 1:
3611 if err := p.ReadField1(iprot); err != nil {
3612 return err
3613 }
3614 default:
3615 if err := iprot.Skip(fieldTypeId); err != nil {
3616 return err
3617 }
3618 }
3619 if err := iprot.ReadFieldEnd(); err != nil {
3620 return err
3621 }
3622 }
3623 if err := iprot.ReadStructEnd(); err != nil {
3624 return fmt.Errorf("%T read struct end error: %s", p, err)
3625 }
3626 return nil
3627 }
3628
3629 func (p *GetTraceIdsByServiceNameResult) ReadField0(iprot thrift.TProtocol) error {
3630 _, size, err := iprot.ReadListBegin()
3631 if err != nil {
3632 return fmt.Errorf("error reading list begin: %s", err)
3633 }
3634 tSlice := make([]int64, 0, size)
3635 p.Success = tSlice
3636 for i := 0; i < size; i++ {
3637 var _elem51 int64
3638 if v, err := iprot.ReadI64(); err != nil {
3639 return fmt.Errorf("error reading field 0: %s", err)
3640 } else {
3641 _elem51 = v
3642 }
3643 p.Success = append(p.Success, _elem51)
3644 }
3645 if err := iprot.ReadListEnd(); err != nil {
3646 return fmt.Errorf("error reading list end: %s", err)
3647 }
3648 return nil
3649 }
3650
3651 func (p *GetTraceIdsByServiceNameResult) ReadField1(iprot thrift.TProtocol) error {
3652 p.Qe = &QueryException{}
3653 if err := p.Qe.Read(iprot); err != nil {
3654 return fmt.Errorf("%T error reading struct: %s", p.Qe, err)
3655 }
3656 return nil
3657 }
3658
3659 func (p *GetTraceIdsByServiceNameResult) Write(oprot thrift.TProtocol) error {
3660 if err := oprot.WriteStructBegin("getTraceIdsByServiceName_result"); err != nil {
3661 return fmt.Errorf("%T write struct begin error: %s", p, err)
3662 }
3663 if err := p.writeField0(oprot); err != nil {
3664 return err
3665 }
3666 if err := p.writeField1(oprot); err != nil {
3667 return err
3668 }
3669 if err := oprot.WriteFieldStop(); err != nil {
3670 return fmt.Errorf("write field stop error: %s", err)
3671 }
3672 if err := oprot.WriteStructEnd(); err != nil {
3673 return fmt.Errorf("write struct stop error: %s", err)
3674 }
3675 return nil
3676 }
3677
3678 func (p *GetTraceIdsByServiceNameResult) writeField0(oprot thrift.TProtocol) (err error) {
3679 if p.IsSetSuccess() {
3680 if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil {
3681 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
3682 }
3683 if err := oprot.WriteListBegin(thrift.I64, len(p.Success)); err != nil {
3684 return fmt.Errorf("error writing list begin: %s", err)
3685 }
3686 for _, v := range p.Success {
3687 if err := oprot.WriteI64(int64(v)); err != nil {
3688 return fmt.Errorf("%T. (0) field write error: %s", p, err)
3689 }
3690 }
3691 if err := oprot.WriteListEnd(); err != nil {
3692 return fmt.Errorf("error writing list end: %s", err)
3693 }
3694 if err := oprot.WriteFieldEnd(); err != nil {
3695 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
3696 }
3697 }
3698 return err
3699 }
3700
3701 func (p *GetTraceIdsByServiceNameResult) writeField1(oprot thrift.TProtocol) (err error) {
3702 if p.IsSetQe() {
3703 if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil {
3704 return fmt.Errorf("%T write field begin error 1:qe: %s", p, err)
3705 }
3706 if err := p.Qe.Write(oprot); err != nil {
3707 return fmt.Errorf("%T error writing struct: %s", p.Qe, err)
3708 }
3709 if err := oprot.WriteFieldEnd(); err != nil {
3710 return fmt.Errorf("%T write field end error 1:qe: %s", p, err)
3711 }
3712 }
3713 return err
3714 }
3715
3716 func (p *GetTraceIdsByServiceNameResult) String() string {
3717 if p == nil {
3718 return "<nil>"
3719 }
3720 return fmt.Sprintf("GetTraceIdsByServiceNameResult(%+v)", *p)
3721 }
3722
3723 type GetTraceIdsByAnnotationArgs struct {
3724 ServiceName string `thrift:"service_name,1" json:"service_name"`
3725 Annotation string `thrift:"annotation,2" json:"annotation"`
3726 Value []byte `thrift:"value,3" json:"value"`
3727 // unused field # 4
3728 EndTs int64 `thrift:"end_ts,5" json:"end_ts"`
3729 Limit int32 `thrift:"limit,6" json:"limit"`
3730 Order Order `thrift:"order,7" json:"order"`
3731 }
3732
3733 func NewGetTraceIdsByAnnotationArgs() *GetTraceIdsByAnnotationArgs {
3734 return &GetTraceIdsByAnnotationArgs{}
3735 }
3736
3737 func (p *GetTraceIdsByAnnotationArgs) GetServiceName() string {
3738 return p.ServiceName
3739 }
3740
3741 func (p *GetTraceIdsByAnnotationArgs) GetAnnotation() string {
3742 return p.Annotation
3743 }
3744
3745 func (p *GetTraceIdsByAnnotationArgs) GetValue() []byte {
3746 return p.Value
3747 }
3748
3749 func (p *GetTraceIdsByAnnotationArgs) GetEndTs() int64 {
3750 return p.EndTs
3751 }
3752
3753 func (p *GetTraceIdsByAnnotationArgs) GetLimit() int32 {
3754 return p.Limit
3755 }
3756
3757 func (p *GetTraceIdsByAnnotationArgs) GetOrder() Order {
3758 return p.Order
3759 }
3760 func (p *GetTraceIdsByAnnotationArgs) Read(iprot thrift.TProtocol) error {
3761 if _, err := iprot.ReadStructBegin(); err != nil {
3762 return fmt.Errorf("%T read error: %s", p, err)
3763 }
3764 for {
3765 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
3766 if err != nil {
3767 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
3768 }
3769 if fieldTypeId == thrift.STOP {
3770 break
3771 }
3772 switch fieldId {
3773 case 1:
3774 if err := p.ReadField1(iprot); err != nil {
3775 return err
3776 }
3777 case 2:
3778 if err := p.ReadField2(iprot); err != nil {
3779 return err
3780 }
3781 case 3:
3782 if err := p.ReadField3(iprot); err != nil {
3783 return err
3784 }
3785 case 5:
3786 if err := p.ReadField5(iprot); err != nil {
3787 return err
3788 }
3789 case 6:
3790 if err := p.ReadField6(iprot); err != nil {
3791 return err
3792 }
3793 case 7:
3794 if err := p.ReadField7(iprot); err != nil {
3795 return err
3796 }
3797 default:
3798 if err := iprot.Skip(fieldTypeId); err != nil {
3799 return err
3800 }
3801 }
3802 if err := iprot.ReadFieldEnd(); err != nil {
3803 return err
3804 }
3805 }
3806 if err := iprot.ReadStructEnd(); err != nil {
3807 return fmt.Errorf("%T read struct end error: %s", p, err)
3808 }
3809 return nil
3810 }
3811
3812 func (p *GetTraceIdsByAnnotationArgs) ReadField1(iprot thrift.TProtocol) error {
3813 if v, err := iprot.ReadString(); err != nil {
3814 return fmt.Errorf("error reading field 1: %s", err)
3815 } else {
3816 p.ServiceName = v
3817 }
3818 return nil
3819 }
3820
3821 func (p *GetTraceIdsByAnnotationArgs) ReadField2(iprot thrift.TProtocol) error {
3822 if v, err := iprot.ReadString(); err != nil {
3823 return fmt.Errorf("error reading field 2: %s", err)
3824 } else {
3825 p.Annotation = v
3826 }
3827 return nil
3828 }
3829
3830 func (p *GetTraceIdsByAnnotationArgs) ReadField3(iprot thrift.TProtocol) error {
3831 if v, err := iprot.ReadBinary(); err != nil {
3832 return fmt.Errorf("error reading field 3: %s", err)
3833 } else {
3834 p.Value = v
3835 }
3836 return nil
3837 }
3838
3839 func (p *GetTraceIdsByAnnotationArgs) ReadField5(iprot thrift.TProtocol) error {
3840 if v, err := iprot.ReadI64(); err != nil {
3841 return fmt.Errorf("error reading field 5: %s", err)
3842 } else {
3843 p.EndTs = v
3844 }
3845 return nil
3846 }
3847
3848 func (p *GetTraceIdsByAnnotationArgs) ReadField6(iprot thrift.TProtocol) error {
3849 if v, err := iprot.ReadI32(); err != nil {
3850 return fmt.Errorf("error reading field 6: %s", err)
3851 } else {
3852 p.Limit = v
3853 }
3854 return nil
3855 }
3856
3857 func (p *GetTraceIdsByAnnotationArgs) ReadField7(iprot thrift.TProtocol) error {
3858 if v, err := iprot.ReadI32(); err != nil {
3859 return fmt.Errorf("error reading field 7: %s", err)
3860 } else {
3861 temp := Order(v)
3862 p.Order = temp
3863 }
3864 return nil
3865 }
3866
3867 func (p *GetTraceIdsByAnnotationArgs) Write(oprot thrift.TProtocol) error {
3868 if err := oprot.WriteStructBegin("getTraceIdsByAnnotation_args"); err != nil {
3869 return fmt.Errorf("%T write struct begin error: %s", p, err)
3870 }
3871 if err := p.writeField1(oprot); err != nil {
3872 return err
3873 }
3874 if err := p.writeField2(oprot); err != nil {
3875 return err
3876 }
3877 if err := p.writeField3(oprot); err != nil {
3878 return err
3879 }
3880 if err := p.writeField5(oprot); err != nil {
3881 return err
3882 }
3883 if err := p.writeField6(oprot); err != nil {
3884 return err
3885 }
3886 if err := p.writeField7(oprot); err != nil {
3887 return err
3888 }
3889 if err := oprot.WriteFieldStop(); err != nil {
3890 return fmt.Errorf("write field stop error: %s", err)
3891 }
3892 if err := oprot.WriteStructEnd(); err != nil {
3893 return fmt.Errorf("write struct stop error: %s", err)
3894 }
3895 return nil
3896 }
3897
3898 func (p *GetTraceIdsByAnnotationArgs) writeField1(oprot thrift.TProtocol) (err error) {
3899 if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil {
3900 return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err)
3901 }
3902 if err := oprot.WriteString(string(p.ServiceName)); err != nil {
3903 return fmt.Errorf("%T.service_name (1) field write error: %s", p, err)
3904 }
3905 if err := oprot.WriteFieldEnd(); err != nil {
3906 return fmt.Errorf("%T write field end error 1:service_name: %s", p, err)
3907 }
3908 return err
3909 }
3910
3911 func (p *GetTraceIdsByAnnotationArgs) writeField2(oprot thrift.TProtocol) (err error) {
3912 if err := oprot.WriteFieldBegin("annotation", thrift.STRING, 2); err != nil {
3913 return fmt.Errorf("%T write field begin error 2:annotation: %s", p, err)
3914 }
3915 if err := oprot.WriteString(string(p.Annotation)); err != nil {
3916 return fmt.Errorf("%T.annotation (2) field write error: %s", p, err)
3917 }
3918 if err := oprot.WriteFieldEnd(); err != nil {
3919 return fmt.Errorf("%T write field end error 2:annotation: %s", p, err)
3920 }
3921 return err
3922 }
3923
3924 func (p *GetTraceIdsByAnnotationArgs) writeField3(oprot thrift.TProtocol) (err error) {
3925 if err := oprot.WriteFieldBegin("value", thrift.STRING, 3); err != nil {
3926 return fmt.Errorf("%T write field begin error 3:value: %s", p, err)
3927 }
3928 if err := oprot.WriteBinary(p.Value); err != nil {
3929 return fmt.Errorf("%T.value (3) field write error: %s", p, err)
3930 }
3931 if err := oprot.WriteFieldEnd(); err != nil {
3932 return fmt.Errorf("%T write field end error 3:value: %s", p, err)
3933 }
3934 return err
3935 }
3936
3937 func (p *GetTraceIdsByAnnotationArgs) writeField5(oprot thrift.TProtocol) (err error) {
3938 if err := oprot.WriteFieldBegin("end_ts", thrift.I64, 5); err != nil {
3939 return fmt.Errorf("%T write field begin error 5:end_ts: %s", p, err)
3940 }
3941 if err := oprot.WriteI64(int64(p.EndTs)); err != nil {
3942 return fmt.Errorf("%T.end_ts (5) field write error: %s", p, err)
3943 }
3944 if err := oprot.WriteFieldEnd(); err != nil {
3945 return fmt.Errorf("%T write field end error 5:end_ts: %s", p, err)
3946 }
3947 return err
3948 }
3949
3950 func (p *GetTraceIdsByAnnotationArgs) writeField6(oprot thrift.TProtocol) (err error) {
3951 if err := oprot.WriteFieldBegin("limit", thrift.I32, 6); err != nil {
3952 return fmt.Errorf("%T write field begin error 6:limit: %s", p, err)
3953 }
3954 if err := oprot.WriteI32(int32(p.Limit)); err != nil {
3955 return fmt.Errorf("%T.limit (6) field write error: %s", p, err)
3956 }
3957 if err := oprot.WriteFieldEnd(); err != nil {
3958 return fmt.Errorf("%T write field end error 6:limit: %s", p, err)
3959 }
3960 return err
3961 }
3962
3963 func (p *GetTraceIdsByAnnotationArgs) writeField7(oprot thrift.TProtocol) (err error) {
3964 if err := oprot.WriteFieldBegin("order", thrift.I32, 7); err != nil {
3965 return fmt.Errorf("%T write field begin error 7:order: %s", p, err)
3966 }
3967 if err := oprot.WriteI32(int32(p.Order)); err != nil {
3968 return fmt.Errorf("%T.order (7) field write error: %s", p, err)
3969 }
3970 if err := oprot.WriteFieldEnd(); err != nil {
3971 return fmt.Errorf("%T write field end error 7:order: %s", p, err)
3972 }
3973 return err
3974 }
3975
3976 func (p *GetTraceIdsByAnnotationArgs) String() string {
3977 if p == nil {
3978 return "<nil>"
3979 }
3980 return fmt.Sprintf("GetTraceIdsByAnnotationArgs(%+v)", *p)
3981 }
3982
3983 type GetTraceIdsByAnnotationResult struct {
3984 Success []int64 `thrift:"success,0" json:"success"`
3985 Qe *QueryException `thrift:"qe,1" json:"qe"`
3986 }
3987
3988 func NewGetTraceIdsByAnnotationResult() *GetTraceIdsByAnnotationResult {
3989 return &GetTraceIdsByAnnotationResult{}
3990 }
3991
3992 var GetTraceIdsByAnnotationResult_Success_DEFAULT []int64
3993
3994 func (p *GetTraceIdsByAnnotationResult) GetSuccess() []int64 {
3995 return p.Success
3996 }
3997
3998 var GetTraceIdsByAnnotationResult_Qe_DEFAULT *QueryException
3999
4000 func (p *GetTraceIdsByAnnotationResult) GetQe() *QueryException {
4001 if !p.IsSetQe() {
4002 return GetTraceIdsByAnnotationResult_Qe_DEFAULT
4003 }
4004 return p.Qe
4005 }
4006 func (p *GetTraceIdsByAnnotationResult) IsSetSuccess() bool {
4007 return p.Success != nil
4008 }
4009
4010 func (p *GetTraceIdsByAnnotationResult) IsSetQe() bool {
4011 return p.Qe != nil
4012 }
4013
4014 func (p *GetTraceIdsByAnnotationResult) Read(iprot thrift.TProtocol) error {
4015 if _, err := iprot.ReadStructBegin(); err != nil {
4016 return fmt.Errorf("%T read error: %s", p, err)
4017 }
4018 for {
4019 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
4020 if err != nil {
4021 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
4022 }
4023 if fieldTypeId == thrift.STOP {
4024 break
4025 }
4026 switch fieldId {
4027 case 0:
4028 if err := p.ReadField0(iprot); err != nil {
4029 return err
4030 }
4031 case 1:
4032 if err := p.ReadField1(iprot); err != nil {
4033 return err
4034 }
4035 default:
4036 if err := iprot.Skip(fieldTypeId); err != nil {
4037 return err
4038 }
4039 }
4040 if err := iprot.ReadFieldEnd(); err != nil {
4041 return err
4042 }
4043 }
4044 if err := iprot.ReadStructEnd(); err != nil {
4045 return fmt.Errorf("%T read struct end error: %s", p, err)
4046 }
4047 return nil
4048 }
4049
4050 func (p *GetTraceIdsByAnnotationResult) ReadField0(iprot thrift.TProtocol) error {
4051 _, size, err := iprot.ReadListBegin()
4052 if err != nil {
4053 return fmt.Errorf("error reading list begin: %s", err)
4054 }
4055 tSlice := make([]int64, 0, size)
4056 p.Success = tSlice
4057 for i := 0; i < size; i++ {
4058 var _elem52 int64
4059 if v, err := iprot.ReadI64(); err != nil {
4060 return fmt.Errorf("error reading field 0: %s", err)
4061 } else {
4062 _elem52 = v
4063 }
4064 p.Success = append(p.Success, _elem52)
4065 }
4066 if err := iprot.ReadListEnd(); err != nil {
4067 return fmt.Errorf("error reading list end: %s", err)
4068 }
4069 return nil
4070 }
4071
4072 func (p *GetTraceIdsByAnnotationResult) ReadField1(iprot thrift.TProtocol) error {
4073 p.Qe = &QueryException{}
4074 if err := p.Qe.Read(iprot); err != nil {
4075 return fmt.Errorf("%T error reading struct: %s", p.Qe, err)
4076 }
4077 return nil
4078 }
4079
4080 func (p *GetTraceIdsByAnnotationResult) Write(oprot thrift.TProtocol) error {
4081 if err := oprot.WriteStructBegin("getTraceIdsByAnnotation_result"); err != nil {
4082 return fmt.Errorf("%T write struct begin error: %s", p, err)
4083 }
4084 if err := p.writeField0(oprot); err != nil {
4085 return err
4086 }
4087 if err := p.writeField1(oprot); err != nil {
4088 return err
4089 }
4090 if err := oprot.WriteFieldStop(); err != nil {
4091 return fmt.Errorf("write field stop error: %s", err)
4092 }
4093 if err := oprot.WriteStructEnd(); err != nil {
4094 return fmt.Errorf("write struct stop error: %s", err)
4095 }
4096 return nil
4097 }
4098
4099 func (p *GetTraceIdsByAnnotationResult) writeField0(oprot thrift.TProtocol) (err error) {
4100 if p.IsSetSuccess() {
4101 if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil {
4102 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
4103 }
4104 if err := oprot.WriteListBegin(thrift.I64, len(p.Success)); err != nil {
4105 return fmt.Errorf("error writing list begin: %s", err)
4106 }
4107 for _, v := range p.Success {
4108 if err := oprot.WriteI64(int64(v)); err != nil {
4109 return fmt.Errorf("%T. (0) field write error: %s", p, err)
4110 }
4111 }
4112 if err := oprot.WriteListEnd(); err != nil {
4113 return fmt.Errorf("error writing list end: %s", err)
4114 }
4115 if err := oprot.WriteFieldEnd(); err != nil {
4116 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
4117 }
4118 }
4119 return err
4120 }
4121
4122 func (p *GetTraceIdsByAnnotationResult) writeField1(oprot thrift.TProtocol) (err error) {
4123 if p.IsSetQe() {
4124 if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil {
4125 return fmt.Errorf("%T write field begin error 1:qe: %s", p, err)
4126 }
4127 if err := p.Qe.Write(oprot); err != nil {
4128 return fmt.Errorf("%T error writing struct: %s", p.Qe, err)
4129 }
4130 if err := oprot.WriteFieldEnd(); err != nil {
4131 return fmt.Errorf("%T write field end error 1:qe: %s", p, err)
4132 }
4133 }
4134 return err
4135 }
4136
4137 func (p *GetTraceIdsByAnnotationResult) String() string {
4138 if p == nil {
4139 return "<nil>"
4140 }
4141 return fmt.Sprintf("GetTraceIdsByAnnotationResult(%+v)", *p)
4142 }
4143
4144 type TracesExistArgs struct {
4145 TraceIds []int64 `thrift:"trace_ids,1" json:"trace_ids"`
4146 }
4147
4148 func NewTracesExistArgs() *TracesExistArgs {
4149 return &TracesExistArgs{}
4150 }
4151
4152 func (p *TracesExistArgs) GetTraceIds() []int64 {
4153 return p.TraceIds
4154 }
4155 func (p *TracesExistArgs) Read(iprot thrift.TProtocol) error {
4156 if _, err := iprot.ReadStructBegin(); err != nil {
4157 return fmt.Errorf("%T read error: %s", p, err)
4158 }
4159 for {
4160 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
4161 if err != nil {
4162 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
4163 }
4164 if fieldTypeId == thrift.STOP {
4165 break
4166 }
4167 switch fieldId {
4168 case 1:
4169 if err := p.ReadField1(iprot); err != nil {
4170 return err
4171 }
4172 default:
4173 if err := iprot.Skip(fieldTypeId); err != nil {
4174 return err
4175 }
4176 }
4177 if err := iprot.ReadFieldEnd(); err != nil {
4178 return err
4179 }
4180 }
4181 if err := iprot.ReadStructEnd(); err != nil {
4182 return fmt.Errorf("%T read struct end error: %s", p, err)
4183 }
4184 return nil
4185 }
4186
4187 func (p *TracesExistArgs) ReadField1(iprot thrift.TProtocol) error {
4188 _, size, err := iprot.ReadListBegin()
4189 if err != nil {
4190 return fmt.Errorf("error reading list begin: %s", err)
4191 }
4192 tSlice := make([]int64, 0, size)
4193 p.TraceIds = tSlice
4194 for i := 0; i < size; i++ {
4195 var _elem53 int64
4196 if v, err := iprot.ReadI64(); err != nil {
4197 return fmt.Errorf("error reading field 0: %s", err)
4198 } else {
4199 _elem53 = v
4200 }
4201 p.TraceIds = append(p.TraceIds, _elem53)
4202 }
4203 if err := iprot.ReadListEnd(); err != nil {
4204 return fmt.Errorf("error reading list end: %s", err)
4205 }
4206 return nil
4207 }
4208
4209 func (p *TracesExistArgs) Write(oprot thrift.TProtocol) error {
4210 if err := oprot.WriteStructBegin("tracesExist_args"); err != nil {
4211 return fmt.Errorf("%T write struct begin error: %s", p, err)
4212 }
4213 if err := p.writeField1(oprot); err != nil {
4214 return err
4215 }
4216 if err := oprot.WriteFieldStop(); err != nil {
4217 return fmt.Errorf("write field stop error: %s", err)
4218 }
4219 if err := oprot.WriteStructEnd(); err != nil {
4220 return fmt.Errorf("write struct stop error: %s", err)
4221 }
4222 return nil
4223 }
4224
4225 func (p *TracesExistArgs) writeField1(oprot thrift.TProtocol) (err error) {
4226 if err := oprot.WriteFieldBegin("trace_ids", thrift.LIST, 1); err != nil {
4227 return fmt.Errorf("%T write field begin error 1:trace_ids: %s", p, err)
4228 }
4229 if err := oprot.WriteListBegin(thrift.I64, len(p.TraceIds)); err != nil {
4230 return fmt.Errorf("error writing list begin: %s", err)
4231 }
4232 for _, v := range p.TraceIds {
4233 if err := oprot.WriteI64(int64(v)); err != nil {
4234 return fmt.Errorf("%T. (0) field write error: %s", p, err)
4235 }
4236 }
4237 if err := oprot.WriteListEnd(); err != nil {
4238 return fmt.Errorf("error writing list end: %s", err)
4239 }
4240 if err := oprot.WriteFieldEnd(); err != nil {
4241 return fmt.Errorf("%T write field end error 1:trace_ids: %s", p, err)
4242 }
4243 return err
4244 }
4245
4246 func (p *TracesExistArgs) String() string {
4247 if p == nil {
4248 return "<nil>"
4249 }
4250 return fmt.Sprintf("TracesExistArgs(%+v)", *p)
4251 }
4252
4253 type TracesExistResult struct {
4254 Success map[int64]bool `thrift:"success,0" json:"success"`
4255 Qe *QueryException `thrift:"qe,1" json:"qe"`
4256 }
4257
4258 func NewTracesExistResult() *TracesExistResult {
4259 return &TracesExistResult{}
4260 }
4261
4262 var TracesExistResult_Success_DEFAULT map[int64]bool
4263
4264 func (p *TracesExistResult) GetSuccess() map[int64]bool {
4265 return p.Success
4266 }
4267
4268 var TracesExistResult_Qe_DEFAULT *QueryException
4269
4270 func (p *TracesExistResult) GetQe() *QueryException {
4271 if !p.IsSetQe() {
4272 return TracesExistResult_Qe_DEFAULT
4273 }
4274 return p.Qe
4275 }
4276 func (p *TracesExistResult) IsSetSuccess() bool {
4277 return p.Success != nil
4278 }
4279
4280 func (p *TracesExistResult) IsSetQe() bool {
4281 return p.Qe != nil
4282 }
4283
4284 func (p *TracesExistResult) Read(iprot thrift.TProtocol) error {
4285 if _, err := iprot.ReadStructBegin(); err != nil {
4286 return fmt.Errorf("%T read error: %s", p, err)
4287 }
4288 for {
4289 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
4290 if err != nil {
4291 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
4292 }
4293 if fieldTypeId == thrift.STOP {
4294 break
4295 }
4296 switch fieldId {
4297 case 0:
4298 if err := p.ReadField0(iprot); err != nil {
4299 return err
4300 }
4301 case 1:
4302 if err := p.ReadField1(iprot); err != nil {
4303 return err
4304 }
4305 default:
4306 if err := iprot.Skip(fieldTypeId); err != nil {
4307 return err
4308 }
4309 }
4310 if err := iprot.ReadFieldEnd(); err != nil {
4311 return err
4312 }
4313 }
4314 if err := iprot.ReadStructEnd(); err != nil {
4315 return fmt.Errorf("%T read struct end error: %s", p, err)
4316 }
4317 return nil
4318 }
4319
4320 func (p *TracesExistResult) ReadField0(iprot thrift.TProtocol) error {
4321 _, size, err := iprot.ReadSetBegin()
4322 if err != nil {
4323 return fmt.Errorf("error reading set begin: %s", err)
4324 }
4325 tSet := make(map[int64]bool, size)
4326 p.Success = tSet
4327 for i := 0; i < size; i++ {
4328 var _elem54 int64
4329 if v, err := iprot.ReadI64(); err != nil {
4330 return fmt.Errorf("error reading field 0: %s", err)
4331 } else {
4332 _elem54 = v
4333 }
4334 p.Success[_elem54] = true
4335 }
4336 if err := iprot.ReadSetEnd(); err != nil {
4337 return fmt.Errorf("error reading set end: %s", err)
4338 }
4339 return nil
4340 }
4341
4342 func (p *TracesExistResult) ReadField1(iprot thrift.TProtocol) error {
4343 p.Qe = &QueryException{}
4344 if err := p.Qe.Read(iprot); err != nil {
4345 return fmt.Errorf("%T error reading struct: %s", p.Qe, err)
4346 }
4347 return nil
4348 }
4349
4350 func (p *TracesExistResult) Write(oprot thrift.TProtocol) error {
4351 if err := oprot.WriteStructBegin("tracesExist_result"); err != nil {
4352 return fmt.Errorf("%T write struct begin error: %s", p, err)
4353 }
4354 if err := p.writeField0(oprot); err != nil {
4355 return err
4356 }
4357 if err := p.writeField1(oprot); err != nil {
4358 return err
4359 }
4360 if err := oprot.WriteFieldStop(); err != nil {
4361 return fmt.Errorf("write field stop error: %s", err)
4362 }
4363 if err := oprot.WriteStructEnd(); err != nil {
4364 return fmt.Errorf("write struct stop error: %s", err)
4365 }
4366 return nil
4367 }
4368
4369 func (p *TracesExistResult) writeField0(oprot thrift.TProtocol) (err error) {
4370 if p.IsSetSuccess() {
4371 if err := oprot.WriteFieldBegin("success", thrift.SET, 0); err != nil {
4372 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
4373 }
4374 if err := oprot.WriteSetBegin(thrift.I64, len(p.Success)); err != nil {
4375 return fmt.Errorf("error writing set begin: %s", err)
4376 }
4377 for v, _ := range p.Success {
4378 if err := oprot.WriteI64(int64(v)); err != nil {
4379 return fmt.Errorf("%T. (0) field write error: %s", p, err)
4380 }
4381 }
4382 if err := oprot.WriteSetEnd(); err != nil {
4383 return fmt.Errorf("error writing set end: %s", err)
4384 }
4385 if err := oprot.WriteFieldEnd(); err != nil {
4386 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
4387 }
4388 }
4389 return err
4390 }
4391
4392 func (p *TracesExistResult) writeField1(oprot thrift.TProtocol) (err error) {
4393 if p.IsSetQe() {
4394 if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil {
4395 return fmt.Errorf("%T write field begin error 1:qe: %s", p, err)
4396 }
4397 if err := p.Qe.Write(oprot); err != nil {
4398 return fmt.Errorf("%T error writing struct: %s", p.Qe, err)
4399 }
4400 if err := oprot.WriteFieldEnd(); err != nil {
4401 return fmt.Errorf("%T write field end error 1:qe: %s", p, err)
4402 }
4403 }
4404 return err
4405 }
4406
4407 func (p *TracesExistResult) String() string {
4408 if p == nil {
4409 return "<nil>"
4410 }
4411 return fmt.Sprintf("TracesExistResult(%+v)", *p)
4412 }
4413
4414 type GetTracesByIdsArgs struct {
4415 TraceIds []int64 `thrift:"trace_ids,1" json:"trace_ids"`
4416 Adjust []Adjust `thrift:"adjust,2" json:"adjust"`
4417 }
4418
4419 func NewGetTracesByIdsArgs() *GetTracesByIdsArgs {
4420 return &GetTracesByIdsArgs{}
4421 }
4422
4423 func (p *GetTracesByIdsArgs) GetTraceIds() []int64 {
4424 return p.TraceIds
4425 }
4426
4427 func (p *GetTracesByIdsArgs) GetAdjust() []Adjust {
4428 return p.Adjust
4429 }
4430 func (p *GetTracesByIdsArgs) Read(iprot thrift.TProtocol) error {
4431 if _, err := iprot.ReadStructBegin(); err != nil {
4432 return fmt.Errorf("%T read error: %s", p, err)
4433 }
4434 for {
4435 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
4436 if err != nil {
4437 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
4438 }
4439 if fieldTypeId == thrift.STOP {
4440 break
4441 }
4442 switch fieldId {
4443 case 1:
4444 if err := p.ReadField1(iprot); err != nil {
4445 return err
4446 }
4447 case 2:
4448 if err := p.ReadField2(iprot); err != nil {
4449 return err
4450 }
4451 default:
4452 if err := iprot.Skip(fieldTypeId); err != nil {
4453 return err
4454 }
4455 }
4456 if err := iprot.ReadFieldEnd(); err != nil {
4457 return err
4458 }
4459 }
4460 if err := iprot.ReadStructEnd(); err != nil {
4461 return fmt.Errorf("%T read struct end error: %s", p, err)
4462 }
4463 return nil
4464 }
4465
4466 func (p *GetTracesByIdsArgs) ReadField1(iprot thrift.TProtocol) error {
4467 _, size, err := iprot.ReadListBegin()
4468 if err != nil {
4469 return fmt.Errorf("error reading list begin: %s", err)
4470 }
4471 tSlice := make([]int64, 0, size)
4472 p.TraceIds = tSlice
4473 for i := 0; i < size; i++ {
4474 var _elem55 int64
4475 if v, err := iprot.ReadI64(); err != nil {
4476 return fmt.Errorf("error reading field 0: %s", err)
4477 } else {
4478 _elem55 = v
4479 }
4480 p.TraceIds = append(p.TraceIds, _elem55)
4481 }
4482 if err := iprot.ReadListEnd(); err != nil {
4483 return fmt.Errorf("error reading list end: %s", err)
4484 }
4485 return nil
4486 }
4487
4488 func (p *GetTracesByIdsArgs) ReadField2(iprot thrift.TProtocol) error {
4489 _, size, err := iprot.ReadListBegin()
4490 if err != nil {
4491 return fmt.Errorf("error reading list begin: %s", err)
4492 }
4493 tSlice := make([]Adjust, 0, size)
4494 p.Adjust = tSlice
4495 for i := 0; i < size; i++ {
4496 var _elem56 Adjust
4497 if v, err := iprot.ReadI32(); err != nil {
4498 return fmt.Errorf("error reading field 0: %s", err)
4499 } else {
4500 temp := Adjust(v)
4501 _elem56 = temp
4502 }
4503 p.Adjust = append(p.Adjust, _elem56)
4504 }
4505 if err := iprot.ReadListEnd(); err != nil {
4506 return fmt.Errorf("error reading list end: %s", err)
4507 }
4508 return nil
4509 }
4510
4511 func (p *GetTracesByIdsArgs) Write(oprot thrift.TProtocol) error {
4512 if err := oprot.WriteStructBegin("getTracesByIds_args"); err != nil {
4513 return fmt.Errorf("%T write struct begin error: %s", p, err)
4514 }
4515 if err := p.writeField1(oprot); err != nil {
4516 return err
4517 }
4518 if err := p.writeField2(oprot); err != nil {
4519 return err
4520 }
4521 if err := oprot.WriteFieldStop(); err != nil {
4522 return fmt.Errorf("write field stop error: %s", err)
4523 }
4524 if err := oprot.WriteStructEnd(); err != nil {
4525 return fmt.Errorf("write struct stop error: %s", err)
4526 }
4527 return nil
4528 }
4529
4530 func (p *GetTracesByIdsArgs) writeField1(oprot thrift.TProtocol) (err error) {
4531 if err := oprot.WriteFieldBegin("trace_ids", thrift.LIST, 1); err != nil {
4532 return fmt.Errorf("%T write field begin error 1:trace_ids: %s", p, err)
4533 }
4534 if err := oprot.WriteListBegin(thrift.I64, len(p.TraceIds)); err != nil {
4535 return fmt.Errorf("error writing list begin: %s", err)
4536 }
4537 for _, v := range p.TraceIds {
4538 if err := oprot.WriteI64(int64(v)); err != nil {
4539 return fmt.Errorf("%T. (0) field write error: %s", p, err)
4540 }
4541 }
4542 if err := oprot.WriteListEnd(); err != nil {
4543 return fmt.Errorf("error writing list end: %s", err)
4544 }
4545 if err := oprot.WriteFieldEnd(); err != nil {
4546 return fmt.Errorf("%T write field end error 1:trace_ids: %s", p, err)
4547 }
4548 return err
4549 }
4550
4551 func (p *GetTracesByIdsArgs) writeField2(oprot thrift.TProtocol) (err error) {
4552 if err := oprot.WriteFieldBegin("adjust", thrift.LIST, 2); err != nil {
4553 return fmt.Errorf("%T write field begin error 2:adjust: %s", p, err)
4554 }
4555 if err := oprot.WriteListBegin(thrift.I32, len(p.Adjust)); err != nil {
4556 return fmt.Errorf("error writing list begin: %s", err)
4557 }
4558 for _, v := range p.Adjust {
4559 if err := oprot.WriteI32(int32(v)); err != nil {
4560 return fmt.Errorf("%T. (0) field write error: %s", p, err)
4561 }
4562 }
4563 if err := oprot.WriteListEnd(); err != nil {
4564 return fmt.Errorf("error writing list end: %s", err)
4565 }
4566 if err := oprot.WriteFieldEnd(); err != nil {
4567 return fmt.Errorf("%T write field end error 2:adjust: %s", p, err)
4568 }
4569 return err
4570 }
4571
4572 func (p *GetTracesByIdsArgs) String() string {
4573 if p == nil {
4574 return "<nil>"
4575 }
4576 return fmt.Sprintf("GetTracesByIdsArgs(%+v)", *p)
4577 }
4578
4579 type GetTracesByIdsResult struct {
4580 Success []*Trace `thrift:"success,0" json:"success"`
4581 Qe *QueryException `thrift:"qe,1" json:"qe"`
4582 }
4583
4584 func NewGetTracesByIdsResult() *GetTracesByIdsResult {
4585 return &GetTracesByIdsResult{}
4586 }
4587
4588 var GetTracesByIdsResult_Success_DEFAULT []*Trace
4589
4590 func (p *GetTracesByIdsResult) GetSuccess() []*Trace {
4591 return p.Success
4592 }
4593
4594 var GetTracesByIdsResult_Qe_DEFAULT *QueryException
4595
4596 func (p *GetTracesByIdsResult) GetQe() *QueryException {
4597 if !p.IsSetQe() {
4598 return GetTracesByIdsResult_Qe_DEFAULT
4599 }
4600 return p.Qe
4601 }
4602 func (p *GetTracesByIdsResult) IsSetSuccess() bool {
4603 return p.Success != nil
4604 }
4605
4606 func (p *GetTracesByIdsResult) IsSetQe() bool {
4607 return p.Qe != nil
4608 }
4609
4610 func (p *GetTracesByIdsResult) Read(iprot thrift.TProtocol) error {
4611 if _, err := iprot.ReadStructBegin(); err != nil {
4612 return fmt.Errorf("%T read error: %s", p, err)
4613 }
4614 for {
4615 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
4616 if err != nil {
4617 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
4618 }
4619 if fieldTypeId == thrift.STOP {
4620 break
4621 }
4622 switch fieldId {
4623 case 0:
4624 if err := p.ReadField0(iprot); err != nil {
4625 return err
4626 }
4627 case 1:
4628 if err := p.ReadField1(iprot); err != nil {
4629 return err
4630 }
4631 default:
4632 if err := iprot.Skip(fieldTypeId); err != nil {
4633 return err
4634 }
4635 }
4636 if err := iprot.ReadFieldEnd(); err != nil {
4637 return err
4638 }
4639 }
4640 if err := iprot.ReadStructEnd(); err != nil {
4641 return fmt.Errorf("%T read struct end error: %s", p, err)
4642 }
4643 return nil
4644 }
4645
4646 func (p *GetTracesByIdsResult) ReadField0(iprot thrift.TProtocol) error {
4647 _, size, err := iprot.ReadListBegin()
4648 if err != nil {
4649 return fmt.Errorf("error reading list begin: %s", err)
4650 }
4651 tSlice := make([]*Trace, 0, size)
4652 p.Success = tSlice
4653 for i := 0; i < size; i++ {
4654 _elem57 := &Trace{}
4655 if err := _elem57.Read(iprot); err != nil {
4656 return fmt.Errorf("%T error reading struct: %s", _elem57, err)
4657 }
4658 p.Success = append(p.Success, _elem57)
4659 }
4660 if err := iprot.ReadListEnd(); err != nil {
4661 return fmt.Errorf("error reading list end: %s", err)
4662 }
4663 return nil
4664 }
4665
4666 func (p *GetTracesByIdsResult) ReadField1(iprot thrift.TProtocol) error {
4667 p.Qe = &QueryException{}
4668 if err := p.Qe.Read(iprot); err != nil {
4669 return fmt.Errorf("%T error reading struct: %s", p.Qe, err)
4670 }
4671 return nil
4672 }
4673
4674 func (p *GetTracesByIdsResult) Write(oprot thrift.TProtocol) error {
4675 if err := oprot.WriteStructBegin("getTracesByIds_result"); err != nil {
4676 return fmt.Errorf("%T write struct begin error: %s", p, err)
4677 }
4678 if err := p.writeField0(oprot); err != nil {
4679 return err
4680 }
4681 if err := p.writeField1(oprot); err != nil {
4682 return err
4683 }
4684 if err := oprot.WriteFieldStop(); err != nil {
4685 return fmt.Errorf("write field stop error: %s", err)
4686 }
4687 if err := oprot.WriteStructEnd(); err != nil {
4688 return fmt.Errorf("write struct stop error: %s", err)
4689 }
4690 return nil
4691 }
4692
4693 func (p *GetTracesByIdsResult) writeField0(oprot thrift.TProtocol) (err error) {
4694 if p.IsSetSuccess() {
4695 if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil {
4696 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
4697 }
4698 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Success)); err != nil {
4699 return fmt.Errorf("error writing list begin: %s", err)
4700 }
4701 for _, v := range p.Success {
4702 if err := v.Write(oprot); err != nil {
4703 return fmt.Errorf("%T error writing struct: %s", v, err)
4704 }
4705 }
4706 if err := oprot.WriteListEnd(); err != nil {
4707 return fmt.Errorf("error writing list end: %s", err)
4708 }
4709 if err := oprot.WriteFieldEnd(); err != nil {
4710 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
4711 }
4712 }
4713 return err
4714 }
4715
4716 func (p *GetTracesByIdsResult) writeField1(oprot thrift.TProtocol) (err error) {
4717 if p.IsSetQe() {
4718 if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil {
4719 return fmt.Errorf("%T write field begin error 1:qe: %s", p, err)
4720 }
4721 if err := p.Qe.Write(oprot); err != nil {
4722 return fmt.Errorf("%T error writing struct: %s", p.Qe, err)
4723 }
4724 if err := oprot.WriteFieldEnd(); err != nil {
4725 return fmt.Errorf("%T write field end error 1:qe: %s", p, err)
4726 }
4727 }
4728 return err
4729 }
4730
4731 func (p *GetTracesByIdsResult) String() string {
4732 if p == nil {
4733 return "<nil>"
4734 }
4735 return fmt.Sprintf("GetTracesByIdsResult(%+v)", *p)
4736 }
4737
4738 type GetTraceTimelinesByIdsArgs struct {
4739 TraceIds []int64 `thrift:"trace_ids,1" json:"trace_ids"`
4740 Adjust []Adjust `thrift:"adjust,2" json:"adjust"`
4741 }
4742
4743 func NewGetTraceTimelinesByIdsArgs() *GetTraceTimelinesByIdsArgs {
4744 return &GetTraceTimelinesByIdsArgs{}
4745 }
4746
4747 func (p *GetTraceTimelinesByIdsArgs) GetTraceIds() []int64 {
4748 return p.TraceIds
4749 }
4750
4751 func (p *GetTraceTimelinesByIdsArgs) GetAdjust() []Adjust {
4752 return p.Adjust
4753 }
4754 func (p *GetTraceTimelinesByIdsArgs) Read(iprot thrift.TProtocol) error {
4755 if _, err := iprot.ReadStructBegin(); err != nil {
4756 return fmt.Errorf("%T read error: %s", p, err)
4757 }
4758 for {
4759 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
4760 if err != nil {
4761 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
4762 }
4763 if fieldTypeId == thrift.STOP {
4764 break
4765 }
4766 switch fieldId {
4767 case 1:
4768 if err := p.ReadField1(iprot); err != nil {
4769 return err
4770 }
4771 case 2:
4772 if err := p.ReadField2(iprot); err != nil {
4773 return err
4774 }
4775 default:
4776 if err := iprot.Skip(fieldTypeId); err != nil {
4777 return err
4778 }
4779 }
4780 if err := iprot.ReadFieldEnd(); err != nil {
4781 return err
4782 }
4783 }
4784 if err := iprot.ReadStructEnd(); err != nil {
4785 return fmt.Errorf("%T read struct end error: %s", p, err)
4786 }
4787 return nil
4788 }
4789
4790 func (p *GetTraceTimelinesByIdsArgs) ReadField1(iprot thrift.TProtocol) error {
4791 _, size, err := iprot.ReadListBegin()
4792 if err != nil {
4793 return fmt.Errorf("error reading list begin: %s", err)
4794 }
4795 tSlice := make([]int64, 0, size)
4796 p.TraceIds = tSlice
4797 for i := 0; i < size; i++ {
4798 var _elem58 int64
4799 if v, err := iprot.ReadI64(); err != nil {
4800 return fmt.Errorf("error reading field 0: %s", err)
4801 } else {
4802 _elem58 = v
4803 }
4804 p.TraceIds = append(p.TraceIds, _elem58)
4805 }
4806 if err := iprot.ReadListEnd(); err != nil {
4807 return fmt.Errorf("error reading list end: %s", err)
4808 }
4809 return nil
4810 }
4811
4812 func (p *GetTraceTimelinesByIdsArgs) ReadField2(iprot thrift.TProtocol) error {
4813 _, size, err := iprot.ReadListBegin()
4814 if err != nil {
4815 return fmt.Errorf("error reading list begin: %s", err)
4816 }
4817 tSlice := make([]Adjust, 0, size)
4818 p.Adjust = tSlice
4819 for i := 0; i < size; i++ {
4820 var _elem59 Adjust
4821 if v, err := iprot.ReadI32(); err != nil {
4822 return fmt.Errorf("error reading field 0: %s", err)
4823 } else {
4824 temp := Adjust(v)
4825 _elem59 = temp
4826 }
4827 p.Adjust = append(p.Adjust, _elem59)
4828 }
4829 if err := iprot.ReadListEnd(); err != nil {
4830 return fmt.Errorf("error reading list end: %s", err)
4831 }
4832 return nil
4833 }
4834
4835 func (p *GetTraceTimelinesByIdsArgs) Write(oprot thrift.TProtocol) error {
4836 if err := oprot.WriteStructBegin("getTraceTimelinesByIds_args"); err != nil {
4837 return fmt.Errorf("%T write struct begin error: %s", p, err)
4838 }
4839 if err := p.writeField1(oprot); err != nil {
4840 return err
4841 }
4842 if err := p.writeField2(oprot); err != nil {
4843 return err
4844 }
4845 if err := oprot.WriteFieldStop(); err != nil {
4846 return fmt.Errorf("write field stop error: %s", err)
4847 }
4848 if err := oprot.WriteStructEnd(); err != nil {
4849 return fmt.Errorf("write struct stop error: %s", err)
4850 }
4851 return nil
4852 }
4853
4854 func (p *GetTraceTimelinesByIdsArgs) writeField1(oprot thrift.TProtocol) (err error) {
4855 if err := oprot.WriteFieldBegin("trace_ids", thrift.LIST, 1); err != nil {
4856 return fmt.Errorf("%T write field begin error 1:trace_ids: %s", p, err)
4857 }
4858 if err := oprot.WriteListBegin(thrift.I64, len(p.TraceIds)); err != nil {
4859 return fmt.Errorf("error writing list begin: %s", err)
4860 }
4861 for _, v := range p.TraceIds {
4862 if err := oprot.WriteI64(int64(v)); err != nil {
4863 return fmt.Errorf("%T. (0) field write error: %s", p, err)
4864 }
4865 }
4866 if err := oprot.WriteListEnd(); err != nil {
4867 return fmt.Errorf("error writing list end: %s", err)
4868 }
4869 if err := oprot.WriteFieldEnd(); err != nil {
4870 return fmt.Errorf("%T write field end error 1:trace_ids: %s", p, err)
4871 }
4872 return err
4873 }
4874
4875 func (p *GetTraceTimelinesByIdsArgs) writeField2(oprot thrift.TProtocol) (err error) {
4876 if err := oprot.WriteFieldBegin("adjust", thrift.LIST, 2); err != nil {
4877 return fmt.Errorf("%T write field begin error 2:adjust: %s", p, err)
4878 }
4879 if err := oprot.WriteListBegin(thrift.I32, len(p.Adjust)); err != nil {
4880 return fmt.Errorf("error writing list begin: %s", err)
4881 }
4882 for _, v := range p.Adjust {
4883 if err := oprot.WriteI32(int32(v)); err != nil {
4884 return fmt.Errorf("%T. (0) field write error: %s", p, err)
4885 }
4886 }
4887 if err := oprot.WriteListEnd(); err != nil {
4888 return fmt.Errorf("error writing list end: %s", err)
4889 }
4890 if err := oprot.WriteFieldEnd(); err != nil {
4891 return fmt.Errorf("%T write field end error 2:adjust: %s", p, err)
4892 }
4893 return err
4894 }
4895
4896 func (p *GetTraceTimelinesByIdsArgs) String() string {
4897 if p == nil {
4898 return "<nil>"
4899 }
4900 return fmt.Sprintf("GetTraceTimelinesByIdsArgs(%+v)", *p)
4901 }
4902
4903 type GetTraceTimelinesByIdsResult struct {
4904 Success []*TraceTimeline `thrift:"success,0" json:"success"`
4905 Qe *QueryException `thrift:"qe,1" json:"qe"`
4906 }
4907
4908 func NewGetTraceTimelinesByIdsResult() *GetTraceTimelinesByIdsResult {
4909 return &GetTraceTimelinesByIdsResult{}
4910 }
4911
4912 var GetTraceTimelinesByIdsResult_Success_DEFAULT []*TraceTimeline
4913
4914 func (p *GetTraceTimelinesByIdsResult) GetSuccess() []*TraceTimeline {
4915 return p.Success
4916 }
4917
4918 var GetTraceTimelinesByIdsResult_Qe_DEFAULT *QueryException
4919
4920 func (p *GetTraceTimelinesByIdsResult) GetQe() *QueryException {
4921 if !p.IsSetQe() {
4922 return GetTraceTimelinesByIdsResult_Qe_DEFAULT
4923 }
4924 return p.Qe
4925 }
4926 func (p *GetTraceTimelinesByIdsResult) IsSetSuccess() bool {
4927 return p.Success != nil
4928 }
4929
4930 func (p *GetTraceTimelinesByIdsResult) IsSetQe() bool {
4931 return p.Qe != nil
4932 }
4933
4934 func (p *GetTraceTimelinesByIdsResult) Read(iprot thrift.TProtocol) error {
4935 if _, err := iprot.ReadStructBegin(); err != nil {
4936 return fmt.Errorf("%T read error: %s", p, err)
4937 }
4938 for {
4939 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
4940 if err != nil {
4941 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
4942 }
4943 if fieldTypeId == thrift.STOP {
4944 break
4945 }
4946 switch fieldId {
4947 case 0:
4948 if err := p.ReadField0(iprot); err != nil {
4949 return err
4950 }
4951 case 1:
4952 if err := p.ReadField1(iprot); err != nil {
4953 return err
4954 }
4955 default:
4956 if err := iprot.Skip(fieldTypeId); err != nil {
4957 return err
4958 }
4959 }
4960 if err := iprot.ReadFieldEnd(); err != nil {
4961 return err
4962 }
4963 }
4964 if err := iprot.ReadStructEnd(); err != nil {
4965 return fmt.Errorf("%T read struct end error: %s", p, err)
4966 }
4967 return nil
4968 }
4969
4970 func (p *GetTraceTimelinesByIdsResult) ReadField0(iprot thrift.TProtocol) error {
4971 _, size, err := iprot.ReadListBegin()
4972 if err != nil {
4973 return fmt.Errorf("error reading list begin: %s", err)
4974 }
4975 tSlice := make([]*TraceTimeline, 0, size)
4976 p.Success = tSlice
4977 for i := 0; i < size; i++ {
4978 _elem60 := &TraceTimeline{}
4979 if err := _elem60.Read(iprot); err != nil {
4980 return fmt.Errorf("%T error reading struct: %s", _elem60, err)
4981 }
4982 p.Success = append(p.Success, _elem60)
4983 }
4984 if err := iprot.ReadListEnd(); err != nil {
4985 return fmt.Errorf("error reading list end: %s", err)
4986 }
4987 return nil
4988 }
4989
4990 func (p *GetTraceTimelinesByIdsResult) ReadField1(iprot thrift.TProtocol) error {
4991 p.Qe = &QueryException{}
4992 if err := p.Qe.Read(iprot); err != nil {
4993 return fmt.Errorf("%T error reading struct: %s", p.Qe, err)
4994 }
4995 return nil
4996 }
4997
4998 func (p *GetTraceTimelinesByIdsResult) Write(oprot thrift.TProtocol) error {
4999 if err := oprot.WriteStructBegin("getTraceTimelinesByIds_result"); err != nil {
5000 return fmt.Errorf("%T write struct begin error: %s", p, err)
5001 }
5002 if err := p.writeField0(oprot); err != nil {
5003 return err
5004 }
5005 if err := p.writeField1(oprot); err != nil {
5006 return err
5007 }
5008 if err := oprot.WriteFieldStop(); err != nil {
5009 return fmt.Errorf("write field stop error: %s", err)
5010 }
5011 if err := oprot.WriteStructEnd(); err != nil {
5012 return fmt.Errorf("write struct stop error: %s", err)
5013 }
5014 return nil
5015 }
5016
5017 func (p *GetTraceTimelinesByIdsResult) writeField0(oprot thrift.TProtocol) (err error) {
5018 if p.IsSetSuccess() {
5019 if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil {
5020 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
5021 }
5022 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Success)); err != nil {
5023 return fmt.Errorf("error writing list begin: %s", err)
5024 }
5025 for _, v := range p.Success {
5026 if err := v.Write(oprot); err != nil {
5027 return fmt.Errorf("%T error writing struct: %s", v, err)
5028 }
5029 }
5030 if err := oprot.WriteListEnd(); err != nil {
5031 return fmt.Errorf("error writing list end: %s", err)
5032 }
5033 if err := oprot.WriteFieldEnd(); err != nil {
5034 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
5035 }
5036 }
5037 return err
5038 }
5039
5040 func (p *GetTraceTimelinesByIdsResult) writeField1(oprot thrift.TProtocol) (err error) {
5041 if p.IsSetQe() {
5042 if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil {
5043 return fmt.Errorf("%T write field begin error 1:qe: %s", p, err)
5044 }
5045 if err := p.Qe.Write(oprot); err != nil {
5046 return fmt.Errorf("%T error writing struct: %s", p.Qe, err)
5047 }
5048 if err := oprot.WriteFieldEnd(); err != nil {
5049 return fmt.Errorf("%T write field end error 1:qe: %s", p, err)
5050 }
5051 }
5052 return err
5053 }
5054
5055 func (p *GetTraceTimelinesByIdsResult) String() string {
5056 if p == nil {
5057 return "<nil>"
5058 }
5059 return fmt.Sprintf("GetTraceTimelinesByIdsResult(%+v)", *p)
5060 }
5061
5062 type GetTraceSummariesByIdsArgs struct {
5063 TraceIds []int64 `thrift:"trace_ids,1" json:"trace_ids"`
5064 Adjust []Adjust `thrift:"adjust,2" json:"adjust"`
5065 }
5066
5067 func NewGetTraceSummariesByIdsArgs() *GetTraceSummariesByIdsArgs {
5068 return &GetTraceSummariesByIdsArgs{}
5069 }
5070
5071 func (p *GetTraceSummariesByIdsArgs) GetTraceIds() []int64 {
5072 return p.TraceIds
5073 }
5074
5075 func (p *GetTraceSummariesByIdsArgs) GetAdjust() []Adjust {
5076 return p.Adjust
5077 }
5078 func (p *GetTraceSummariesByIdsArgs) Read(iprot thrift.TProtocol) error {
5079 if _, err := iprot.ReadStructBegin(); err != nil {
5080 return fmt.Errorf("%T read error: %s", p, err)
5081 }
5082 for {
5083 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
5084 if err != nil {
5085 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
5086 }
5087 if fieldTypeId == thrift.STOP {
5088 break
5089 }
5090 switch fieldId {
5091 case 1:
5092 if err := p.ReadField1(iprot); err != nil {
5093 return err
5094 }
5095 case 2:
5096 if err := p.ReadField2(iprot); err != nil {
5097 return err
5098 }
5099 default:
5100 if err := iprot.Skip(fieldTypeId); err != nil {
5101 return err
5102 }
5103 }
5104 if err := iprot.ReadFieldEnd(); err != nil {
5105 return err
5106 }
5107 }
5108 if err := iprot.ReadStructEnd(); err != nil {
5109 return fmt.Errorf("%T read struct end error: %s", p, err)
5110 }
5111 return nil
5112 }
5113
5114 func (p *GetTraceSummariesByIdsArgs) ReadField1(iprot thrift.TProtocol) error {
5115 _, size, err := iprot.ReadListBegin()
5116 if err != nil {
5117 return fmt.Errorf("error reading list begin: %s", err)
5118 }
5119 tSlice := make([]int64, 0, size)
5120 p.TraceIds = tSlice
5121 for i := 0; i < size; i++ {
5122 var _elem61 int64
5123 if v, err := iprot.ReadI64(); err != nil {
5124 return fmt.Errorf("error reading field 0: %s", err)
5125 } else {
5126 _elem61 = v
5127 }
5128 p.TraceIds = append(p.TraceIds, _elem61)
5129 }
5130 if err := iprot.ReadListEnd(); err != nil {
5131 return fmt.Errorf("error reading list end: %s", err)
5132 }
5133 return nil
5134 }
5135
5136 func (p *GetTraceSummariesByIdsArgs) ReadField2(iprot thrift.TProtocol) error {
5137 _, size, err := iprot.ReadListBegin()
5138 if err != nil {
5139 return fmt.Errorf("error reading list begin: %s", err)
5140 }
5141 tSlice := make([]Adjust, 0, size)
5142 p.Adjust = tSlice
5143 for i := 0; i < size; i++ {
5144 var _elem62 Adjust
5145 if v, err := iprot.ReadI32(); err != nil {
5146 return fmt.Errorf("error reading field 0: %s", err)
5147 } else {
5148 temp := Adjust(v)
5149 _elem62 = temp
5150 }
5151 p.Adjust = append(p.Adjust, _elem62)
5152 }
5153 if err := iprot.ReadListEnd(); err != nil {
5154 return fmt.Errorf("error reading list end: %s", err)
5155 }
5156 return nil
5157 }
5158
5159 func (p *GetTraceSummariesByIdsArgs) Write(oprot thrift.TProtocol) error {
5160 if err := oprot.WriteStructBegin("getTraceSummariesByIds_args"); err != nil {
5161 return fmt.Errorf("%T write struct begin error: %s", p, err)
5162 }
5163 if err := p.writeField1(oprot); err != nil {
5164 return err
5165 }
5166 if err := p.writeField2(oprot); err != nil {
5167 return err
5168 }
5169 if err := oprot.WriteFieldStop(); err != nil {
5170 return fmt.Errorf("write field stop error: %s", err)
5171 }
5172 if err := oprot.WriteStructEnd(); err != nil {
5173 return fmt.Errorf("write struct stop error: %s", err)
5174 }
5175 return nil
5176 }
5177
5178 func (p *GetTraceSummariesByIdsArgs) writeField1(oprot thrift.TProtocol) (err error) {
5179 if err := oprot.WriteFieldBegin("trace_ids", thrift.LIST, 1); err != nil {
5180 return fmt.Errorf("%T write field begin error 1:trace_ids: %s", p, err)
5181 }
5182 if err := oprot.WriteListBegin(thrift.I64, len(p.TraceIds)); err != nil {
5183 return fmt.Errorf("error writing list begin: %s", err)
5184 }
5185 for _, v := range p.TraceIds {
5186 if err := oprot.WriteI64(int64(v)); err != nil {
5187 return fmt.Errorf("%T. (0) field write error: %s", p, err)
5188 }
5189 }
5190 if err := oprot.WriteListEnd(); err != nil {
5191 return fmt.Errorf("error writing list end: %s", err)
5192 }
5193 if err := oprot.WriteFieldEnd(); err != nil {
5194 return fmt.Errorf("%T write field end error 1:trace_ids: %s", p, err)
5195 }
5196 return err
5197 }
5198
5199 func (p *GetTraceSummariesByIdsArgs) writeField2(oprot thrift.TProtocol) (err error) {
5200 if err := oprot.WriteFieldBegin("adjust", thrift.LIST, 2); err != nil {
5201 return fmt.Errorf("%T write field begin error 2:adjust: %s", p, err)
5202 }
5203 if err := oprot.WriteListBegin(thrift.I32, len(p.Adjust)); err != nil {
5204 return fmt.Errorf("error writing list begin: %s", err)
5205 }
5206 for _, v := range p.Adjust {
5207 if err := oprot.WriteI32(int32(v)); err != nil {
5208 return fmt.Errorf("%T. (0) field write error: %s", p, err)
5209 }
5210 }
5211 if err := oprot.WriteListEnd(); err != nil {
5212 return fmt.Errorf("error writing list end: %s", err)
5213 }
5214 if err := oprot.WriteFieldEnd(); err != nil {
5215 return fmt.Errorf("%T write field end error 2:adjust: %s", p, err)
5216 }
5217 return err
5218 }
5219
5220 func (p *GetTraceSummariesByIdsArgs) String() string {
5221 if p == nil {
5222 return "<nil>"
5223 }
5224 return fmt.Sprintf("GetTraceSummariesByIdsArgs(%+v)", *p)
5225 }
5226
5227 type GetTraceSummariesByIdsResult struct {
5228 Success []*TraceSummary `thrift:"success,0" json:"success"`
5229 Qe *QueryException `thrift:"qe,1" json:"qe"`
5230 }
5231
5232 func NewGetTraceSummariesByIdsResult() *GetTraceSummariesByIdsResult {
5233 return &GetTraceSummariesByIdsResult{}
5234 }
5235
5236 var GetTraceSummariesByIdsResult_Success_DEFAULT []*TraceSummary
5237
5238 func (p *GetTraceSummariesByIdsResult) GetSuccess() []*TraceSummary {
5239 return p.Success
5240 }
5241
5242 var GetTraceSummariesByIdsResult_Qe_DEFAULT *QueryException
5243
5244 func (p *GetTraceSummariesByIdsResult) GetQe() *QueryException {
5245 if !p.IsSetQe() {
5246 return GetTraceSummariesByIdsResult_Qe_DEFAULT
5247 }
5248 return p.Qe
5249 }
5250 func (p *GetTraceSummariesByIdsResult) IsSetSuccess() bool {
5251 return p.Success != nil
5252 }
5253
5254 func (p *GetTraceSummariesByIdsResult) IsSetQe() bool {
5255 return p.Qe != nil
5256 }
5257
5258 func (p *GetTraceSummariesByIdsResult) Read(iprot thrift.TProtocol) error {
5259 if _, err := iprot.ReadStructBegin(); err != nil {
5260 return fmt.Errorf("%T read error: %s", p, err)
5261 }
5262 for {
5263 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
5264 if err != nil {
5265 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
5266 }
5267 if fieldTypeId == thrift.STOP {
5268 break
5269 }
5270 switch fieldId {
5271 case 0:
5272 if err := p.ReadField0(iprot); err != nil {
5273 return err
5274 }
5275 case 1:
5276 if err := p.ReadField1(iprot); err != nil {
5277 return err
5278 }
5279 default:
5280 if err := iprot.Skip(fieldTypeId); err != nil {
5281 return err
5282 }
5283 }
5284 if err := iprot.ReadFieldEnd(); err != nil {
5285 return err
5286 }
5287 }
5288 if err := iprot.ReadStructEnd(); err != nil {
5289 return fmt.Errorf("%T read struct end error: %s", p, err)
5290 }
5291 return nil
5292 }
5293
5294 func (p *GetTraceSummariesByIdsResult) ReadField0(iprot thrift.TProtocol) error {
5295 _, size, err := iprot.ReadListBegin()
5296 if err != nil {
5297 return fmt.Errorf("error reading list begin: %s", err)
5298 }
5299 tSlice := make([]*TraceSummary, 0, size)
5300 p.Success = tSlice
5301 for i := 0; i < size; i++ {
5302 _elem63 := &TraceSummary{}
5303 if err := _elem63.Read(iprot); err != nil {
5304 return fmt.Errorf("%T error reading struct: %s", _elem63, err)
5305 }
5306 p.Success = append(p.Success, _elem63)
5307 }
5308 if err := iprot.ReadListEnd(); err != nil {
5309 return fmt.Errorf("error reading list end: %s", err)
5310 }
5311 return nil
5312 }
5313
5314 func (p *GetTraceSummariesByIdsResult) ReadField1(iprot thrift.TProtocol) error {
5315 p.Qe = &QueryException{}
5316 if err := p.Qe.Read(iprot); err != nil {
5317 return fmt.Errorf("%T error reading struct: %s", p.Qe, err)
5318 }
5319 return nil
5320 }
5321
5322 func (p *GetTraceSummariesByIdsResult) Write(oprot thrift.TProtocol) error {
5323 if err := oprot.WriteStructBegin("getTraceSummariesByIds_result"); err != nil {
5324 return fmt.Errorf("%T write struct begin error: %s", p, err)
5325 }
5326 if err := p.writeField0(oprot); err != nil {
5327 return err
5328 }
5329 if err := p.writeField1(oprot); err != nil {
5330 return err
5331 }
5332 if err := oprot.WriteFieldStop(); err != nil {
5333 return fmt.Errorf("write field stop error: %s", err)
5334 }
5335 if err := oprot.WriteStructEnd(); err != nil {
5336 return fmt.Errorf("write struct stop error: %s", err)
5337 }
5338 return nil
5339 }
5340
5341 func (p *GetTraceSummariesByIdsResult) writeField0(oprot thrift.TProtocol) (err error) {
5342 if p.IsSetSuccess() {
5343 if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil {
5344 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
5345 }
5346 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Success)); err != nil {
5347 return fmt.Errorf("error writing list begin: %s", err)
5348 }
5349 for _, v := range p.Success {
5350 if err := v.Write(oprot); err != nil {
5351 return fmt.Errorf("%T error writing struct: %s", v, err)
5352 }
5353 }
5354 if err := oprot.WriteListEnd(); err != nil {
5355 return fmt.Errorf("error writing list end: %s", err)
5356 }
5357 if err := oprot.WriteFieldEnd(); err != nil {
5358 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
5359 }
5360 }
5361 return err
5362 }
5363
5364 func (p *GetTraceSummariesByIdsResult) writeField1(oprot thrift.TProtocol) (err error) {
5365 if p.IsSetQe() {
5366 if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil {
5367 return fmt.Errorf("%T write field begin error 1:qe: %s", p, err)
5368 }
5369 if err := p.Qe.Write(oprot); err != nil {
5370 return fmt.Errorf("%T error writing struct: %s", p.Qe, err)
5371 }
5372 if err := oprot.WriteFieldEnd(); err != nil {
5373 return fmt.Errorf("%T write field end error 1:qe: %s", p, err)
5374 }
5375 }
5376 return err
5377 }
5378
5379 func (p *GetTraceSummariesByIdsResult) String() string {
5380 if p == nil {
5381 return "<nil>"
5382 }
5383 return fmt.Sprintf("GetTraceSummariesByIdsResult(%+v)", *p)
5384 }
5385
5386 type GetTraceCombosByIdsArgs struct {
5387 TraceIds []int64 `thrift:"trace_ids,1" json:"trace_ids"`
5388 Adjust []Adjust `thrift:"adjust,2" json:"adjust"`
5389 }
5390
5391 func NewGetTraceCombosByIdsArgs() *GetTraceCombosByIdsArgs {
5392 return &GetTraceCombosByIdsArgs{}
5393 }
5394
5395 func (p *GetTraceCombosByIdsArgs) GetTraceIds() []int64 {
5396 return p.TraceIds
5397 }
5398
5399 func (p *GetTraceCombosByIdsArgs) GetAdjust() []Adjust {
5400 return p.Adjust
5401 }
5402 func (p *GetTraceCombosByIdsArgs) Read(iprot thrift.TProtocol) error {
5403 if _, err := iprot.ReadStructBegin(); err != nil {
5404 return fmt.Errorf("%T read error: %s", p, err)
5405 }
5406 for {
5407 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
5408 if err != nil {
5409 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
5410 }
5411 if fieldTypeId == thrift.STOP {
5412 break
5413 }
5414 switch fieldId {
5415 case 1:
5416 if err := p.ReadField1(iprot); err != nil {
5417 return err
5418 }
5419 case 2:
5420 if err := p.ReadField2(iprot); err != nil {
5421 return err
5422 }
5423 default:
5424 if err := iprot.Skip(fieldTypeId); err != nil {
5425 return err
5426 }
5427 }
5428 if err := iprot.ReadFieldEnd(); err != nil {
5429 return err
5430 }
5431 }
5432 if err := iprot.ReadStructEnd(); err != nil {
5433 return fmt.Errorf("%T read struct end error: %s", p, err)
5434 }
5435 return nil
5436 }
5437
5438 func (p *GetTraceCombosByIdsArgs) ReadField1(iprot thrift.TProtocol) error {
5439 _, size, err := iprot.ReadListBegin()
5440 if err != nil {
5441 return fmt.Errorf("error reading list begin: %s", err)
5442 }
5443 tSlice := make([]int64, 0, size)
5444 p.TraceIds = tSlice
5445 for i := 0; i < size; i++ {
5446 var _elem64 int64
5447 if v, err := iprot.ReadI64(); err != nil {
5448 return fmt.Errorf("error reading field 0: %s", err)
5449 } else {
5450 _elem64 = v
5451 }
5452 p.TraceIds = append(p.TraceIds, _elem64)
5453 }
5454 if err := iprot.ReadListEnd(); err != nil {
5455 return fmt.Errorf("error reading list end: %s", err)
5456 }
5457 return nil
5458 }
5459
5460 func (p *GetTraceCombosByIdsArgs) ReadField2(iprot thrift.TProtocol) error {
5461 _, size, err := iprot.ReadListBegin()
5462 if err != nil {
5463 return fmt.Errorf("error reading list begin: %s", err)
5464 }
5465 tSlice := make([]Adjust, 0, size)
5466 p.Adjust = tSlice
5467 for i := 0; i < size; i++ {
5468 var _elem65 Adjust
5469 if v, err := iprot.ReadI32(); err != nil {
5470 return fmt.Errorf("error reading field 0: %s", err)
5471 } else {
5472 temp := Adjust(v)
5473 _elem65 = temp
5474 }
5475 p.Adjust = append(p.Adjust, _elem65)
5476 }
5477 if err := iprot.ReadListEnd(); err != nil {
5478 return fmt.Errorf("error reading list end: %s", err)
5479 }
5480 return nil
5481 }
5482
5483 func (p *GetTraceCombosByIdsArgs) Write(oprot thrift.TProtocol) error {
5484 if err := oprot.WriteStructBegin("getTraceCombosByIds_args"); err != nil {
5485 return fmt.Errorf("%T write struct begin error: %s", p, err)
5486 }
5487 if err := p.writeField1(oprot); err != nil {
5488 return err
5489 }
5490 if err := p.writeField2(oprot); err != nil {
5491 return err
5492 }
5493 if err := oprot.WriteFieldStop(); err != nil {
5494 return fmt.Errorf("write field stop error: %s", err)
5495 }
5496 if err := oprot.WriteStructEnd(); err != nil {
5497 return fmt.Errorf("write struct stop error: %s", err)
5498 }
5499 return nil
5500 }
5501
5502 func (p *GetTraceCombosByIdsArgs) writeField1(oprot thrift.TProtocol) (err error) {
5503 if err := oprot.WriteFieldBegin("trace_ids", thrift.LIST, 1); err != nil {
5504 return fmt.Errorf("%T write field begin error 1:trace_ids: %s", p, err)
5505 }
5506 if err := oprot.WriteListBegin(thrift.I64, len(p.TraceIds)); err != nil {
5507 return fmt.Errorf("error writing list begin: %s", err)
5508 }
5509 for _, v := range p.TraceIds {
5510 if err := oprot.WriteI64(int64(v)); err != nil {
5511 return fmt.Errorf("%T. (0) field write error: %s", p, err)
5512 }
5513 }
5514 if err := oprot.WriteListEnd(); err != nil {
5515 return fmt.Errorf("error writing list end: %s", err)
5516 }
5517 if err := oprot.WriteFieldEnd(); err != nil {
5518 return fmt.Errorf("%T write field end error 1:trace_ids: %s", p, err)
5519 }
5520 return err
5521 }
5522
5523 func (p *GetTraceCombosByIdsArgs) writeField2(oprot thrift.TProtocol) (err error) {
5524 if err := oprot.WriteFieldBegin("adjust", thrift.LIST, 2); err != nil {
5525 return fmt.Errorf("%T write field begin error 2:adjust: %s", p, err)
5526 }
5527 if err := oprot.WriteListBegin(thrift.I32, len(p.Adjust)); err != nil {
5528 return fmt.Errorf("error writing list begin: %s", err)
5529 }
5530 for _, v := range p.Adjust {
5531 if err := oprot.WriteI32(int32(v)); err != nil {
5532 return fmt.Errorf("%T. (0) field write error: %s", p, err)
5533 }
5534 }
5535 if err := oprot.WriteListEnd(); err != nil {
5536 return fmt.Errorf("error writing list end: %s", err)
5537 }
5538 if err := oprot.WriteFieldEnd(); err != nil {
5539 return fmt.Errorf("%T write field end error 2:adjust: %s", p, err)
5540 }
5541 return err
5542 }
5543
5544 func (p *GetTraceCombosByIdsArgs) String() string {
5545 if p == nil {
5546 return "<nil>"
5547 }
5548 return fmt.Sprintf("GetTraceCombosByIdsArgs(%+v)", *p)
5549 }
5550
5551 type GetTraceCombosByIdsResult struct {
5552 Success []*TraceCombo `thrift:"success,0" json:"success"`
5553 Qe *QueryException `thrift:"qe,1" json:"qe"`
5554 }
5555
5556 func NewGetTraceCombosByIdsResult() *GetTraceCombosByIdsResult {
5557 return &GetTraceCombosByIdsResult{}
5558 }
5559
5560 var GetTraceCombosByIdsResult_Success_DEFAULT []*TraceCombo
5561
5562 func (p *GetTraceCombosByIdsResult) GetSuccess() []*TraceCombo {
5563 return p.Success
5564 }
5565
5566 var GetTraceCombosByIdsResult_Qe_DEFAULT *QueryException
5567
5568 func (p *GetTraceCombosByIdsResult) GetQe() *QueryException {
5569 if !p.IsSetQe() {
5570 return GetTraceCombosByIdsResult_Qe_DEFAULT
5571 }
5572 return p.Qe
5573 }
5574 func (p *GetTraceCombosByIdsResult) IsSetSuccess() bool {
5575 return p.Success != nil
5576 }
5577
5578 func (p *GetTraceCombosByIdsResult) IsSetQe() bool {
5579 return p.Qe != nil
5580 }
5581
5582 func (p *GetTraceCombosByIdsResult) Read(iprot thrift.TProtocol) error {
5583 if _, err := iprot.ReadStructBegin(); err != nil {
5584 return fmt.Errorf("%T read error: %s", p, err)
5585 }
5586 for {
5587 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
5588 if err != nil {
5589 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
5590 }
5591 if fieldTypeId == thrift.STOP {
5592 break
5593 }
5594 switch fieldId {
5595 case 0:
5596 if err := p.ReadField0(iprot); err != nil {
5597 return err
5598 }
5599 case 1:
5600 if err := p.ReadField1(iprot); err != nil {
5601 return err
5602 }
5603 default:
5604 if err := iprot.Skip(fieldTypeId); err != nil {
5605 return err
5606 }
5607 }
5608 if err := iprot.ReadFieldEnd(); err != nil {
5609 return err
5610 }
5611 }
5612 if err := iprot.ReadStructEnd(); err != nil {
5613 return fmt.Errorf("%T read struct end error: %s", p, err)
5614 }
5615 return nil
5616 }
5617
5618 func (p *GetTraceCombosByIdsResult) ReadField0(iprot thrift.TProtocol) error {
5619 _, size, err := iprot.ReadListBegin()
5620 if err != nil {
5621 return fmt.Errorf("error reading list begin: %s", err)
5622 }
5623 tSlice := make([]*TraceCombo, 0, size)
5624 p.Success = tSlice
5625 for i := 0; i < size; i++ {
5626 _elem66 := &TraceCombo{}
5627 if err := _elem66.Read(iprot); err != nil {
5628 return fmt.Errorf("%T error reading struct: %s", _elem66, err)
5629 }
5630 p.Success = append(p.Success, _elem66)
5631 }
5632 if err := iprot.ReadListEnd(); err != nil {
5633 return fmt.Errorf("error reading list end: %s", err)
5634 }
5635 return nil
5636 }
5637
5638 func (p *GetTraceCombosByIdsResult) ReadField1(iprot thrift.TProtocol) error {
5639 p.Qe = &QueryException{}
5640 if err := p.Qe.Read(iprot); err != nil {
5641 return fmt.Errorf("%T error reading struct: %s", p.Qe, err)
5642 }
5643 return nil
5644 }
5645
5646 func (p *GetTraceCombosByIdsResult) Write(oprot thrift.TProtocol) error {
5647 if err := oprot.WriteStructBegin("getTraceCombosByIds_result"); err != nil {
5648 return fmt.Errorf("%T write struct begin error: %s", p, err)
5649 }
5650 if err := p.writeField0(oprot); err != nil {
5651 return err
5652 }
5653 if err := p.writeField1(oprot); err != nil {
5654 return err
5655 }
5656 if err := oprot.WriteFieldStop(); err != nil {
5657 return fmt.Errorf("write field stop error: %s", err)
5658 }
5659 if err := oprot.WriteStructEnd(); err != nil {
5660 return fmt.Errorf("write struct stop error: %s", err)
5661 }
5662 return nil
5663 }
5664
5665 func (p *GetTraceCombosByIdsResult) writeField0(oprot thrift.TProtocol) (err error) {
5666 if p.IsSetSuccess() {
5667 if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil {
5668 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
5669 }
5670 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Success)); err != nil {
5671 return fmt.Errorf("error writing list begin: %s", err)
5672 }
5673 for _, v := range p.Success {
5674 if err := v.Write(oprot); err != nil {
5675 return fmt.Errorf("%T error writing struct: %s", v, err)
5676 }
5677 }
5678 if err := oprot.WriteListEnd(); err != nil {
5679 return fmt.Errorf("error writing list end: %s", err)
5680 }
5681 if err := oprot.WriteFieldEnd(); err != nil {
5682 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
5683 }
5684 }
5685 return err
5686 }
5687
5688 func (p *GetTraceCombosByIdsResult) writeField1(oprot thrift.TProtocol) (err error) {
5689 if p.IsSetQe() {
5690 if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil {
5691 return fmt.Errorf("%T write field begin error 1:qe: %s", p, err)
5692 }
5693 if err := p.Qe.Write(oprot); err != nil {
5694 return fmt.Errorf("%T error writing struct: %s", p.Qe, err)
5695 }
5696 if err := oprot.WriteFieldEnd(); err != nil {
5697 return fmt.Errorf("%T write field end error 1:qe: %s", p, err)
5698 }
5699 }
5700 return err
5701 }
5702
5703 func (p *GetTraceCombosByIdsResult) String() string {
5704 if p == nil {
5705 return "<nil>"
5706 }
5707 return fmt.Sprintf("GetTraceCombosByIdsResult(%+v)", *p)
5708 }
5709
5710 type GetServiceNamesArgs struct {
5711 }
5712
5713 func NewGetServiceNamesArgs() *GetServiceNamesArgs {
5714 return &GetServiceNamesArgs{}
5715 }
5716
5717 func (p *GetServiceNamesArgs) Read(iprot thrift.TProtocol) error {
5718 if _, err := iprot.ReadStructBegin(); err != nil {
5719 return fmt.Errorf("%T read error: %s", p, err)
5720 }
5721 for {
5722 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
5723 if err != nil {
5724 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
5725 }
5726 if fieldTypeId == thrift.STOP {
5727 break
5728 }
5729 if err := iprot.Skip(fieldTypeId); err != nil {
5730 return err
5731 }
5732 if err := iprot.ReadFieldEnd(); err != nil {
5733 return err
5734 }
5735 }
5736 if err := iprot.ReadStructEnd(); err != nil {
5737 return fmt.Errorf("%T read struct end error: %s", p, err)
5738 }
5739 return nil
5740 }
5741
5742 func (p *GetServiceNamesArgs) Write(oprot thrift.TProtocol) error {
5743 if err := oprot.WriteStructBegin("getServiceNames_args"); err != nil {
5744 return fmt.Errorf("%T write struct begin error: %s", p, err)
5745 }
5746 if err := oprot.WriteFieldStop(); err != nil {
5747 return fmt.Errorf("write field stop error: %s", err)
5748 }
5749 if err := oprot.WriteStructEnd(); err != nil {
5750 return fmt.Errorf("write struct stop error: %s", err)
5751 }
5752 return nil
5753 }
5754
5755 func (p *GetServiceNamesArgs) String() string {
5756 if p == nil {
5757 return "<nil>"
5758 }
5759 return fmt.Sprintf("GetServiceNamesArgs(%+v)", *p)
5760 }
5761
5762 type GetServiceNamesResult struct {
5763 Success map[string]bool `thrift:"success,0" json:"success"`
5764 Qe *QueryException `thrift:"qe,1" json:"qe"`
5765 }
5766
5767 func NewGetServiceNamesResult() *GetServiceNamesResult {
5768 return &GetServiceNamesResult{}
5769 }
5770
5771 var GetServiceNamesResult_Success_DEFAULT map[string]bool
5772
5773 func (p *GetServiceNamesResult) GetSuccess() map[string]bool {
5774 return p.Success
5775 }
5776
5777 var GetServiceNamesResult_Qe_DEFAULT *QueryException
5778
5779 func (p *GetServiceNamesResult) GetQe() *QueryException {
5780 if !p.IsSetQe() {
5781 return GetServiceNamesResult_Qe_DEFAULT
5782 }
5783 return p.Qe
5784 }
5785 func (p *GetServiceNamesResult) IsSetSuccess() bool {
5786 return p.Success != nil
5787 }
5788
5789 func (p *GetServiceNamesResult) IsSetQe() bool {
5790 return p.Qe != nil
5791 }
5792
5793 func (p *GetServiceNamesResult) Read(iprot thrift.TProtocol) error {
5794 if _, err := iprot.ReadStructBegin(); err != nil {
5795 return fmt.Errorf("%T read error: %s", p, err)
5796 }
5797 for {
5798 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
5799 if err != nil {
5800 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
5801 }
5802 if fieldTypeId == thrift.STOP {
5803 break
5804 }
5805 switch fieldId {
5806 case 0:
5807 if err := p.ReadField0(iprot); err != nil {
5808 return err
5809 }
5810 case 1:
5811 if err := p.ReadField1(iprot); err != nil {
5812 return err
5813 }
5814 default:
5815 if err := iprot.Skip(fieldTypeId); err != nil {
5816 return err
5817 }
5818 }
5819 if err := iprot.ReadFieldEnd(); err != nil {
5820 return err
5821 }
5822 }
5823 if err := iprot.ReadStructEnd(); err != nil {
5824 return fmt.Errorf("%T read struct end error: %s", p, err)
5825 }
5826 return nil
5827 }
5828
5829 func (p *GetServiceNamesResult) ReadField0(iprot thrift.TProtocol) error {
5830 _, size, err := iprot.ReadSetBegin()
5831 if err != nil {
5832 return fmt.Errorf("error reading set begin: %s", err)
5833 }
5834 tSet := make(map[string]bool, size)
5835 p.Success = tSet
5836 for i := 0; i < size; i++ {
5837 var _elem67 string
5838 if v, err := iprot.ReadString(); err != nil {
5839 return fmt.Errorf("error reading field 0: %s", err)
5840 } else {
5841 _elem67 = v
5842 }
5843 p.Success[_elem67] = true
5844 }
5845 if err := iprot.ReadSetEnd(); err != nil {
5846 return fmt.Errorf("error reading set end: %s", err)
5847 }
5848 return nil
5849 }
5850
5851 func (p *GetServiceNamesResult) ReadField1(iprot thrift.TProtocol) error {
5852 p.Qe = &QueryException{}
5853 if err := p.Qe.Read(iprot); err != nil {
5854 return fmt.Errorf("%T error reading struct: %s", p.Qe, err)
5855 }
5856 return nil
5857 }
5858
5859 func (p *GetServiceNamesResult) Write(oprot thrift.TProtocol) error {
5860 if err := oprot.WriteStructBegin("getServiceNames_result"); err != nil {
5861 return fmt.Errorf("%T write struct begin error: %s", p, err)
5862 }
5863 if err := p.writeField0(oprot); err != nil {
5864 return err
5865 }
5866 if err := p.writeField1(oprot); err != nil {
5867 return err
5868 }
5869 if err := oprot.WriteFieldStop(); err != nil {
5870 return fmt.Errorf("write field stop error: %s", err)
5871 }
5872 if err := oprot.WriteStructEnd(); err != nil {
5873 return fmt.Errorf("write struct stop error: %s", err)
5874 }
5875 return nil
5876 }
5877
5878 func (p *GetServiceNamesResult) writeField0(oprot thrift.TProtocol) (err error) {
5879 if p.IsSetSuccess() {
5880 if err := oprot.WriteFieldBegin("success", thrift.SET, 0); err != nil {
5881 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
5882 }
5883 if err := oprot.WriteSetBegin(thrift.STRING, len(p.Success)); err != nil {
5884 return fmt.Errorf("error writing set begin: %s", err)
5885 }
5886 for v, _ := range p.Success {
5887 if err := oprot.WriteString(string(v)); err != nil {
5888 return fmt.Errorf("%T. (0) field write error: %s", p, err)
5889 }
5890 }
5891 if err := oprot.WriteSetEnd(); err != nil {
5892 return fmt.Errorf("error writing set end: %s", err)
5893 }
5894 if err := oprot.WriteFieldEnd(); err != nil {
5895 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
5896 }
5897 }
5898 return err
5899 }
5900
5901 func (p *GetServiceNamesResult) writeField1(oprot thrift.TProtocol) (err error) {
5902 if p.IsSetQe() {
5903 if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil {
5904 return fmt.Errorf("%T write field begin error 1:qe: %s", p, err)
5905 }
5906 if err := p.Qe.Write(oprot); err != nil {
5907 return fmt.Errorf("%T error writing struct: %s", p.Qe, err)
5908 }
5909 if err := oprot.WriteFieldEnd(); err != nil {
5910 return fmt.Errorf("%T write field end error 1:qe: %s", p, err)
5911 }
5912 }
5913 return err
5914 }
5915
5916 func (p *GetServiceNamesResult) String() string {
5917 if p == nil {
5918 return "<nil>"
5919 }
5920 return fmt.Sprintf("GetServiceNamesResult(%+v)", *p)
5921 }
5922
5923 type GetSpanNamesArgs struct {
5924 ServiceName string `thrift:"service_name,1" json:"service_name"`
5925 }
5926
5927 func NewGetSpanNamesArgs() *GetSpanNamesArgs {
5928 return &GetSpanNamesArgs{}
5929 }
5930
5931 func (p *GetSpanNamesArgs) GetServiceName() string {
5932 return p.ServiceName
5933 }
5934 func (p *GetSpanNamesArgs) Read(iprot thrift.TProtocol) error {
5935 if _, err := iprot.ReadStructBegin(); err != nil {
5936 return fmt.Errorf("%T read error: %s", p, err)
5937 }
5938 for {
5939 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
5940 if err != nil {
5941 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
5942 }
5943 if fieldTypeId == thrift.STOP {
5944 break
5945 }
5946 switch fieldId {
5947 case 1:
5948 if err := p.ReadField1(iprot); err != nil {
5949 return err
5950 }
5951 default:
5952 if err := iprot.Skip(fieldTypeId); err != nil {
5953 return err
5954 }
5955 }
5956 if err := iprot.ReadFieldEnd(); err != nil {
5957 return err
5958 }
5959 }
5960 if err := iprot.ReadStructEnd(); err != nil {
5961 return fmt.Errorf("%T read struct end error: %s", p, err)
5962 }
5963 return nil
5964 }
5965
5966 func (p *GetSpanNamesArgs) ReadField1(iprot thrift.TProtocol) error {
5967 if v, err := iprot.ReadString(); err != nil {
5968 return fmt.Errorf("error reading field 1: %s", err)
5969 } else {
5970 p.ServiceName = v
5971 }
5972 return nil
5973 }
5974
5975 func (p *GetSpanNamesArgs) Write(oprot thrift.TProtocol) error {
5976 if err := oprot.WriteStructBegin("getSpanNames_args"); err != nil {
5977 return fmt.Errorf("%T write struct begin error: %s", p, err)
5978 }
5979 if err := p.writeField1(oprot); err != nil {
5980 return err
5981 }
5982 if err := oprot.WriteFieldStop(); err != nil {
5983 return fmt.Errorf("write field stop error: %s", err)
5984 }
5985 if err := oprot.WriteStructEnd(); err != nil {
5986 return fmt.Errorf("write struct stop error: %s", err)
5987 }
5988 return nil
5989 }
5990
5991 func (p *GetSpanNamesArgs) writeField1(oprot thrift.TProtocol) (err error) {
5992 if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil {
5993 return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err)
5994 }
5995 if err := oprot.WriteString(string(p.ServiceName)); err != nil {
5996 return fmt.Errorf("%T.service_name (1) field write error: %s", p, err)
5997 }
5998 if err := oprot.WriteFieldEnd(); err != nil {
5999 return fmt.Errorf("%T write field end error 1:service_name: %s", p, err)
6000 }
6001 return err
6002 }
6003
6004 func (p *GetSpanNamesArgs) String() string {
6005 if p == nil {
6006 return "<nil>"
6007 }
6008 return fmt.Sprintf("GetSpanNamesArgs(%+v)", *p)
6009 }
6010
6011 type GetSpanNamesResult struct {
6012 Success map[string]bool `thrift:"success,0" json:"success"`
6013 Qe *QueryException `thrift:"qe,1" json:"qe"`
6014 }
6015
6016 func NewGetSpanNamesResult() *GetSpanNamesResult {
6017 return &GetSpanNamesResult{}
6018 }
6019
6020 var GetSpanNamesResult_Success_DEFAULT map[string]bool
6021
6022 func (p *GetSpanNamesResult) GetSuccess() map[string]bool {
6023 return p.Success
6024 }
6025
6026 var GetSpanNamesResult_Qe_DEFAULT *QueryException
6027
6028 func (p *GetSpanNamesResult) GetQe() *QueryException {
6029 if !p.IsSetQe() {
6030 return GetSpanNamesResult_Qe_DEFAULT
6031 }
6032 return p.Qe
6033 }
6034 func (p *GetSpanNamesResult) IsSetSuccess() bool {
6035 return p.Success != nil
6036 }
6037
6038 func (p *GetSpanNamesResult) IsSetQe() bool {
6039 return p.Qe != nil
6040 }
6041
6042 func (p *GetSpanNamesResult) Read(iprot thrift.TProtocol) error {
6043 if _, err := iprot.ReadStructBegin(); err != nil {
6044 return fmt.Errorf("%T read error: %s", p, err)
6045 }
6046 for {
6047 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
6048 if err != nil {
6049 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
6050 }
6051 if fieldTypeId == thrift.STOP {
6052 break
6053 }
6054 switch fieldId {
6055 case 0:
6056 if err := p.ReadField0(iprot); err != nil {
6057 return err
6058 }
6059 case 1:
6060 if err := p.ReadField1(iprot); err != nil {
6061 return err
6062 }
6063 default:
6064 if err := iprot.Skip(fieldTypeId); err != nil {
6065 return err
6066 }
6067 }
6068 if err := iprot.ReadFieldEnd(); err != nil {
6069 return err
6070 }
6071 }
6072 if err := iprot.ReadStructEnd(); err != nil {
6073 return fmt.Errorf("%T read struct end error: %s", p, err)
6074 }
6075 return nil
6076 }
6077
6078 func (p *GetSpanNamesResult) ReadField0(iprot thrift.TProtocol) error {
6079 _, size, err := iprot.ReadSetBegin()
6080 if err != nil {
6081 return fmt.Errorf("error reading set begin: %s", err)
6082 }
6083 tSet := make(map[string]bool, size)
6084 p.Success = tSet
6085 for i := 0; i < size; i++ {
6086 var _elem68 string
6087 if v, err := iprot.ReadString(); err != nil {
6088 return fmt.Errorf("error reading field 0: %s", err)
6089 } else {
6090 _elem68 = v
6091 }
6092 p.Success[_elem68] = true
6093 }
6094 if err := iprot.ReadSetEnd(); err != nil {
6095 return fmt.Errorf("error reading set end: %s", err)
6096 }
6097 return nil
6098 }
6099
6100 func (p *GetSpanNamesResult) ReadField1(iprot thrift.TProtocol) error {
6101 p.Qe = &QueryException{}
6102 if err := p.Qe.Read(iprot); err != nil {
6103 return fmt.Errorf("%T error reading struct: %s", p.Qe, err)
6104 }
6105 return nil
6106 }
6107
6108 func (p *GetSpanNamesResult) Write(oprot thrift.TProtocol) error {
6109 if err := oprot.WriteStructBegin("getSpanNames_result"); err != nil {
6110 return fmt.Errorf("%T write struct begin error: %s", p, err)
6111 }
6112 if err := p.writeField0(oprot); err != nil {
6113 return err
6114 }
6115 if err := p.writeField1(oprot); err != nil {
6116 return err
6117 }
6118 if err := oprot.WriteFieldStop(); err != nil {
6119 return fmt.Errorf("write field stop error: %s", err)
6120 }
6121 if err := oprot.WriteStructEnd(); err != nil {
6122 return fmt.Errorf("write struct stop error: %s", err)
6123 }
6124 return nil
6125 }
6126
6127 func (p *GetSpanNamesResult) writeField0(oprot thrift.TProtocol) (err error) {
6128 if p.IsSetSuccess() {
6129 if err := oprot.WriteFieldBegin("success", thrift.SET, 0); err != nil {
6130 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
6131 }
6132 if err := oprot.WriteSetBegin(thrift.STRING, len(p.Success)); err != nil {
6133 return fmt.Errorf("error writing set begin: %s", err)
6134 }
6135 for v, _ := range p.Success {
6136 if err := oprot.WriteString(string(v)); err != nil {
6137 return fmt.Errorf("%T. (0) field write error: %s", p, err)
6138 }
6139 }
6140 if err := oprot.WriteSetEnd(); err != nil {
6141 return fmt.Errorf("error writing set end: %s", err)
6142 }
6143 if err := oprot.WriteFieldEnd(); err != nil {
6144 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
6145 }
6146 }
6147 return err
6148 }
6149
6150 func (p *GetSpanNamesResult) writeField1(oprot thrift.TProtocol) (err error) {
6151 if p.IsSetQe() {
6152 if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil {
6153 return fmt.Errorf("%T write field begin error 1:qe: %s", p, err)
6154 }
6155 if err := p.Qe.Write(oprot); err != nil {
6156 return fmt.Errorf("%T error writing struct: %s", p.Qe, err)
6157 }
6158 if err := oprot.WriteFieldEnd(); err != nil {
6159 return fmt.Errorf("%T write field end error 1:qe: %s", p, err)
6160 }
6161 }
6162 return err
6163 }
6164
6165 func (p *GetSpanNamesResult) String() string {
6166 if p == nil {
6167 return "<nil>"
6168 }
6169 return fmt.Sprintf("GetSpanNamesResult(%+v)", *p)
6170 }
6171
6172 type SetTraceTimeToLiveArgs struct {
6173 TraceId int64 `thrift:"trace_id,1" json:"trace_id"`
6174 TtlSeconds int32 `thrift:"ttl_seconds,2" json:"ttl_seconds"`
6175 }
6176
6177 func NewSetTraceTimeToLiveArgs() *SetTraceTimeToLiveArgs {
6178 return &SetTraceTimeToLiveArgs{}
6179 }
6180
6181 func (p *SetTraceTimeToLiveArgs) GetTraceId() int64 {
6182 return p.TraceId
6183 }
6184
6185 func (p *SetTraceTimeToLiveArgs) GetTtlSeconds() int32 {
6186 return p.TtlSeconds
6187 }
6188 func (p *SetTraceTimeToLiveArgs) Read(iprot thrift.TProtocol) error {
6189 if _, err := iprot.ReadStructBegin(); err != nil {
6190 return fmt.Errorf("%T read error: %s", p, err)
6191 }
6192 for {
6193 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
6194 if err != nil {
6195 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
6196 }
6197 if fieldTypeId == thrift.STOP {
6198 break
6199 }
6200 switch fieldId {
6201 case 1:
6202 if err := p.ReadField1(iprot); err != nil {
6203 return err
6204 }
6205 case 2:
6206 if err := p.ReadField2(iprot); err != nil {
6207 return err
6208 }
6209 default:
6210 if err := iprot.Skip(fieldTypeId); err != nil {
6211 return err
6212 }
6213 }
6214 if err := iprot.ReadFieldEnd(); err != nil {
6215 return err
6216 }
6217 }
6218 if err := iprot.ReadStructEnd(); err != nil {
6219 return fmt.Errorf("%T read struct end error: %s", p, err)
6220 }
6221 return nil
6222 }
6223
6224 func (p *SetTraceTimeToLiveArgs) ReadField1(iprot thrift.TProtocol) error {
6225 if v, err := iprot.ReadI64(); err != nil {
6226 return fmt.Errorf("error reading field 1: %s", err)
6227 } else {
6228 p.TraceId = v
6229 }
6230 return nil
6231 }
6232
6233 func (p *SetTraceTimeToLiveArgs) ReadField2(iprot thrift.TProtocol) error {
6234 if v, err := iprot.ReadI32(); err != nil {
6235 return fmt.Errorf("error reading field 2: %s", err)
6236 } else {
6237 p.TtlSeconds = v
6238 }
6239 return nil
6240 }
6241
6242 func (p *SetTraceTimeToLiveArgs) Write(oprot thrift.TProtocol) error {
6243 if err := oprot.WriteStructBegin("setTraceTimeToLive_args"); err != nil {
6244 return fmt.Errorf("%T write struct begin error: %s", p, err)
6245 }
6246 if err := p.writeField1(oprot); err != nil {
6247 return err
6248 }
6249 if err := p.writeField2(oprot); err != nil {
6250 return err
6251 }
6252 if err := oprot.WriteFieldStop(); err != nil {
6253 return fmt.Errorf("write field stop error: %s", err)
6254 }
6255 if err := oprot.WriteStructEnd(); err != nil {
6256 return fmt.Errorf("write struct stop error: %s", err)
6257 }
6258 return nil
6259 }
6260
6261 func (p *SetTraceTimeToLiveArgs) writeField1(oprot thrift.TProtocol) (err error) {
6262 if err := oprot.WriteFieldBegin("trace_id", thrift.I64, 1); err != nil {
6263 return fmt.Errorf("%T write field begin error 1:trace_id: %s", p, err)
6264 }
6265 if err := oprot.WriteI64(int64(p.TraceId)); err != nil {
6266 return fmt.Errorf("%T.trace_id (1) field write error: %s", p, err)
6267 }
6268 if err := oprot.WriteFieldEnd(); err != nil {
6269 return fmt.Errorf("%T write field end error 1:trace_id: %s", p, err)
6270 }
6271 return err
6272 }
6273
6274 func (p *SetTraceTimeToLiveArgs) writeField2(oprot thrift.TProtocol) (err error) {
6275 if err := oprot.WriteFieldBegin("ttl_seconds", thrift.I32, 2); err != nil {
6276 return fmt.Errorf("%T write field begin error 2:ttl_seconds: %s", p, err)
6277 }
6278 if err := oprot.WriteI32(int32(p.TtlSeconds)); err != nil {
6279 return fmt.Errorf("%T.ttl_seconds (2) field write error: %s", p, err)
6280 }
6281 if err := oprot.WriteFieldEnd(); err != nil {
6282 return fmt.Errorf("%T write field end error 2:ttl_seconds: %s", p, err)
6283 }
6284 return err
6285 }
6286
6287 func (p *SetTraceTimeToLiveArgs) String() string {
6288 if p == nil {
6289 return "<nil>"
6290 }
6291 return fmt.Sprintf("SetTraceTimeToLiveArgs(%+v)", *p)
6292 }
6293
6294 type SetTraceTimeToLiveResult struct {
6295 Qe *QueryException `thrift:"qe,1" json:"qe"`
6296 }
6297
6298 func NewSetTraceTimeToLiveResult() *SetTraceTimeToLiveResult {
6299 return &SetTraceTimeToLiveResult{}
6300 }
6301
6302 var SetTraceTimeToLiveResult_Qe_DEFAULT *QueryException
6303
6304 func (p *SetTraceTimeToLiveResult) GetQe() *QueryException {
6305 if !p.IsSetQe() {
6306 return SetTraceTimeToLiveResult_Qe_DEFAULT
6307 }
6308 return p.Qe
6309 }
6310 func (p *SetTraceTimeToLiveResult) IsSetQe() bool {
6311 return p.Qe != nil
6312 }
6313
6314 func (p *SetTraceTimeToLiveResult) Read(iprot thrift.TProtocol) error {
6315 if _, err := iprot.ReadStructBegin(); err != nil {
6316 return fmt.Errorf("%T read error: %s", p, err)
6317 }
6318 for {
6319 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
6320 if err != nil {
6321 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
6322 }
6323 if fieldTypeId == thrift.STOP {
6324 break
6325 }
6326 switch fieldId {
6327 case 1:
6328 if err := p.ReadField1(iprot); err != nil {
6329 return err
6330 }
6331 default:
6332 if err := iprot.Skip(fieldTypeId); err != nil {
6333 return err
6334 }
6335 }
6336 if err := iprot.ReadFieldEnd(); err != nil {
6337 return err
6338 }
6339 }
6340 if err := iprot.ReadStructEnd(); err != nil {
6341 return fmt.Errorf("%T read struct end error: %s", p, err)
6342 }
6343 return nil
6344 }
6345
6346 func (p *SetTraceTimeToLiveResult) ReadField1(iprot thrift.TProtocol) error {
6347 p.Qe = &QueryException{}
6348 if err := p.Qe.Read(iprot); err != nil {
6349 return fmt.Errorf("%T error reading struct: %s", p.Qe, err)
6350 }
6351 return nil
6352 }
6353
6354 func (p *SetTraceTimeToLiveResult) Write(oprot thrift.TProtocol) error {
6355 if err := oprot.WriteStructBegin("setTraceTimeToLive_result"); err != nil {
6356 return fmt.Errorf("%T write struct begin error: %s", p, err)
6357 }
6358 if err := p.writeField1(oprot); err != nil {
6359 return err
6360 }
6361 if err := oprot.WriteFieldStop(); err != nil {
6362 return fmt.Errorf("write field stop error: %s", err)
6363 }
6364 if err := oprot.WriteStructEnd(); err != nil {
6365 return fmt.Errorf("write struct stop error: %s", err)
6366 }
6367 return nil
6368 }
6369
6370 func (p *SetTraceTimeToLiveResult) writeField1(oprot thrift.TProtocol) (err error) {
6371 if p.IsSetQe() {
6372 if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil {
6373 return fmt.Errorf("%T write field begin error 1:qe: %s", p, err)
6374 }
6375 if err := p.Qe.Write(oprot); err != nil {
6376 return fmt.Errorf("%T error writing struct: %s", p.Qe, err)
6377 }
6378 if err := oprot.WriteFieldEnd(); err != nil {
6379 return fmt.Errorf("%T write field end error 1:qe: %s", p, err)
6380 }
6381 }
6382 return err
6383 }
6384
6385 func (p *SetTraceTimeToLiveResult) String() string {
6386 if p == nil {
6387 return "<nil>"
6388 }
6389 return fmt.Sprintf("SetTraceTimeToLiveResult(%+v)", *p)
6390 }
6391
6392 type GetTraceTimeToLiveArgs struct {
6393 TraceId int64 `thrift:"trace_id,1" json:"trace_id"`
6394 }
6395
6396 func NewGetTraceTimeToLiveArgs() *GetTraceTimeToLiveArgs {
6397 return &GetTraceTimeToLiveArgs{}
6398 }
6399
6400 func (p *GetTraceTimeToLiveArgs) GetTraceId() int64 {
6401 return p.TraceId
6402 }
6403 func (p *GetTraceTimeToLiveArgs) Read(iprot thrift.TProtocol) error {
6404 if _, err := iprot.ReadStructBegin(); err != nil {
6405 return fmt.Errorf("%T read error: %s", p, err)
6406 }
6407 for {
6408 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
6409 if err != nil {
6410 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
6411 }
6412 if fieldTypeId == thrift.STOP {
6413 break
6414 }
6415 switch fieldId {
6416 case 1:
6417 if err := p.ReadField1(iprot); err != nil {
6418 return err
6419 }
6420 default:
6421 if err := iprot.Skip(fieldTypeId); err != nil {
6422 return err
6423 }
6424 }
6425 if err := iprot.ReadFieldEnd(); err != nil {
6426 return err
6427 }
6428 }
6429 if err := iprot.ReadStructEnd(); err != nil {
6430 return fmt.Errorf("%T read struct end error: %s", p, err)
6431 }
6432 return nil
6433 }
6434
6435 func (p *GetTraceTimeToLiveArgs) ReadField1(iprot thrift.TProtocol) error {
6436 if v, err := iprot.ReadI64(); err != nil {
6437 return fmt.Errorf("error reading field 1: %s", err)
6438 } else {
6439 p.TraceId = v
6440 }
6441 return nil
6442 }
6443
6444 func (p *GetTraceTimeToLiveArgs) Write(oprot thrift.TProtocol) error {
6445 if err := oprot.WriteStructBegin("getTraceTimeToLive_args"); err != nil {
6446 return fmt.Errorf("%T write struct begin error: %s", p, err)
6447 }
6448 if err := p.writeField1(oprot); err != nil {
6449 return err
6450 }
6451 if err := oprot.WriteFieldStop(); err != nil {
6452 return fmt.Errorf("write field stop error: %s", err)
6453 }
6454 if err := oprot.WriteStructEnd(); err != nil {
6455 return fmt.Errorf("write struct stop error: %s", err)
6456 }
6457 return nil
6458 }
6459
6460 func (p *GetTraceTimeToLiveArgs) writeField1(oprot thrift.TProtocol) (err error) {
6461 if err := oprot.WriteFieldBegin("trace_id", thrift.I64, 1); err != nil {
6462 return fmt.Errorf("%T write field begin error 1:trace_id: %s", p, err)
6463 }
6464 if err := oprot.WriteI64(int64(p.TraceId)); err != nil {
6465 return fmt.Errorf("%T.trace_id (1) field write error: %s", p, err)
6466 }
6467 if err := oprot.WriteFieldEnd(); err != nil {
6468 return fmt.Errorf("%T write field end error 1:trace_id: %s", p, err)
6469 }
6470 return err
6471 }
6472
6473 func (p *GetTraceTimeToLiveArgs) String() string {
6474 if p == nil {
6475 return "<nil>"
6476 }
6477 return fmt.Sprintf("GetTraceTimeToLiveArgs(%+v)", *p)
6478 }
6479
6480 type GetTraceTimeToLiveResult struct {
6481 Success *int32 `thrift:"success,0" json:"success"`
6482 Qe *QueryException `thrift:"qe,1" json:"qe"`
6483 }
6484
6485 func NewGetTraceTimeToLiveResult() *GetTraceTimeToLiveResult {
6486 return &GetTraceTimeToLiveResult{}
6487 }
6488
6489 var GetTraceTimeToLiveResult_Success_DEFAULT int32
6490
6491 func (p *GetTraceTimeToLiveResult) GetSuccess() int32 {
6492 if !p.IsSetSuccess() {
6493 return GetTraceTimeToLiveResult_Success_DEFAULT
6494 }
6495 return *p.Success
6496 }
6497
6498 var GetTraceTimeToLiveResult_Qe_DEFAULT *QueryException
6499
6500 func (p *GetTraceTimeToLiveResult) GetQe() *QueryException {
6501 if !p.IsSetQe() {
6502 return GetTraceTimeToLiveResult_Qe_DEFAULT
6503 }
6504 return p.Qe
6505 }
6506 func (p *GetTraceTimeToLiveResult) IsSetSuccess() bool {
6507 return p.Success != nil
6508 }
6509
6510 func (p *GetTraceTimeToLiveResult) IsSetQe() bool {
6511 return p.Qe != nil
6512 }
6513
6514 func (p *GetTraceTimeToLiveResult) Read(iprot thrift.TProtocol) error {
6515 if _, err := iprot.ReadStructBegin(); err != nil {
6516 return fmt.Errorf("%T read error: %s", p, err)
6517 }
6518 for {
6519 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
6520 if err != nil {
6521 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
6522 }
6523 if fieldTypeId == thrift.STOP {
6524 break
6525 }
6526 switch fieldId {
6527 case 0:
6528 if err := p.ReadField0(iprot); err != nil {
6529 return err
6530 }
6531 case 1:
6532 if err := p.ReadField1(iprot); err != nil {
6533 return err
6534 }
6535 default:
6536 if err := iprot.Skip(fieldTypeId); err != nil {
6537 return err
6538 }
6539 }
6540 if err := iprot.ReadFieldEnd(); err != nil {
6541 return err
6542 }
6543 }
6544 if err := iprot.ReadStructEnd(); err != nil {
6545 return fmt.Errorf("%T read struct end error: %s", p, err)
6546 }
6547 return nil
6548 }
6549
6550 func (p *GetTraceTimeToLiveResult) ReadField0(iprot thrift.TProtocol) error {
6551 if v, err := iprot.ReadI32(); err != nil {
6552 return fmt.Errorf("error reading field 0: %s", err)
6553 } else {
6554 p.Success = &v
6555 }
6556 return nil
6557 }
6558
6559 func (p *GetTraceTimeToLiveResult) ReadField1(iprot thrift.TProtocol) error {
6560 p.Qe = &QueryException{}
6561 if err := p.Qe.Read(iprot); err != nil {
6562 return fmt.Errorf("%T error reading struct: %s", p.Qe, err)
6563 }
6564 return nil
6565 }
6566
6567 func (p *GetTraceTimeToLiveResult) Write(oprot thrift.TProtocol) error {
6568 if err := oprot.WriteStructBegin("getTraceTimeToLive_result"); err != nil {
6569 return fmt.Errorf("%T write struct begin error: %s", p, err)
6570 }
6571 if err := p.writeField0(oprot); err != nil {
6572 return err
6573 }
6574 if err := p.writeField1(oprot); err != nil {
6575 return err
6576 }
6577 if err := oprot.WriteFieldStop(); err != nil {
6578 return fmt.Errorf("write field stop error: %s", err)
6579 }
6580 if err := oprot.WriteStructEnd(); err != nil {
6581 return fmt.Errorf("write struct stop error: %s", err)
6582 }
6583 return nil
6584 }
6585
6586 func (p *GetTraceTimeToLiveResult) writeField0(oprot thrift.TProtocol) (err error) {
6587 if p.IsSetSuccess() {
6588 if err := oprot.WriteFieldBegin("success", thrift.I32, 0); err != nil {
6589 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
6590 }
6591 if err := oprot.WriteI32(int32(*p.Success)); err != nil {
6592 return fmt.Errorf("%T.success (0) field write error: %s", p, err)
6593 }
6594 if err := oprot.WriteFieldEnd(); err != nil {
6595 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
6596 }
6597 }
6598 return err
6599 }
6600
6601 func (p *GetTraceTimeToLiveResult) writeField1(oprot thrift.TProtocol) (err error) {
6602 if p.IsSetQe() {
6603 if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil {
6604 return fmt.Errorf("%T write field begin error 1:qe: %s", p, err)
6605 }
6606 if err := p.Qe.Write(oprot); err != nil {
6607 return fmt.Errorf("%T error writing struct: %s", p.Qe, err)
6608 }
6609 if err := oprot.WriteFieldEnd(); err != nil {
6610 return fmt.Errorf("%T write field end error 1:qe: %s", p, err)
6611 }
6612 }
6613 return err
6614 }
6615
6616 func (p *GetTraceTimeToLiveResult) String() string {
6617 if p == nil {
6618 return "<nil>"
6619 }
6620 return fmt.Sprintf("GetTraceTimeToLiveResult(%+v)", *p)
6621 }
6622
6623 type GetDataTimeToLiveArgs struct {
6624 }
6625
6626 func NewGetDataTimeToLiveArgs() *GetDataTimeToLiveArgs {
6627 return &GetDataTimeToLiveArgs{}
6628 }
6629
6630 func (p *GetDataTimeToLiveArgs) Read(iprot thrift.TProtocol) error {
6631 if _, err := iprot.ReadStructBegin(); err != nil {
6632 return fmt.Errorf("%T read error: %s", p, err)
6633 }
6634 for {
6635 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
6636 if err != nil {
6637 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
6638 }
6639 if fieldTypeId == thrift.STOP {
6640 break
6641 }
6642 if err := iprot.Skip(fieldTypeId); err != nil {
6643 return err
6644 }
6645 if err := iprot.ReadFieldEnd(); err != nil {
6646 return err
6647 }
6648 }
6649 if err := iprot.ReadStructEnd(); err != nil {
6650 return fmt.Errorf("%T read struct end error: %s", p, err)
6651 }
6652 return nil
6653 }
6654
6655 func (p *GetDataTimeToLiveArgs) Write(oprot thrift.TProtocol) error {
6656 if err := oprot.WriteStructBegin("getDataTimeToLive_args"); err != nil {
6657 return fmt.Errorf("%T write struct begin error: %s", p, err)
6658 }
6659 if err := oprot.WriteFieldStop(); err != nil {
6660 return fmt.Errorf("write field stop error: %s", err)
6661 }
6662 if err := oprot.WriteStructEnd(); err != nil {
6663 return fmt.Errorf("write struct stop error: %s", err)
6664 }
6665 return nil
6666 }
6667
6668 func (p *GetDataTimeToLiveArgs) String() string {
6669 if p == nil {
6670 return "<nil>"
6671 }
6672 return fmt.Sprintf("GetDataTimeToLiveArgs(%+v)", *p)
6673 }
6674
6675 type GetDataTimeToLiveResult struct {
6676 Success *int32 `thrift:"success,0" json:"success"`
6677 Qe *QueryException `thrift:"qe,1" json:"qe"`
6678 }
6679
6680 func NewGetDataTimeToLiveResult() *GetDataTimeToLiveResult {
6681 return &GetDataTimeToLiveResult{}
6682 }
6683
6684 var GetDataTimeToLiveResult_Success_DEFAULT int32
6685
6686 func (p *GetDataTimeToLiveResult) GetSuccess() int32 {
6687 if !p.IsSetSuccess() {
6688 return GetDataTimeToLiveResult_Success_DEFAULT
6689 }
6690 return *p.Success
6691 }
6692
6693 var GetDataTimeToLiveResult_Qe_DEFAULT *QueryException
6694
6695 func (p *GetDataTimeToLiveResult) GetQe() *QueryException {
6696 if !p.IsSetQe() {
6697 return GetDataTimeToLiveResult_Qe_DEFAULT
6698 }
6699 return p.Qe
6700 }
6701 func (p *GetDataTimeToLiveResult) IsSetSuccess() bool {
6702 return p.Success != nil
6703 }
6704
6705 func (p *GetDataTimeToLiveResult) IsSetQe() bool {
6706 return p.Qe != nil
6707 }
6708
6709 func (p *GetDataTimeToLiveResult) Read(iprot thrift.TProtocol) error {
6710 if _, err := iprot.ReadStructBegin(); err != nil {
6711 return fmt.Errorf("%T read error: %s", p, err)
6712 }
6713 for {
6714 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
6715 if err != nil {
6716 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
6717 }
6718 if fieldTypeId == thrift.STOP {
6719 break
6720 }
6721 switch fieldId {
6722 case 0:
6723 if err := p.ReadField0(iprot); err != nil {
6724 return err
6725 }
6726 case 1:
6727 if err := p.ReadField1(iprot); err != nil {
6728 return err
6729 }
6730 default:
6731 if err := iprot.Skip(fieldTypeId); err != nil {
6732 return err
6733 }
6734 }
6735 if err := iprot.ReadFieldEnd(); err != nil {
6736 return err
6737 }
6738 }
6739 if err := iprot.ReadStructEnd(); err != nil {
6740 return fmt.Errorf("%T read struct end error: %s", p, err)
6741 }
6742 return nil
6743 }
6744
6745 func (p *GetDataTimeToLiveResult) ReadField0(iprot thrift.TProtocol) error {
6746 if v, err := iprot.ReadI32(); err != nil {
6747 return fmt.Errorf("error reading field 0: %s", err)
6748 } else {
6749 p.Success = &v
6750 }
6751 return nil
6752 }
6753
6754 func (p *GetDataTimeToLiveResult) ReadField1(iprot thrift.TProtocol) error {
6755 p.Qe = &QueryException{}
6756 if err := p.Qe.Read(iprot); err != nil {
6757 return fmt.Errorf("%T error reading struct: %s", p.Qe, err)
6758 }
6759 return nil
6760 }
6761
6762 func (p *GetDataTimeToLiveResult) Write(oprot thrift.TProtocol) error {
6763 if err := oprot.WriteStructBegin("getDataTimeToLive_result"); err != nil {
6764 return fmt.Errorf("%T write struct begin error: %s", p, err)
6765 }
6766 if err := p.writeField0(oprot); err != nil {
6767 return err
6768 }
6769 if err := p.writeField1(oprot); err != nil {
6770 return err
6771 }
6772 if err := oprot.WriteFieldStop(); err != nil {
6773 return fmt.Errorf("write field stop error: %s", err)
6774 }
6775 if err := oprot.WriteStructEnd(); err != nil {
6776 return fmt.Errorf("write struct stop error: %s", err)
6777 }
6778 return nil
6779 }
6780
6781 func (p *GetDataTimeToLiveResult) writeField0(oprot thrift.TProtocol) (err error) {
6782 if p.IsSetSuccess() {
6783 if err := oprot.WriteFieldBegin("success", thrift.I32, 0); err != nil {
6784 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
6785 }
6786 if err := oprot.WriteI32(int32(*p.Success)); err != nil {
6787 return fmt.Errorf("%T.success (0) field write error: %s", p, err)
6788 }
6789 if err := oprot.WriteFieldEnd(); err != nil {
6790 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
6791 }
6792 }
6793 return err
6794 }
6795
6796 func (p *GetDataTimeToLiveResult) writeField1(oprot thrift.TProtocol) (err error) {
6797 if p.IsSetQe() {
6798 if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil {
6799 return fmt.Errorf("%T write field begin error 1:qe: %s", p, err)
6800 }
6801 if err := p.Qe.Write(oprot); err != nil {
6802 return fmt.Errorf("%T error writing struct: %s", p.Qe, err)
6803 }
6804 if err := oprot.WriteFieldEnd(); err != nil {
6805 return fmt.Errorf("%T write field end error 1:qe: %s", p, err)
6806 }
6807 }
6808 return err
6809 }
6810
6811 func (p *GetDataTimeToLiveResult) String() string {
6812 if p == nil {
6813 return "<nil>"
6814 }
6815 return fmt.Sprintf("GetDataTimeToLiveResult(%+v)", *p)
6816 }
6817
6818 type GetDependenciesArgs struct {
6819 StartTime int64 `thrift:"start_time,1" json:"start_time"`
6820 EndTime int64 `thrift:"end_time,2" json:"end_time"`
6821 }
6822
6823 func NewGetDependenciesArgs() *GetDependenciesArgs {
6824 return &GetDependenciesArgs{}
6825 }
6826
6827 func (p *GetDependenciesArgs) GetStartTime() int64 {
6828 return p.StartTime
6829 }
6830
6831 func (p *GetDependenciesArgs) GetEndTime() int64 {
6832 return p.EndTime
6833 }
6834 func (p *GetDependenciesArgs) Read(iprot thrift.TProtocol) error {
6835 if _, err := iprot.ReadStructBegin(); err != nil {
6836 return fmt.Errorf("%T read error: %s", p, err)
6837 }
6838 for {
6839 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
6840 if err != nil {
6841 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
6842 }
6843 if fieldTypeId == thrift.STOP {
6844 break
6845 }
6846 switch fieldId {
6847 case 1:
6848 if err := p.ReadField1(iprot); err != nil {
6849 return err
6850 }
6851 case 2:
6852 if err := p.ReadField2(iprot); err != nil {
6853 return err
6854 }
6855 default:
6856 if err := iprot.Skip(fieldTypeId); err != nil {
6857 return err
6858 }
6859 }
6860 if err := iprot.ReadFieldEnd(); err != nil {
6861 return err
6862 }
6863 }
6864 if err := iprot.ReadStructEnd(); err != nil {
6865 return fmt.Errorf("%T read struct end error: %s", p, err)
6866 }
6867 return nil
6868 }
6869
6870 func (p *GetDependenciesArgs) ReadField1(iprot thrift.TProtocol) error {
6871 if v, err := iprot.ReadI64(); err != nil {
6872 return fmt.Errorf("error reading field 1: %s", err)
6873 } else {
6874 p.StartTime = v
6875 }
6876 return nil
6877 }
6878
6879 func (p *GetDependenciesArgs) ReadField2(iprot thrift.TProtocol) error {
6880 if v, err := iprot.ReadI64(); err != nil {
6881 return fmt.Errorf("error reading field 2: %s", err)
6882 } else {
6883 p.EndTime = v
6884 }
6885 return nil
6886 }
6887
6888 func (p *GetDependenciesArgs) Write(oprot thrift.TProtocol) error {
6889 if err := oprot.WriteStructBegin("getDependencies_args"); err != nil {
6890 return fmt.Errorf("%T write struct begin error: %s", p, err)
6891 }
6892 if err := p.writeField1(oprot); err != nil {
6893 return err
6894 }
6895 if err := p.writeField2(oprot); err != nil {
6896 return err
6897 }
6898 if err := oprot.WriteFieldStop(); err != nil {
6899 return fmt.Errorf("write field stop error: %s", err)
6900 }
6901 if err := oprot.WriteStructEnd(); err != nil {
6902 return fmt.Errorf("write struct stop error: %s", err)
6903 }
6904 return nil
6905 }
6906
6907 func (p *GetDependenciesArgs) writeField1(oprot thrift.TProtocol) (err error) {
6908 if err := oprot.WriteFieldBegin("start_time", thrift.I64, 1); err != nil {
6909 return fmt.Errorf("%T write field begin error 1:start_time: %s", p, err)
6910 }
6911 if err := oprot.WriteI64(int64(p.StartTime)); err != nil {
6912 return fmt.Errorf("%T.start_time (1) field write error: %s", p, err)
6913 }
6914 if err := oprot.WriteFieldEnd(); err != nil {
6915 return fmt.Errorf("%T write field end error 1:start_time: %s", p, err)
6916 }
6917 return err
6918 }
6919
6920 func (p *GetDependenciesArgs) writeField2(oprot thrift.TProtocol) (err error) {
6921 if err := oprot.WriteFieldBegin("end_time", thrift.I64, 2); err != nil {
6922 return fmt.Errorf("%T write field begin error 2:end_time: %s", p, err)
6923 }
6924 if err := oprot.WriteI64(int64(p.EndTime)); err != nil {
6925 return fmt.Errorf("%T.end_time (2) field write error: %s", p, err)
6926 }
6927 if err := oprot.WriteFieldEnd(); err != nil {
6928 return fmt.Errorf("%T write field end error 2:end_time: %s", p, err)
6929 }
6930 return err
6931 }
6932
6933 func (p *GetDependenciesArgs) String() string {
6934 if p == nil {
6935 return "<nil>"
6936 }
6937 return fmt.Sprintf("GetDependenciesArgs(%+v)", *p)
6938 }
6939
6940 type GetDependenciesResult struct {
6941 Success *zipkindependencies.Dependencies `thrift:"success,0" json:"success"`
6942 Qe *QueryException `thrift:"qe,1" json:"qe"`
6943 }
6944
6945 func NewGetDependenciesResult() *GetDependenciesResult {
6946 return &GetDependenciesResult{}
6947 }
6948
6949 var GetDependenciesResult_Success_DEFAULT *zipkindependencies.Dependencies
6950
6951 func (p *GetDependenciesResult) GetSuccess() *zipkindependencies.Dependencies {
6952 if !p.IsSetSuccess() {
6953 return GetDependenciesResult_Success_DEFAULT
6954 }
6955 return p.Success
6956 }
6957
6958 var GetDependenciesResult_Qe_DEFAULT *QueryException
6959
6960 func (p *GetDependenciesResult) GetQe() *QueryException {
6961 if !p.IsSetQe() {
6962 return GetDependenciesResult_Qe_DEFAULT
6963 }
6964 return p.Qe
6965 }
6966 func (p *GetDependenciesResult) IsSetSuccess() bool {
6967 return p.Success != nil
6968 }
6969
6970 func (p *GetDependenciesResult) IsSetQe() bool {
6971 return p.Qe != nil
6972 }
6973
6974 func (p *GetDependenciesResult) Read(iprot thrift.TProtocol) error {
6975 if _, err := iprot.ReadStructBegin(); err != nil {
6976 return fmt.Errorf("%T read error: %s", p, err)
6977 }
6978 for {
6979 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
6980 if err != nil {
6981 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
6982 }
6983 if fieldTypeId == thrift.STOP {
6984 break
6985 }
6986 switch fieldId {
6987 case 0:
6988 if err := p.ReadField0(iprot); err != nil {
6989 return err
6990 }
6991 case 1:
6992 if err := p.ReadField1(iprot); err != nil {
6993 return err
6994 }
6995 default:
6996 if err := iprot.Skip(fieldTypeId); err != nil {
6997 return err
6998 }
6999 }
7000 if err := iprot.ReadFieldEnd(); err != nil {
7001 return err
7002 }
7003 }
7004 if err := iprot.ReadStructEnd(); err != nil {
7005 return fmt.Errorf("%T read struct end error: %s", p, err)
7006 }
7007 return nil
7008 }
7009
7010 func (p *GetDependenciesResult) ReadField0(iprot thrift.TProtocol) error {
7011 p.Success = &zipkindependencies.Dependencies{}
7012 if err := p.Success.Read(iprot); err != nil {
7013 return fmt.Errorf("%T error reading struct: %s", p.Success, err)
7014 }
7015 return nil
7016 }
7017
7018 func (p *GetDependenciesResult) ReadField1(iprot thrift.TProtocol) error {
7019 p.Qe = &QueryException{}
7020 if err := p.Qe.Read(iprot); err != nil {
7021 return fmt.Errorf("%T error reading struct: %s", p.Qe, err)
7022 }
7023 return nil
7024 }
7025
7026 func (p *GetDependenciesResult) Write(oprot thrift.TProtocol) error {
7027 if err := oprot.WriteStructBegin("getDependencies_result"); err != nil {
7028 return fmt.Errorf("%T write struct begin error: %s", p, err)
7029 }
7030 if err := p.writeField0(oprot); err != nil {
7031 return err
7032 }
7033 if err := p.writeField1(oprot); err != nil {
7034 return err
7035 }
7036 if err := oprot.WriteFieldStop(); err != nil {
7037 return fmt.Errorf("write field stop error: %s", err)
7038 }
7039 if err := oprot.WriteStructEnd(); err != nil {
7040 return fmt.Errorf("write struct stop error: %s", err)
7041 }
7042 return nil
7043 }
7044
7045 func (p *GetDependenciesResult) writeField0(oprot thrift.TProtocol) (err error) {
7046 if p.IsSetSuccess() {
7047 if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
7048 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
7049 }
7050 if err := p.Success.Write(oprot); err != nil {
7051 return fmt.Errorf("%T error writing struct: %s", p.Success, err)
7052 }
7053 if err := oprot.WriteFieldEnd(); err != nil {
7054 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
7055 }
7056 }
7057 return err
7058 }
7059
7060 func (p *GetDependenciesResult) writeField1(oprot thrift.TProtocol) (err error) {
7061 if p.IsSetQe() {
7062 if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil {
7063 return fmt.Errorf("%T write field begin error 1:qe: %s", p, err)
7064 }
7065 if err := p.Qe.Write(oprot); err != nil {
7066 return fmt.Errorf("%T error writing struct: %s", p.Qe, err)
7067 }
7068 if err := oprot.WriteFieldEnd(); err != nil {
7069 return fmt.Errorf("%T write field end error 1:qe: %s", p, err)
7070 }
7071 }
7072 return err
7073 }
7074
7075 func (p *GetDependenciesResult) String() string {
7076 if p == nil {
7077 return "<nil>"
7078 }
7079 return fmt.Sprintf("GetDependenciesResult(%+v)", *p)
7080 }
7081
7082 type GetTopAnnotationsArgs struct {
7083 ServiceName string `thrift:"service_name,1" json:"service_name"`
7084 }
7085
7086 func NewGetTopAnnotationsArgs() *GetTopAnnotationsArgs {
7087 return &GetTopAnnotationsArgs{}
7088 }
7089
7090 func (p *GetTopAnnotationsArgs) GetServiceName() string {
7091 return p.ServiceName
7092 }
7093 func (p *GetTopAnnotationsArgs) Read(iprot thrift.TProtocol) error {
7094 if _, err := iprot.ReadStructBegin(); err != nil {
7095 return fmt.Errorf("%T read error: %s", p, err)
7096 }
7097 for {
7098 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
7099 if err != nil {
7100 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
7101 }
7102 if fieldTypeId == thrift.STOP {
7103 break
7104 }
7105 switch fieldId {
7106 case 1:
7107 if err := p.ReadField1(iprot); err != nil {
7108 return err
7109 }
7110 default:
7111 if err := iprot.Skip(fieldTypeId); err != nil {
7112 return err
7113 }
7114 }
7115 if err := iprot.ReadFieldEnd(); err != nil {
7116 return err
7117 }
7118 }
7119 if err := iprot.ReadStructEnd(); err != nil {
7120 return fmt.Errorf("%T read struct end error: %s", p, err)
7121 }
7122 return nil
7123 }
7124
7125 func (p *GetTopAnnotationsArgs) ReadField1(iprot thrift.TProtocol) error {
7126 if v, err := iprot.ReadString(); err != nil {
7127 return fmt.Errorf("error reading field 1: %s", err)
7128 } else {
7129 p.ServiceName = v
7130 }
7131 return nil
7132 }
7133
7134 func (p *GetTopAnnotationsArgs) Write(oprot thrift.TProtocol) error {
7135 if err := oprot.WriteStructBegin("getTopAnnotations_args"); err != nil {
7136 return fmt.Errorf("%T write struct begin error: %s", p, err)
7137 }
7138 if err := p.writeField1(oprot); err != nil {
7139 return err
7140 }
7141 if err := oprot.WriteFieldStop(); err != nil {
7142 return fmt.Errorf("write field stop error: %s", err)
7143 }
7144 if err := oprot.WriteStructEnd(); err != nil {
7145 return fmt.Errorf("write struct stop error: %s", err)
7146 }
7147 return nil
7148 }
7149
7150 func (p *GetTopAnnotationsArgs) writeField1(oprot thrift.TProtocol) (err error) {
7151 if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil {
7152 return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err)
7153 }
7154 if err := oprot.WriteString(string(p.ServiceName)); err != nil {
7155 return fmt.Errorf("%T.service_name (1) field write error: %s", p, err)
7156 }
7157 if err := oprot.WriteFieldEnd(); err != nil {
7158 return fmt.Errorf("%T write field end error 1:service_name: %s", p, err)
7159 }
7160 return err
7161 }
7162
7163 func (p *GetTopAnnotationsArgs) String() string {
7164 if p == nil {
7165 return "<nil>"
7166 }
7167 return fmt.Sprintf("GetTopAnnotationsArgs(%+v)", *p)
7168 }
7169
7170 type GetTopAnnotationsResult struct {
7171 Success []string `thrift:"success,0" json:"success"`
7172 Qe *QueryException `thrift:"qe,1" json:"qe"`
7173 }
7174
7175 func NewGetTopAnnotationsResult() *GetTopAnnotationsResult {
7176 return &GetTopAnnotationsResult{}
7177 }
7178
7179 var GetTopAnnotationsResult_Success_DEFAULT []string
7180
7181 func (p *GetTopAnnotationsResult) GetSuccess() []string {
7182 return p.Success
7183 }
7184
7185 var GetTopAnnotationsResult_Qe_DEFAULT *QueryException
7186
7187 func (p *GetTopAnnotationsResult) GetQe() *QueryException {
7188 if !p.IsSetQe() {
7189 return GetTopAnnotationsResult_Qe_DEFAULT
7190 }
7191 return p.Qe
7192 }
7193 func (p *GetTopAnnotationsResult) IsSetSuccess() bool {
7194 return p.Success != nil
7195 }
7196
7197 func (p *GetTopAnnotationsResult) IsSetQe() bool {
7198 return p.Qe != nil
7199 }
7200
7201 func (p *GetTopAnnotationsResult) Read(iprot thrift.TProtocol) error {
7202 if _, err := iprot.ReadStructBegin(); err != nil {
7203 return fmt.Errorf("%T read error: %s", p, err)
7204 }
7205 for {
7206 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
7207 if err != nil {
7208 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
7209 }
7210 if fieldTypeId == thrift.STOP {
7211 break
7212 }
7213 switch fieldId {
7214 case 0:
7215 if err := p.ReadField0(iprot); err != nil {
7216 return err
7217 }
7218 case 1:
7219 if err := p.ReadField1(iprot); err != nil {
7220 return err
7221 }
7222 default:
7223 if err := iprot.Skip(fieldTypeId); err != nil {
7224 return err
7225 }
7226 }
7227 if err := iprot.ReadFieldEnd(); err != nil {
7228 return err
7229 }
7230 }
7231 if err := iprot.ReadStructEnd(); err != nil {
7232 return fmt.Errorf("%T read struct end error: %s", p, err)
7233 }
7234 return nil
7235 }
7236
7237 func (p *GetTopAnnotationsResult) ReadField0(iprot thrift.TProtocol) error {
7238 _, size, err := iprot.ReadListBegin()
7239 if err != nil {
7240 return fmt.Errorf("error reading list begin: %s", err)
7241 }
7242 tSlice := make([]string, 0, size)
7243 p.Success = tSlice
7244 for i := 0; i < size; i++ {
7245 var _elem69 string
7246 if v, err := iprot.ReadString(); err != nil {
7247 return fmt.Errorf("error reading field 0: %s", err)
7248 } else {
7249 _elem69 = v
7250 }
7251 p.Success = append(p.Success, _elem69)
7252 }
7253 if err := iprot.ReadListEnd(); err != nil {
7254 return fmt.Errorf("error reading list end: %s", err)
7255 }
7256 return nil
7257 }
7258
7259 func (p *GetTopAnnotationsResult) ReadField1(iprot thrift.TProtocol) error {
7260 p.Qe = &QueryException{}
7261 if err := p.Qe.Read(iprot); err != nil {
7262 return fmt.Errorf("%T error reading struct: %s", p.Qe, err)
7263 }
7264 return nil
7265 }
7266
7267 func (p *GetTopAnnotationsResult) Write(oprot thrift.TProtocol) error {
7268 if err := oprot.WriteStructBegin("getTopAnnotations_result"); err != nil {
7269 return fmt.Errorf("%T write struct begin error: %s", p, err)
7270 }
7271 if err := p.writeField0(oprot); err != nil {
7272 return err
7273 }
7274 if err := p.writeField1(oprot); err != nil {
7275 return err
7276 }
7277 if err := oprot.WriteFieldStop(); err != nil {
7278 return fmt.Errorf("write field stop error: %s", err)
7279 }
7280 if err := oprot.WriteStructEnd(); err != nil {
7281 return fmt.Errorf("write struct stop error: %s", err)
7282 }
7283 return nil
7284 }
7285
7286 func (p *GetTopAnnotationsResult) writeField0(oprot thrift.TProtocol) (err error) {
7287 if p.IsSetSuccess() {
7288 if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil {
7289 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
7290 }
7291 if err := oprot.WriteListBegin(thrift.STRING, len(p.Success)); err != nil {
7292 return fmt.Errorf("error writing list begin: %s", err)
7293 }
7294 for _, v := range p.Success {
7295 if err := oprot.WriteString(string(v)); err != nil {
7296 return fmt.Errorf("%T. (0) field write error: %s", p, err)
7297 }
7298 }
7299 if err := oprot.WriteListEnd(); err != nil {
7300 return fmt.Errorf("error writing list end: %s", err)
7301 }
7302 if err := oprot.WriteFieldEnd(); err != nil {
7303 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
7304 }
7305 }
7306 return err
7307 }
7308
7309 func (p *GetTopAnnotationsResult) writeField1(oprot thrift.TProtocol) (err error) {
7310 if p.IsSetQe() {
7311 if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil {
7312 return fmt.Errorf("%T write field begin error 1:qe: %s", p, err)
7313 }
7314 if err := p.Qe.Write(oprot); err != nil {
7315 return fmt.Errorf("%T error writing struct: %s", p.Qe, err)
7316 }
7317 if err := oprot.WriteFieldEnd(); err != nil {
7318 return fmt.Errorf("%T write field end error 1:qe: %s", p, err)
7319 }
7320 }
7321 return err
7322 }
7323
7324 func (p *GetTopAnnotationsResult) String() string {
7325 if p == nil {
7326 return "<nil>"
7327 }
7328 return fmt.Sprintf("GetTopAnnotationsResult(%+v)", *p)
7329 }
7330
7331 type GetTopKeyValueAnnotationsArgs struct {
7332 ServiceName string `thrift:"service_name,1" json:"service_name"`
7333 }
7334
7335 func NewGetTopKeyValueAnnotationsArgs() *GetTopKeyValueAnnotationsArgs {
7336 return &GetTopKeyValueAnnotationsArgs{}
7337 }
7338
7339 func (p *GetTopKeyValueAnnotationsArgs) GetServiceName() string {
7340 return p.ServiceName
7341 }
7342 func (p *GetTopKeyValueAnnotationsArgs) Read(iprot thrift.TProtocol) error {
7343 if _, err := iprot.ReadStructBegin(); err != nil {
7344 return fmt.Errorf("%T read error: %s", p, err)
7345 }
7346 for {
7347 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
7348 if err != nil {
7349 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
7350 }
7351 if fieldTypeId == thrift.STOP {
7352 break
7353 }
7354 switch fieldId {
7355 case 1:
7356 if err := p.ReadField1(iprot); err != nil {
7357 return err
7358 }
7359 default:
7360 if err := iprot.Skip(fieldTypeId); err != nil {
7361 return err
7362 }
7363 }
7364 if err := iprot.ReadFieldEnd(); err != nil {
7365 return err
7366 }
7367 }
7368 if err := iprot.ReadStructEnd(); err != nil {
7369 return fmt.Errorf("%T read struct end error: %s", p, err)
7370 }
7371 return nil
7372 }
7373
7374 func (p *GetTopKeyValueAnnotationsArgs) ReadField1(iprot thrift.TProtocol) error {
7375 if v, err := iprot.ReadString(); err != nil {
7376 return fmt.Errorf("error reading field 1: %s", err)
7377 } else {
7378 p.ServiceName = v
7379 }
7380 return nil
7381 }
7382
7383 func (p *GetTopKeyValueAnnotationsArgs) Write(oprot thrift.TProtocol) error {
7384 if err := oprot.WriteStructBegin("getTopKeyValueAnnotations_args"); err != nil {
7385 return fmt.Errorf("%T write struct begin error: %s", p, err)
7386 }
7387 if err := p.writeField1(oprot); err != nil {
7388 return err
7389 }
7390 if err := oprot.WriteFieldStop(); err != nil {
7391 return fmt.Errorf("write field stop error: %s", err)
7392 }
7393 if err := oprot.WriteStructEnd(); err != nil {
7394 return fmt.Errorf("write struct stop error: %s", err)
7395 }
7396 return nil
7397 }
7398
7399 func (p *GetTopKeyValueAnnotationsArgs) writeField1(oprot thrift.TProtocol) (err error) {
7400 if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 1); err != nil {
7401 return fmt.Errorf("%T write field begin error 1:service_name: %s", p, err)
7402 }
7403 if err := oprot.WriteString(string(p.ServiceName)); err != nil {
7404 return fmt.Errorf("%T.service_name (1) field write error: %s", p, err)
7405 }
7406 if err := oprot.WriteFieldEnd(); err != nil {
7407 return fmt.Errorf("%T write field end error 1:service_name: %s", p, err)
7408 }
7409 return err
7410 }
7411
7412 func (p *GetTopKeyValueAnnotationsArgs) String() string {
7413 if p == nil {
7414 return "<nil>"
7415 }
7416 return fmt.Sprintf("GetTopKeyValueAnnotationsArgs(%+v)", *p)
7417 }
7418
7419 type GetTopKeyValueAnnotationsResult struct {
7420 Success []string `thrift:"success,0" json:"success"`
7421 Qe *QueryException `thrift:"qe,1" json:"qe"`
7422 }
7423
7424 func NewGetTopKeyValueAnnotationsResult() *GetTopKeyValueAnnotationsResult {
7425 return &GetTopKeyValueAnnotationsResult{}
7426 }
7427
7428 var GetTopKeyValueAnnotationsResult_Success_DEFAULT []string
7429
7430 func (p *GetTopKeyValueAnnotationsResult) GetSuccess() []string {
7431 return p.Success
7432 }
7433
7434 var GetTopKeyValueAnnotationsResult_Qe_DEFAULT *QueryException
7435
7436 func (p *GetTopKeyValueAnnotationsResult) GetQe() *QueryException {
7437 if !p.IsSetQe() {
7438 return GetTopKeyValueAnnotationsResult_Qe_DEFAULT
7439 }
7440 return p.Qe
7441 }
7442 func (p *GetTopKeyValueAnnotationsResult) IsSetSuccess() bool {
7443 return p.Success != nil
7444 }
7445
7446 func (p *GetTopKeyValueAnnotationsResult) IsSetQe() bool {
7447 return p.Qe != nil
7448 }
7449
7450 func (p *GetTopKeyValueAnnotationsResult) Read(iprot thrift.TProtocol) error {
7451 if _, err := iprot.ReadStructBegin(); err != nil {
7452 return fmt.Errorf("%T read error: %s", p, err)
7453 }
7454 for {
7455 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
7456 if err != nil {
7457 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
7458 }
7459 if fieldTypeId == thrift.STOP {
7460 break
7461 }
7462 switch fieldId {
7463 case 0:
7464 if err := p.ReadField0(iprot); err != nil {
7465 return err
7466 }
7467 case 1:
7468 if err := p.ReadField1(iprot); err != nil {
7469 return err
7470 }
7471 default:
7472 if err := iprot.Skip(fieldTypeId); err != nil {
7473 return err
7474 }
7475 }
7476 if err := iprot.ReadFieldEnd(); err != nil {
7477 return err
7478 }
7479 }
7480 if err := iprot.ReadStructEnd(); err != nil {
7481 return fmt.Errorf("%T read struct end error: %s", p, err)
7482 }
7483 return nil
7484 }
7485
7486 func (p *GetTopKeyValueAnnotationsResult) ReadField0(iprot thrift.TProtocol) error {
7487 _, size, err := iprot.ReadListBegin()
7488 if err != nil {
7489 return fmt.Errorf("error reading list begin: %s", err)
7490 }
7491 tSlice := make([]string, 0, size)
7492 p.Success = tSlice
7493 for i := 0; i < size; i++ {
7494 var _elem70 string
7495 if v, err := iprot.ReadString(); err != nil {
7496 return fmt.Errorf("error reading field 0: %s", err)
7497 } else {
7498 _elem70 = v
7499 }
7500 p.Success = append(p.Success, _elem70)
7501 }
7502 if err := iprot.ReadListEnd(); err != nil {
7503 return fmt.Errorf("error reading list end: %s", err)
7504 }
7505 return nil
7506 }
7507
7508 func (p *GetTopKeyValueAnnotationsResult) ReadField1(iprot thrift.TProtocol) error {
7509 p.Qe = &QueryException{}
7510 if err := p.Qe.Read(iprot); err != nil {
7511 return fmt.Errorf("%T error reading struct: %s", p.Qe, err)
7512 }
7513 return nil
7514 }
7515
7516 func (p *GetTopKeyValueAnnotationsResult) Write(oprot thrift.TProtocol) error {
7517 if err := oprot.WriteStructBegin("getTopKeyValueAnnotations_result"); err != nil {
7518 return fmt.Errorf("%T write struct begin error: %s", p, err)
7519 }
7520 if err := p.writeField0(oprot); err != nil {
7521 return err
7522 }
7523 if err := p.writeField1(oprot); err != nil {
7524 return err
7525 }
7526 if err := oprot.WriteFieldStop(); err != nil {
7527 return fmt.Errorf("write field stop error: %s", err)
7528 }
7529 if err := oprot.WriteStructEnd(); err != nil {
7530 return fmt.Errorf("write struct stop error: %s", err)
7531 }
7532 return nil
7533 }
7534
7535 func (p *GetTopKeyValueAnnotationsResult) writeField0(oprot thrift.TProtocol) (err error) {
7536 if p.IsSetSuccess() {
7537 if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil {
7538 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
7539 }
7540 if err := oprot.WriteListBegin(thrift.STRING, len(p.Success)); err != nil {
7541 return fmt.Errorf("error writing list begin: %s", err)
7542 }
7543 for _, v := range p.Success {
7544 if err := oprot.WriteString(string(v)); err != nil {
7545 return fmt.Errorf("%T. (0) field write error: %s", p, err)
7546 }
7547 }
7548 if err := oprot.WriteListEnd(); err != nil {
7549 return fmt.Errorf("error writing list end: %s", err)
7550 }
7551 if err := oprot.WriteFieldEnd(); err != nil {
7552 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
7553 }
7554 }
7555 return err
7556 }
7557
7558 func (p *GetTopKeyValueAnnotationsResult) writeField1(oprot thrift.TProtocol) (err error) {
7559 if p.IsSetQe() {
7560 if err := oprot.WriteFieldBegin("qe", thrift.STRUCT, 1); err != nil {
7561 return fmt.Errorf("%T write field begin error 1:qe: %s", p, err)
7562 }
7563 if err := p.Qe.Write(oprot); err != nil {
7564 return fmt.Errorf("%T error writing struct: %s", p.Qe, err)
7565 }
7566 if err := oprot.WriteFieldEnd(); err != nil {
7567 return fmt.Errorf("%T write field end error 1:qe: %s", p, err)
7568 }
7569 }
7570 return err
7571 }
7572
7573 func (p *GetTopKeyValueAnnotationsResult) String() string {
7574 if p == nil {
7575 return "<nil>"
7576 }
7577 return fmt.Sprintf("GetTopKeyValueAnnotationsResult(%+v)", *p)
7578 }
7579
7580 type GetSpanDurationsArgs struct {
7581 TimeStamp int64 `thrift:"time_stamp,1" json:"time_stamp"`
7582 ServiceName string `thrift:"service_name,2" json:"service_name"`
7583 RpcName string `thrift:"rpc_name,3" json:"rpc_name"`
7584 }
7585
7586 func NewGetSpanDurationsArgs() *GetSpanDurationsArgs {
7587 return &GetSpanDurationsArgs{}
7588 }
7589
7590 func (p *GetSpanDurationsArgs) GetTimeStamp() int64 {
7591 return p.TimeStamp
7592 }
7593
7594 func (p *GetSpanDurationsArgs) GetServiceName() string {
7595 return p.ServiceName
7596 }
7597
7598 func (p *GetSpanDurationsArgs) GetRpcName() string {
7599 return p.RpcName
7600 }
7601 func (p *GetSpanDurationsArgs) Read(iprot thrift.TProtocol) error {
7602 if _, err := iprot.ReadStructBegin(); err != nil {
7603 return fmt.Errorf("%T read error: %s", p, err)
7604 }
7605 for {
7606 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
7607 if err != nil {
7608 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
7609 }
7610 if fieldTypeId == thrift.STOP {
7611 break
7612 }
7613 switch fieldId {
7614 case 1:
7615 if err := p.ReadField1(iprot); err != nil {
7616 return err
7617 }
7618 case 2:
7619 if err := p.ReadField2(iprot); err != nil {
7620 return err
7621 }
7622 case 3:
7623 if err := p.ReadField3(iprot); err != nil {
7624 return err
7625 }
7626 default:
7627 if err := iprot.Skip(fieldTypeId); err != nil {
7628 return err
7629 }
7630 }
7631 if err := iprot.ReadFieldEnd(); err != nil {
7632 return err
7633 }
7634 }
7635 if err := iprot.ReadStructEnd(); err != nil {
7636 return fmt.Errorf("%T read struct end error: %s", p, err)
7637 }
7638 return nil
7639 }
7640
7641 func (p *GetSpanDurationsArgs) ReadField1(iprot thrift.TProtocol) error {
7642 if v, err := iprot.ReadI64(); err != nil {
7643 return fmt.Errorf("error reading field 1: %s", err)
7644 } else {
7645 p.TimeStamp = v
7646 }
7647 return nil
7648 }
7649
7650 func (p *GetSpanDurationsArgs) ReadField2(iprot thrift.TProtocol) error {
7651 if v, err := iprot.ReadString(); err != nil {
7652 return fmt.Errorf("error reading field 2: %s", err)
7653 } else {
7654 p.ServiceName = v
7655 }
7656 return nil
7657 }
7658
7659 func (p *GetSpanDurationsArgs) ReadField3(iprot thrift.TProtocol) error {
7660 if v, err := iprot.ReadString(); err != nil {
7661 return fmt.Errorf("error reading field 3: %s", err)
7662 } else {
7663 p.RpcName = v
7664 }
7665 return nil
7666 }
7667
7668 func (p *GetSpanDurationsArgs) Write(oprot thrift.TProtocol) error {
7669 if err := oprot.WriteStructBegin("getSpanDurations_args"); err != nil {
7670 return fmt.Errorf("%T write struct begin error: %s", p, err)
7671 }
7672 if err := p.writeField1(oprot); err != nil {
7673 return err
7674 }
7675 if err := p.writeField2(oprot); err != nil {
7676 return err
7677 }
7678 if err := p.writeField3(oprot); err != nil {
7679 return err
7680 }
7681 if err := oprot.WriteFieldStop(); err != nil {
7682 return fmt.Errorf("write field stop error: %s", err)
7683 }
7684 if err := oprot.WriteStructEnd(); err != nil {
7685 return fmt.Errorf("write struct stop error: %s", err)
7686 }
7687 return nil
7688 }
7689
7690 func (p *GetSpanDurationsArgs) writeField1(oprot thrift.TProtocol) (err error) {
7691 if err := oprot.WriteFieldBegin("time_stamp", thrift.I64, 1); err != nil {
7692 return fmt.Errorf("%T write field begin error 1:time_stamp: %s", p, err)
7693 }
7694 if err := oprot.WriteI64(int64(p.TimeStamp)); err != nil {
7695 return fmt.Errorf("%T.time_stamp (1) field write error: %s", p, err)
7696 }
7697 if err := oprot.WriteFieldEnd(); err != nil {
7698 return fmt.Errorf("%T write field end error 1:time_stamp: %s", p, err)
7699 }
7700 return err
7701 }
7702
7703 func (p *GetSpanDurationsArgs) writeField2(oprot thrift.TProtocol) (err error) {
7704 if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 2); err != nil {
7705 return fmt.Errorf("%T write field begin error 2:service_name: %s", p, err)
7706 }
7707 if err := oprot.WriteString(string(p.ServiceName)); err != nil {
7708 return fmt.Errorf("%T.service_name (2) field write error: %s", p, err)
7709 }
7710 if err := oprot.WriteFieldEnd(); err != nil {
7711 return fmt.Errorf("%T write field end error 2:service_name: %s", p, err)
7712 }
7713 return err
7714 }
7715
7716 func (p *GetSpanDurationsArgs) writeField3(oprot thrift.TProtocol) (err error) {
7717 if err := oprot.WriteFieldBegin("rpc_name", thrift.STRING, 3); err != nil {
7718 return fmt.Errorf("%T write field begin error 3:rpc_name: %s", p, err)
7719 }
7720 if err := oprot.WriteString(string(p.RpcName)); err != nil {
7721 return fmt.Errorf("%T.rpc_name (3) field write error: %s", p, err)
7722 }
7723 if err := oprot.WriteFieldEnd(); err != nil {
7724 return fmt.Errorf("%T write field end error 3:rpc_name: %s", p, err)
7725 }
7726 return err
7727 }
7728
7729 func (p *GetSpanDurationsArgs) String() string {
7730 if p == nil {
7731 return "<nil>"
7732 }
7733 return fmt.Sprintf("GetSpanDurationsArgs(%+v)", *p)
7734 }
7735
7736 type GetSpanDurationsResult struct {
7737 Success map[string][]int64 `thrift:"success,0" json:"success"`
7738 }
7739
7740 func NewGetSpanDurationsResult() *GetSpanDurationsResult {
7741 return &GetSpanDurationsResult{}
7742 }
7743
7744 var GetSpanDurationsResult_Success_DEFAULT map[string][]int64
7745
7746 func (p *GetSpanDurationsResult) GetSuccess() map[string][]int64 {
7747 return p.Success
7748 }
7749 func (p *GetSpanDurationsResult) IsSetSuccess() bool {
7750 return p.Success != nil
7751 }
7752
7753 func (p *GetSpanDurationsResult) Read(iprot thrift.TProtocol) error {
7754 if _, err := iprot.ReadStructBegin(); err != nil {
7755 return fmt.Errorf("%T read error: %s", p, err)
7756 }
7757 for {
7758 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
7759 if err != nil {
7760 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
7761 }
7762 if fieldTypeId == thrift.STOP {
7763 break
7764 }
7765 switch fieldId {
7766 case 0:
7767 if err := p.ReadField0(iprot); err != nil {
7768 return err
7769 }
7770 default:
7771 if err := iprot.Skip(fieldTypeId); err != nil {
7772 return err
7773 }
7774 }
7775 if err := iprot.ReadFieldEnd(); err != nil {
7776 return err
7777 }
7778 }
7779 if err := iprot.ReadStructEnd(); err != nil {
7780 return fmt.Errorf("%T read struct end error: %s", p, err)
7781 }
7782 return nil
7783 }
7784
7785 func (p *GetSpanDurationsResult) ReadField0(iprot thrift.TProtocol) error {
7786 _, _, size, err := iprot.ReadMapBegin()
7787 if err != nil {
7788 return fmt.Errorf("error reading map begin: %s", err)
7789 }
7790 tMap := make(map[string][]int64, size)
7791 p.Success = tMap
7792 for i := 0; i < size; i++ {
7793 var _key71 string
7794 if v, err := iprot.ReadString(); err != nil {
7795 return fmt.Errorf("error reading field 0: %s", err)
7796 } else {
7797 _key71 = v
7798 }
7799 _, size, err := iprot.ReadListBegin()
7800 if err != nil {
7801 return fmt.Errorf("error reading list begin: %s", err)
7802 }
7803 tSlice := make([]int64, 0, size)
7804 _val72 := tSlice
7805 for i := 0; i < size; i++ {
7806 var _elem73 int64
7807 if v, err := iprot.ReadI64(); err != nil {
7808 return fmt.Errorf("error reading field 0: %s", err)
7809 } else {
7810 _elem73 = v
7811 }
7812 _val72 = append(_val72, _elem73)
7813 }
7814 if err := iprot.ReadListEnd(); err != nil {
7815 return fmt.Errorf("error reading list end: %s", err)
7816 }
7817 p.Success[_key71] = _val72
7818 }
7819 if err := iprot.ReadMapEnd(); err != nil {
7820 return fmt.Errorf("error reading map end: %s", err)
7821 }
7822 return nil
7823 }
7824
7825 func (p *GetSpanDurationsResult) Write(oprot thrift.TProtocol) error {
7826 if err := oprot.WriteStructBegin("getSpanDurations_result"); err != nil {
7827 return fmt.Errorf("%T write struct begin error: %s", p, err)
7828 }
7829 if err := p.writeField0(oprot); err != nil {
7830 return err
7831 }
7832 if err := oprot.WriteFieldStop(); err != nil {
7833 return fmt.Errorf("write field stop error: %s", err)
7834 }
7835 if err := oprot.WriteStructEnd(); err != nil {
7836 return fmt.Errorf("write struct stop error: %s", err)
7837 }
7838 return nil
7839 }
7840
7841 func (p *GetSpanDurationsResult) writeField0(oprot thrift.TProtocol) (err error) {
7842 if p.IsSetSuccess() {
7843 if err := oprot.WriteFieldBegin("success", thrift.MAP, 0); err != nil {
7844 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
7845 }
7846 if err := oprot.WriteMapBegin(thrift.STRING, thrift.LIST, len(p.Success)); err != nil {
7847 return fmt.Errorf("error writing map begin: %s", err)
7848 }
7849 for k, v := range p.Success {
7850 if err := oprot.WriteString(string(k)); err != nil {
7851 return fmt.Errorf("%T. (0) field write error: %s", p, err)
7852 }
7853 if err := oprot.WriteListBegin(thrift.I64, len(v)); err != nil {
7854 return fmt.Errorf("error writing list begin: %s", err)
7855 }
7856 for _, v := range v {
7857 if err := oprot.WriteI64(int64(v)); err != nil {
7858 return fmt.Errorf("%T. (0) field write error: %s", p, err)
7859 }
7860 }
7861 if err := oprot.WriteListEnd(); err != nil {
7862 return fmt.Errorf("error writing list end: %s", err)
7863 }
7864 }
7865 if err := oprot.WriteMapEnd(); err != nil {
7866 return fmt.Errorf("error writing map end: %s", err)
7867 }
7868 if err := oprot.WriteFieldEnd(); err != nil {
7869 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
7870 }
7871 }
7872 return err
7873 }
7874
7875 func (p *GetSpanDurationsResult) String() string {
7876 if p == nil {
7877 return "<nil>"
7878 }
7879 return fmt.Sprintf("GetSpanDurationsResult(%+v)", *p)
7880 }
7881
7882 type GetServiceNamesToTraceIdsArgs struct {
7883 TimeStamp int64 `thrift:"time_stamp,1" json:"time_stamp"`
7884 ServiceName string `thrift:"service_name,2" json:"service_name"`
7885 RpcName string `thrift:"rpc_name,3" json:"rpc_name"`
7886 }
7887
7888 func NewGetServiceNamesToTraceIdsArgs() *GetServiceNamesToTraceIdsArgs {
7889 return &GetServiceNamesToTraceIdsArgs{}
7890 }
7891
7892 func (p *GetServiceNamesToTraceIdsArgs) GetTimeStamp() int64 {
7893 return p.TimeStamp
7894 }
7895
7896 func (p *GetServiceNamesToTraceIdsArgs) GetServiceName() string {
7897 return p.ServiceName
7898 }
7899
7900 func (p *GetServiceNamesToTraceIdsArgs) GetRpcName() string {
7901 return p.RpcName
7902 }
7903 func (p *GetServiceNamesToTraceIdsArgs) Read(iprot thrift.TProtocol) error {
7904 if _, err := iprot.ReadStructBegin(); err != nil {
7905 return fmt.Errorf("%T read error: %s", p, err)
7906 }
7907 for {
7908 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
7909 if err != nil {
7910 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
7911 }
7912 if fieldTypeId == thrift.STOP {
7913 break
7914 }
7915 switch fieldId {
7916 case 1:
7917 if err := p.ReadField1(iprot); err != nil {
7918 return err
7919 }
7920 case 2:
7921 if err := p.ReadField2(iprot); err != nil {
7922 return err
7923 }
7924 case 3:
7925 if err := p.ReadField3(iprot); err != nil {
7926 return err
7927 }
7928 default:
7929 if err := iprot.Skip(fieldTypeId); err != nil {
7930 return err
7931 }
7932 }
7933 if err := iprot.ReadFieldEnd(); err != nil {
7934 return err
7935 }
7936 }
7937 if err := iprot.ReadStructEnd(); err != nil {
7938 return fmt.Errorf("%T read struct end error: %s", p, err)
7939 }
7940 return nil
7941 }
7942
7943 func (p *GetServiceNamesToTraceIdsArgs) ReadField1(iprot thrift.TProtocol) error {
7944 if v, err := iprot.ReadI64(); err != nil {
7945 return fmt.Errorf("error reading field 1: %s", err)
7946 } else {
7947 p.TimeStamp = v
7948 }
7949 return nil
7950 }
7951
7952 func (p *GetServiceNamesToTraceIdsArgs) ReadField2(iprot thrift.TProtocol) error {
7953 if v, err := iprot.ReadString(); err != nil {
7954 return fmt.Errorf("error reading field 2: %s", err)
7955 } else {
7956 p.ServiceName = v
7957 }
7958 return nil
7959 }
7960
7961 func (p *GetServiceNamesToTraceIdsArgs) ReadField3(iprot thrift.TProtocol) error {
7962 if v, err := iprot.ReadString(); err != nil {
7963 return fmt.Errorf("error reading field 3: %s", err)
7964 } else {
7965 p.RpcName = v
7966 }
7967 return nil
7968 }
7969
7970 func (p *GetServiceNamesToTraceIdsArgs) Write(oprot thrift.TProtocol) error {
7971 if err := oprot.WriteStructBegin("getServiceNamesToTraceIds_args"); err != nil {
7972 return fmt.Errorf("%T write struct begin error: %s", p, err)
7973 }
7974 if err := p.writeField1(oprot); err != nil {
7975 return err
7976 }
7977 if err := p.writeField2(oprot); err != nil {
7978 return err
7979 }
7980 if err := p.writeField3(oprot); err != nil {
7981 return err
7982 }
7983 if err := oprot.WriteFieldStop(); err != nil {
7984 return fmt.Errorf("write field stop error: %s", err)
7985 }
7986 if err := oprot.WriteStructEnd(); err != nil {
7987 return fmt.Errorf("write struct stop error: %s", err)
7988 }
7989 return nil
7990 }
7991
7992 func (p *GetServiceNamesToTraceIdsArgs) writeField1(oprot thrift.TProtocol) (err error) {
7993 if err := oprot.WriteFieldBegin("time_stamp", thrift.I64, 1); err != nil {
7994 return fmt.Errorf("%T write field begin error 1:time_stamp: %s", p, err)
7995 }
7996 if err := oprot.WriteI64(int64(p.TimeStamp)); err != nil {
7997 return fmt.Errorf("%T.time_stamp (1) field write error: %s", p, err)
7998 }
7999 if err := oprot.WriteFieldEnd(); err != nil {
8000 return fmt.Errorf("%T write field end error 1:time_stamp: %s", p, err)
8001 }
8002 return err
8003 }
8004
8005 func (p *GetServiceNamesToTraceIdsArgs) writeField2(oprot thrift.TProtocol) (err error) {
8006 if err := oprot.WriteFieldBegin("service_name", thrift.STRING, 2); err != nil {
8007 return fmt.Errorf("%T write field begin error 2:service_name: %s", p, err)
8008 }
8009 if err := oprot.WriteString(string(p.ServiceName)); err != nil {
8010 return fmt.Errorf("%T.service_name (2) field write error: %s", p, err)
8011 }
8012 if err := oprot.WriteFieldEnd(); err != nil {
8013 return fmt.Errorf("%T write field end error 2:service_name: %s", p, err)
8014 }
8015 return err
8016 }
8017
8018 func (p *GetServiceNamesToTraceIdsArgs) writeField3(oprot thrift.TProtocol) (err error) {
8019 if err := oprot.WriteFieldBegin("rpc_name", thrift.STRING, 3); err != nil {
8020 return fmt.Errorf("%T write field begin error 3:rpc_name: %s", p, err)
8021 }
8022 if err := oprot.WriteString(string(p.RpcName)); err != nil {
8023 return fmt.Errorf("%T.rpc_name (3) field write error: %s", p, err)
8024 }
8025 if err := oprot.WriteFieldEnd(); err != nil {
8026 return fmt.Errorf("%T write field end error 3:rpc_name: %s", p, err)
8027 }
8028 return err
8029 }
8030
8031 func (p *GetServiceNamesToTraceIdsArgs) String() string {
8032 if p == nil {
8033 return "<nil>"
8034 }
8035 return fmt.Sprintf("GetServiceNamesToTraceIdsArgs(%+v)", *p)
8036 }
8037
8038 type GetServiceNamesToTraceIdsResult struct {
8039 Success map[string][]int64 `thrift:"success,0" json:"success"`
8040 }
8041
8042 func NewGetServiceNamesToTraceIdsResult() *GetServiceNamesToTraceIdsResult {
8043 return &GetServiceNamesToTraceIdsResult{}
8044 }
8045
8046 var GetServiceNamesToTraceIdsResult_Success_DEFAULT map[string][]int64
8047
8048 func (p *GetServiceNamesToTraceIdsResult) GetSuccess() map[string][]int64 {
8049 return p.Success
8050 }
8051 func (p *GetServiceNamesToTraceIdsResult) IsSetSuccess() bool {
8052 return p.Success != nil
8053 }
8054
8055 func (p *GetServiceNamesToTraceIdsResult) Read(iprot thrift.TProtocol) error {
8056 if _, err := iprot.ReadStructBegin(); err != nil {
8057 return fmt.Errorf("%T read error: %s", p, err)
8058 }
8059 for {
8060 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
8061 if err != nil {
8062 return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
8063 }
8064 if fieldTypeId == thrift.STOP {
8065 break
8066 }
8067 switch fieldId {
8068 case 0:
8069 if err := p.ReadField0(iprot); err != nil {
8070 return err
8071 }
8072 default:
8073 if err := iprot.Skip(fieldTypeId); err != nil {
8074 return err
8075 }
8076 }
8077 if err := iprot.ReadFieldEnd(); err != nil {
8078 return err
8079 }
8080 }
8081 if err := iprot.ReadStructEnd(); err != nil {
8082 return fmt.Errorf("%T read struct end error: %s", p, err)
8083 }
8084 return nil
8085 }
8086
8087 func (p *GetServiceNamesToTraceIdsResult) ReadField0(iprot thrift.TProtocol) error {
8088 _, _, size, err := iprot.ReadMapBegin()
8089 if err != nil {
8090 return fmt.Errorf("error reading map begin: %s", err)
8091 }
8092 tMap := make(map[string][]int64, size)
8093 p.Success = tMap
8094 for i := 0; i < size; i++ {
8095 var _key74 string
8096 if v, err := iprot.ReadString(); err != nil {
8097 return fmt.Errorf("error reading field 0: %s", err)
8098 } else {
8099 _key74 = v
8100 }
8101 _, size, err := iprot.ReadListBegin()
8102 if err != nil {
8103 return fmt.Errorf("error reading list begin: %s", err)
8104 }
8105 tSlice := make([]int64, 0, size)
8106 _val75 := tSlice
8107 for i := 0; i < size; i++ {
8108 var _elem76 int64
8109 if v, err := iprot.ReadI64(); err != nil {
8110 return fmt.Errorf("error reading field 0: %s", err)
8111 } else {
8112 _elem76 = v
8113 }
8114 _val75 = append(_val75, _elem76)
8115 }
8116 if err := iprot.ReadListEnd(); err != nil {
8117 return fmt.Errorf("error reading list end: %s", err)
8118 }
8119 p.Success[_key74] = _val75
8120 }
8121 if err := iprot.ReadMapEnd(); err != nil {
8122 return fmt.Errorf("error reading map end: %s", err)
8123 }
8124 return nil
8125 }
8126
8127 func (p *GetServiceNamesToTraceIdsResult) Write(oprot thrift.TProtocol) error {
8128 if err := oprot.WriteStructBegin("getServiceNamesToTraceIds_result"); err != nil {
8129 return fmt.Errorf("%T write struct begin error: %s", p, err)
8130 }
8131 if err := p.writeField0(oprot); err != nil {
8132 return err
8133 }
8134 if err := oprot.WriteFieldStop(); err != nil {
8135 return fmt.Errorf("write field stop error: %s", err)
8136 }
8137 if err := oprot.WriteStructEnd(); err != nil {
8138 return fmt.Errorf("write struct stop error: %s", err)
8139 }
8140 return nil
8141 }
8142
8143 func (p *GetServiceNamesToTraceIdsResult) writeField0(oprot thrift.TProtocol) (err error) {
8144 if p.IsSetSuccess() {
8145 if err := oprot.WriteFieldBegin("success", thrift.MAP, 0); err != nil {
8146 return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
8147 }
8148 if err := oprot.WriteMapBegin(thrift.STRING, thrift.LIST, len(p.Success)); err != nil {
8149 return fmt.Errorf("error writing map begin: %s", err)
8150 }
8151 for k, v := range p.Success {
8152 if err := oprot.WriteString(string(k)); err != nil {
8153 return fmt.Errorf("%T. (0) field write error: %s", p, err)
8154 }
8155 if err := oprot.WriteListBegin(thrift.I64, len(v)); err != nil {
8156 return fmt.Errorf("error writing list begin: %s", err)
8157 }
8158 for _, v := range v {
8159 if err := oprot.WriteI64(int64(v)); err != nil {
8160 return fmt.Errorf("%T. (0) field write error: %s", p, err)
8161 }
8162 }
8163 if err := oprot.WriteListEnd(); err != nil {
8164 return fmt.Errorf("error writing list end: %s", err)
8165 }
8166 }
8167 if err := oprot.WriteMapEnd(); err != nil {
8168 return fmt.Errorf("error writing map end: %s", err)
8169 }
8170 if err := oprot.WriteFieldEnd(); err != nil {
8171 return fmt.Errorf("%T write field end error 0:success: %s", p, err)
8172 }
8173 }
8174 return err
8175 }
8176
8177 func (p *GetServiceNamesToTraceIdsResult) String() string {
8178 if p == nil {
8179 return "<nil>"
8180 }
8181 return fmt.Sprintf("GetServiceNamesToTraceIdsResult(%+v)", *p)
8182 }
+0
-32
tracing/zipkin/_thrift/scribe.thrift less more
0 # Copyright 2012 Twitter Inc.
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
5 #
6 # http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13 namespace java com.twitter.zipkin.thriftjava
14 #@namespace scala com.twitter.zipkin.thriftscala
15
16 enum ResultCode
17 {
18 OK,
19 TRY_LATER
20 }
21
22 struct LogEntry
23 {
24 1: string category,
25 2: string message
26 }
27
28 service Scribe
29 {
30 ResultCode Log(1: list<LogEntry> messages);
31 }
+0
-35
tracing/zipkin/_thrift/zipkinCollector.thrift less more
0 # Copyright 2012 Twitter Inc.
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
5 #
6 # http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13 namespace java com.twitter.zipkin.thriftjava
14 #@namespace scala com.twitter.zipkin.thriftscala
15 namespace rb Zipkin
16
17 include "scribe.thrift"
18 include "zipkinDependencies.thrift"
19
20 exception AdjustableRateException {
21 1: string msg
22 }
23
24 exception StoreAggregatesException {
25 1: string msg
26 }
27
28 service ZipkinCollector extends scribe.Scribe {
29
30 /** Aggregates methods */
31 void storeTopAnnotations(1: string service_name, 2: list<string> annotations) throws (1: StoreAggregatesException e);
32 void storeTopKeyValueAnnotations(1: string service_name, 2: list<string> annotations) throws (1: StoreAggregatesException e);
33 void storeDependencies(1: zipkinDependencies.Dependencies dependencies) throws (1: StoreAggregatesException e);
34 }
+0
-59
tracing/zipkin/_thrift/zipkinCore.thrift less more
0 # Copyright 2012 Twitter Inc.
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
5 #
6 # http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13 namespace java com.twitter.zipkin.thriftjava
14 #@namespace scala com.twitter.zipkin.thriftscala
15 namespace rb Zipkin
16
17 #************** Collection related structs **************
18
19 # these are the annotations we always expect to find in a span
20 const string CLIENT_SEND = "cs"
21 const string CLIENT_RECV = "cr"
22 const string SERVER_SEND = "ss"
23 const string SERVER_RECV = "sr"
24
25 # this represents a host and port in a network
26 struct Endpoint {
27 1: i32 ipv4,
28 2: i16 port # beware that this will give us negative ports. some conversion needed
29 3: string service_name # which service did this operation happen on?
30 }
31
32 # some event took place, either one by the framework or by the user
33 struct Annotation {
34 1: i64 timestamp # microseconds from epoch
35 2: string value # what happened at the timestamp?
36 3: optional Endpoint host # host this happened on
37 4: optional i32 duration # how long did the operation take? microseconds
38 }
39
40 enum AnnotationType { BOOL, BYTES, I16, I32, I64, DOUBLE, STRING }
41
42 struct BinaryAnnotation {
43 1: string key,
44 2: binary value,
45 3: AnnotationType annotation_type,
46 4: optional Endpoint host
47 }
48
49 struct Span {
50 1: i64 trace_id # unique trace id, use for all spans in trace
51 3: string name, # span name, rpc method for example
52 4: i64 id, # unique span id, only used for this span
53 5: optional i64 parent_id, # parent span id
54 6: list<Annotation> annotations, # list of all annotations/events that occured
55 8: list<BinaryAnnotation> binary_annotations # any binary annotations
56 9: optional bool debug = 0 # if true, we DEMAND that this span passes all samplers
57 }
58
+0
-43
tracing/zipkin/_thrift/zipkinDependencies.thrift less more
0 # Copyright 2013 Twitter Inc.
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
5 #
6 # http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13 namespace java com.twitter.zipkin.thriftjava
14 #@namespace scala com.twitter.zipkin.thriftscala
15 namespace rb Zipkin
16
17 #********* Zipkin Aggregate Dependency Related Structs ***********
18
19
20 # This is a 1-to-1 translation of algebird Moments structure for holding
21 # count/mean/variance(stdDev)/skewness/etc about a set of values. It's
22 # used below to represent span time duration ranges.
23 struct Moments {
24 1: i64 m0, # count
25 2: double m1, # mean
26 3: double m2, # variance * count
27 4: double m3,
28 5: double m4
29 }
30
31 struct DependencyLink {
32 1: string parent, # parent service name (caller)
33 2: string child, # child service name (callee)
34 3: Moments duration_moments
35 # histogram?
36 }
37
38 struct Dependencies {
39 1: i64 start_time # microseconds from epoch
40 2: i64 end_time # microseconds from epoch
41 3: list<DependencyLink> links # our data
42 }
+0
-252
tracing/zipkin/_thrift/zipkinQuery.thrift less more
0 # Copyright 2012 Twitter Inc.
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
5 #
6 # http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13 namespace java com.twitter.zipkin.thriftjava
14 #@namespace scala com.twitter.zipkin.thriftscala
15 namespace rb Zipkin
16
17 include "zipkinCore.thrift"
18 include "zipkinDependencies.thrift"
19
20 struct Trace {
21 1: list<zipkinCore.Span> spans
22 }
23
24 exception QueryException {
25 1: string msg
26 }
27
28 struct SpanTimestamp {
29 1: string name
30 2: i64 start_timestamp
31 3: i64 end_timestamp
32 }
33
34 /**
35 * This sums up a single Trace to make it easy for a client to get an overview of what happened.
36 */
37 struct TraceSummary {
38 1: i64 trace_id # the trace
39 2: i64 start_timestamp # start timestamp of the trace, in microseconds
40 3: i64 end_timestamp # end timestamp of the trace, in microseconds
41 4: i32 duration_micro # how long did the entire trace take? in microseconds
42 # 5: map<string, i32> service_counts # which services were involved?
43 6: list<zipkinCore.Endpoint> endpoints # which endpoints were involved?
44 7: list<SpanTimestamp> span_timestamps
45 }
46
47 /**
48 * A modified version of the Annotation struct that brings in more information
49 */
50 struct TimelineAnnotation {
51 1: i64 timestamp # microseconds from epoch
52 2: string value # what happened at the timestamp?
53 3: zipkinCore.Endpoint host # host this happened on
54 4: i64 span_id # which span does this annotation belong to?
55 5: optional i64 parent_id # parent span id
56 6: string service_name # which service did this annotation happen on?
57 7: string span_name # span name, rpc method for example
58 }
59
60 /**
61 * This sums up a single Trace to make it easy for a client to get an overview of what happened.
62 */
63 struct TraceTimeline {
64 1: i64 trace_id # the trace
65 2: i64 root_most_span_id # either the true root span or the closest we can find
66 6: list<TimelineAnnotation> annotations # annotations as they happened
67 7: list<zipkinCore.BinaryAnnotation> binary_annotations # all the binary annotations
68 }
69
70 /**
71 * Returns a combination of trace, summary and timeline.
72 */
73 struct TraceCombo {
74 1: Trace trace
75 2: optional TraceSummary summary # not set if no spans in trace
76 3: optional TraceTimeline timeline # not set if no spans in trace
77 4: optional map<i64, i32> span_depths # not set if no spans in trace
78 }
79
80 enum Order { TIMESTAMP_DESC, TIMESTAMP_ASC, DURATION_ASC, DURATION_DESC, NONE }
81
82 /**
83 * The raw data in our storage might have various problems. How should we adjust it before
84 * returning it to the user?
85 *
86 * Time skew adjuster tries to make sure that even though servers might have slightly
87 * different clocks the annotations in the returned data are adjusted so that they are
88 * in the correct order.
89 */
90 enum Adjust { NOTHING, TIME_SKEW }
91
92 struct QueryRequest {
93 1: string service_name
94 2: optional string span_name
95 3: optional list<string> annotations
96 4: optional list<zipkinCore.BinaryAnnotation> binary_annotations
97 5: i64 end_ts
98 6: i32 limit
99 7: Order order
100 }
101
102 struct QueryResponse {
103 1: list<i64> trace_ids
104 2: i64 start_ts
105 3: i64 end_ts
106 }
107
108 service ZipkinQuery {
109
110 #************** Index lookups **************
111
112 QueryResponse getTraceIds(1: QueryRequest request) throws (1: QueryException qe);
113
114 /**
115 * Fetch trace ids by service and span name.
116 * Gets "limit" number of entries from before the "end_ts".
117 *
118 * Span name is optional.
119 * Timestamps are in microseconds.
120 */
121 list<i64> getTraceIdsBySpanName(1: string service_name, 2: string span_name,
122 4: i64 end_ts, 5: i32 limit, 6: Order order) throws (1: QueryException qe);
123
124 /**
125 * Fetch trace ids by service name.
126 * Gets "limit" number of entries from before the "end_ts".
127 *
128 * Timestamps are in microseconds.
129 */
130 list<i64> getTraceIdsByServiceName(1: string service_name,
131 3: i64 end_ts, 4: i32 limit, 5: Order order) throws (1: QueryException qe);
132
133 /**
134 * Fetch trace ids with a particular annotation.
135 * Gets "limit" number of entries from before the "end_ts".
136 *
137 * When requesting based on time based annotations only pass in the first parameter, "annotation" and leave out
138 * the second "value". If looking for a key-value binary annotation provide both, "annotation" is then the
139 * key in the key-value.
140 *
141 * Timestamps are in microseconds.
142 */
143 list<i64> getTraceIdsByAnnotation(1: string service_name, 2: string annotation, 3: binary value,
144 5: i64 end_ts, 6: i32 limit, 7: Order order) throws (1: QueryException qe);
145
146
147 #************** Fetch traces from id **************
148
149 /**
150 * Get the traces that are in the database from the given list of trace ids.
151 */
152
153 set<i64> tracesExist(1: list<i64> trace_ids) throws (1: QueryException qe);
154
155 /**
156 * Get the full traces associated with the given trace ids.
157 *
158 * Second argument is a list of methods of adjusting the trace
159 * data before returning it. Can be empty.
160 */
161 list<Trace> getTracesByIds(1: list<i64> trace_ids, 2: list<Adjust> adjust) throws (1: QueryException qe);
162
163 /**
164 * Get the trace timelines associated with the given trace ids.
165 * This is a convenience method for users that just want to know
166 * the annotations and the (assumed) order they happened in.
167 *
168 * Second argument is a list of methods of adjusting the trace
169 * data before returning it. Can be empty.
170 *
171 * Note that if one of the trace ids does not have any data associated with it, it will not be
172 * represented in the output list.
173 */
174 list<TraceTimeline> getTraceTimelinesByIds(1: list<i64> trace_ids, 2: list<Adjust> adjust) throws (1: QueryException qe);
175
176 /**
177 * Fetch trace summaries for the given trace ids.
178 *
179 * Second argument is a list of methods of adjusting the trace
180 * data before returning it. Can be empty.
181 *
182 * Note that if one of the trace ids does not have any data associated with it, it will not be
183 * represented in the output list.
184 */
185 list<TraceSummary> getTraceSummariesByIds(1: list<i64> trace_ids, 2: list<Adjust> adjust) throws (1: QueryException qe);
186
187 /**
188 * Not content with just one of traces, summaries or timelines? Want it all? This is the method for you.
189 */
190 list<TraceCombo> getTraceCombosByIds(1: list<i64> trace_ids, 2: list<Adjust> adjust) throws (1: QueryException qe);
191
192 #************** Misc metadata **************
193
194 /**
195 * Fetch all the service names we have seen from now all the way back to the set ttl.
196 */
197 set<string> getServiceNames() throws (1: QueryException qe);
198
199 /**
200 * Get all the seen span names for a particular service, from now back until the set ttl.
201 */
202 set<string> getSpanNames(1: string service_name) throws (1: QueryException qe);
203
204 #************** TTL related **************
205
206 /**
207 * Change the TTL of a trace. If we find an interesting trace we want to keep around for further
208 * investigation.
209 */
210 void setTraceTimeToLive(1: i64 trace_id, 2: i32 ttl_seconds) throws (1: QueryException qe);
211
212 /**
213 * Get the TTL in seconds of a specific trace.
214 */
215 i32 getTraceTimeToLive(1: i64 trace_id) throws (1: QueryException qe);
216
217 /**
218 * Get the data ttl. This is the number of seconds we keep the data around before deleting it.
219 */
220 i32 getDataTimeToLive() throws (1: QueryException qe);
221
222 /**
223 * Get an aggregate representation of all services paired with every service they call in to.
224 * This includes information on call counts and mean/stdDev/etc of call durations. The two arguments
225 * specify epoch time in microseconds. The end time is optional and defaults to one day after the
226 * start time.
227 */
228 zipkinDependencies.Dependencies getDependencies(1: optional i64 start_time, 2: optional i64 end_time) throws (1: QueryException qe);
229
230 list<string> getTopAnnotations(1: string service_name) throws (1: QueryException qe);
231 list<string> getTopKeyValueAnnotations(1: string service_name) throws (1: QueryException qe);
232
233 /**
234 * Given a time stamp, server service name, and rpc name, fetch all of the client services calling in paired
235 * with the lists of every span duration (list<i64>) from the server to client. The lists of span durations
236 * include information on call counts and mean/stdDev/etc of call durations.
237 *
238 * The three arguments specify epoch time in microseconds, server side service name and rpc name. The return maps
239 * contains the key - client_service_name and value - list<span_durations>.
240 */
241 map<string, list<i64>> getSpanDurations(1: i64 time_stamp, 2: string service_name, 3: string rpc_name);
242
243 /**
244 * Given a time stamp, server service name, and rpc name, fetch all of the client services calling in paired
245 * with the lists of every trace Ids (list<i64>) from the server to client.
246 *
247 * The three arguments specify epoch time in microseconds, server side service name and rpc name. The return maps
248 * contains the key - client_service_name and value - list<trace_id>.
249 */
250 map<string, list<i64>> getServiceNamesToTraceIds(1: i64 time_stamp, 2: string service_name, 3: string rpc_name);
251 }
+0
-80
tracing/zipkin/collector.go less more
0 package zipkin
1
2 import "strings"
3
4 // Collector represents a Zipkin trace collector, which is probably a set of
5 // remote endpoints.
6 type Collector interface {
7 Collect(*Span) error
8 ShouldSample(*Span) bool
9 Close() error
10 }
11
12 // NopCollector implements Collector but performs no work.
13 type NopCollector struct{}
14
15 // Collect implements Collector.
16 func (NopCollector) Collect(*Span) error { return nil }
17
18 // ShouldSample implements Collector.
19 func (n NopCollector) ShouldSample(span *Span) bool { return false }
20
21 // Close implements Collector.
22 func (NopCollector) Close() error { return nil }
23
24 // MultiCollector implements Collector by sending spans to all collectors.
25 type MultiCollector []Collector
26
27 // Collect implements Collector.
28 func (c MultiCollector) Collect(s *Span) error {
29 return c.aggregateErrors(func(coll Collector) error { return coll.Collect(s) })
30 }
31
32 // ShouldSample implements Collector.
33 func (c MultiCollector) ShouldSample(s *Span) bool { return false }
34
35 // Close implements Collector.
36 func (c MultiCollector) Close() error {
37 return c.aggregateErrors(func(coll Collector) error { return coll.Close() })
38 }
39
40 func (c MultiCollector) aggregateErrors(f func(c Collector) error) error {
41 var e *collectionError
42 for i, collector := range c {
43 if err := f(collector); err != nil {
44 if e == nil {
45 e = &collectionError{
46 errs: make([]error, len(c)),
47 }
48 }
49 e.errs[i] = err
50 }
51 }
52 return e
53 }
54
55 // CollectionError represents an array of errors returned by one or more
56 // failed Collector methods.
57 type CollectionError interface {
58 Error() string
59 GetErrors() []error
60 }
61
62 type collectionError struct {
63 errs []error
64 }
65
66 func (c *collectionError) Error() string {
67 errs := []string{}
68 for _, err := range c.errs {
69 if err != nil {
70 errs = append(errs, err.Error())
71 }
72 }
73 return strings.Join(errs, "; ")
74 }
75
76 // GetErrors implements CollectionError
77 func (c *collectionError) GetErrors() []error {
78 return c.errs
79 }
+0
-99
tracing/zipkin/collector_test.go less more
0 package zipkin_test
1
2 import (
3 "fmt"
4 "testing"
5
6 "github.com/go-kit/kit/tracing/zipkin"
7 )
8
9 var s = zipkin.NewSpan("203.0.113.10:1234", "service1", "avg", 123, 456, 0)
10
11 func TestNopCollector(t *testing.T) {
12 c := zipkin.NopCollector{}
13 if err := c.Collect(s); err != nil {
14 t.Error(err)
15 }
16 if err := c.Close(); err != nil {
17 t.Error(err)
18 }
19 }
20
21 type stubCollector struct {
22 errid int
23 collected bool
24 closed bool
25 }
26
27 func (c *stubCollector) Collect(*zipkin.Span) error {
28 c.collected = true
29 if c.errid != 0 {
30 return fmt.Errorf("error %d", c.errid)
31 }
32 return nil
33 }
34
35 func (c *stubCollector) ShouldSample(*zipkin.Span) bool { return true }
36
37 func (c *stubCollector) Close() error {
38 c.closed = true
39 if c.errid != 0 {
40 return fmt.Errorf("error %d", c.errid)
41 }
42 return nil
43 }
44
45 func TestMultiCollector(t *testing.T) {
46 cs := zipkin.MultiCollector{
47 &stubCollector{errid: 1},
48 &stubCollector{},
49 &stubCollector{errid: 2},
50 }
51 err := cs.Collect(s)
52 if err == nil {
53 t.Fatal("wanted error, got none")
54 }
55 if want, have := "error 1; error 2", err.Error(); want != have {
56 t.Errorf("want %q, have %q", want, have)
57 }
58 collectionError := err.(zipkin.CollectionError).GetErrors()
59 if want, have := 3, len(collectionError); want != have {
60 t.Fatalf("want %d, have %d", want, have)
61 }
62 if want, have := cs[0].Collect(s).Error(), collectionError[0].Error(); want != have {
63 t.Errorf("want %q, have %q", want, have)
64 }
65 if want, have := cs[1].Collect(s), collectionError[1]; want != have {
66 t.Errorf("want %q, have %q", want, have)
67 }
68 if want, have := cs[2].Collect(s).Error(), collectionError[2].Error(); want != have {
69 t.Errorf("want %q, have %q", want, have)
70 }
71
72 for _, c := range cs {
73 if !c.(*stubCollector).collected {
74 t.Error("collect not called")
75 }
76 }
77 }
78
79 func TestMultiCollectorClose(t *testing.T) {
80 cs := zipkin.MultiCollector{
81 &stubCollector{errid: 1},
82 &stubCollector{},
83 &stubCollector{errid: 2},
84 }
85 err := cs.Close()
86 if err == nil {
87 t.Fatal("wanted error, got none")
88 }
89 if want, have := "error 1; error 2", err.Error(); want != have {
90 t.Errorf("want %q, have %q", want, have)
91 }
92
93 for _, c := range cs {
94 if !c.(*stubCollector).closed {
95 t.Error("close not called")
96 }
97 }
98 }
0 # This file uses the version 2 docker-compose file format, described here:
1 # https://docs.docker.com/compose/compose-file/#version-2
2 #
3 # It runs the zipkin-cassandra, zipkin-collector, zipkin-query, zipkin-web, and
4 # zookeeper-exhibitor containers.
5 #
6 # On linux you probably want to start this composition like this:
7 #
8 # HOSTNAME=localhost docker-compose -f docker-compose-zipkin.yml up
9 #
10 # On OS X you will probably start like this:
11 #
12 # HOSTNAME=default docker-compose -f docker-compose-zipkin.yml up
13
14 version: '2'
15 services:
16 cassandra:
17 image: openzipkin/zipkin-cassandra:1.39.4
18 network_mode: host
19
20 zookeeper:
21 image: mbabineau/zookeeper-exhibitor:latest
22 network_mode: host
23 environment:
24 HOSTNAME: ${HOSTNAME}
25
26 kafka:
27 image: wurstmeister/kafka
28 network_mode: host
29 environment:
30 KAFKA_CREATE_TOPICS: "zipkin:1:1"
31 KAFKA_ZOOKEEPER_CONNECTION_TIMEOUT_MS: 60000
32 KAFKA_ADVERTISED_PORT: 9092
33 KAFKA_ADVERTISED_HOST_NAME: ${HOSTNAME}
34 KAFKA_ZOOKEEPER_CONNECT: ${HOSTNAME}:2181
35 depends_on:
36 - zookeeper
37
38 collector:
39 image: openzipkin/zipkin-collector:1.39.4
40 network_mode: host
41 environment:
42 STORAGE_TYPE: cassandra
43 TRANSPORT_TYPE: kafka
44 CASSANDRA_CONTACT_POINTS: ${HOSTNAME}
45 KAFKA_ZOOKEEPER: ${HOSTNAME}:2181
46 METADATA_BROKER_LIST: ${HOSTNAME}:9092
47 depends_on:
48 - cassandra
49 - kafka
50
51 query:
52 image: openzipkin/zipkin-query:1.39.4
53 network_mode: host
54 environment:
55 STORAGE_TYPE: cassandra
56 TRANSPORT_TYPE: kafka
57 CASSANDRA_CONTACT_POINTS: ${HOSTNAME}
58 KAFKA_ZOOKEEPER: ${HOSTNAME}:2181
59 METADATA_BROKER_LIST: ${HOSTNAME}:9092
60 depends_on:
61 - cassandra
62 - kafka
63
64 web:
65 image: openzipkin/zipkin-web:1.39.4
66 network_mode: host
67 environment:
68 TRANSPORT_TYPE: kafka
69 KAFKA_ZOOKEEPER: ${HOSTNAME}:2181
70 METADATA_BROKER_LIST: ${HOSTNAME}:9092
71 QUERY_PORT_9411_TCP_ADDR: ${HOSTNAME}
72 ROOTURL: http://${HOSTNAME}:8080
73 depends_on:
74 - cassandra
75 - kafka
+0
-118
tracing/zipkin/kafka.go less more
0 package zipkin
1
2 import (
3 "math/rand"
4
5 "github.com/apache/thrift/lib/go/thrift"
6 "gopkg.in/Shopify/sarama.v1"
7
8 "github.com/go-kit/kit/log"
9 )
10
11 // defaultKafkaTopic sets the standard Kafka topic our Collector will publish
12 // on. The default topic for zipkin-receiver-kafka is "zipkin", see:
13 // https://github.com/openzipkin/zipkin/tree/master/zipkin-receiver-kafka
14 const defaultKafkaTopic = "zipkin"
15
16 // KafkaCollector implements Collector by publishing spans to a Kafka
17 // broker.
18 type KafkaCollector struct {
19 producer sarama.AsyncProducer
20 logger log.Logger
21 topic string
22 shouldSample Sampler
23 }
24
25 // KafkaOption sets a parameter for the KafkaCollector
26 type KafkaOption func(c *KafkaCollector)
27
28 // KafkaLogger sets the logger used to report errors in the collection
29 // process. By default, a no-op logger is used, i.e. no errors are logged
30 // anywhere. It's important to set this option.
31 func KafkaLogger(logger log.Logger) KafkaOption {
32 return func(c *KafkaCollector) { c.logger = logger }
33 }
34
35 // KafkaProducer sets the producer used to produce to Kafka.
36 func KafkaProducer(p sarama.AsyncProducer) KafkaOption {
37 return func(c *KafkaCollector) { c.producer = p }
38 }
39
40 // KafkaTopic sets the kafka topic to attach the collector producer on.
41 func KafkaTopic(t string) KafkaOption {
42 return func(c *KafkaCollector) { c.topic = t }
43 }
44
45 // KafkaSampleRate sets the sample rate used to determine if a trace will be
46 // sent to the collector. By default, the sample rate is 1.0, i.e. all traces
47 // are sent.
48 func KafkaSampleRate(sr Sampler) KafkaOption {
49 return func(c *KafkaCollector) { c.shouldSample = sr }
50 }
51
52 // NewKafkaCollector returns a new Kafka-backed Collector. addrs should be a
53 // slice of TCP endpoints of the form "host:port".
54 func NewKafkaCollector(addrs []string, options ...KafkaOption) (Collector, error) {
55 c := &KafkaCollector{
56 logger: log.NewNopLogger(),
57 topic: defaultKafkaTopic,
58 shouldSample: SampleRate(1.0, rand.Int63()),
59 }
60
61 for _, option := range options {
62 option(c)
63 }
64
65 if c.producer == nil {
66 p, err := sarama.NewAsyncProducer(addrs, nil)
67 if err != nil {
68 return nil, err
69 }
70 c.producer = p
71 }
72
73 go c.logErrors()
74
75 return c, nil
76 }
77
78 func (c *KafkaCollector) logErrors() {
79 for pe := range c.producer.Errors() {
80 c.logger.Log("msg", pe.Msg, "err", pe.Err, "result", "failed to produce msg")
81 }
82 }
83
84 // Collect implements Collector.
85 func (c *KafkaCollector) Collect(s *Span) error {
86 if c.ShouldSample(s) || s.debug {
87 c.producer.Input() <- &sarama.ProducerMessage{
88 Topic: c.topic,
89 Key: nil,
90 Value: sarama.ByteEncoder(kafkaSerialize(s)),
91 }
92 }
93 return nil
94 }
95
96 // ShouldSample implements Collector.
97 func (c *KafkaCollector) ShouldSample(s *Span) bool {
98 if !s.sampled && s.runSampler {
99 s.runSampler = false
100 s.sampled = c.shouldSample(s.TraceID())
101 }
102 return s.sampled
103 }
104
105 // Close implements Collector.
106 func (c *KafkaCollector) Close() error {
107 return c.producer.Close()
108 }
109
110 func kafkaSerialize(s *Span) []byte {
111 t := thrift.NewTMemoryBuffer()
112 p := thrift.NewTBinaryProtocolTransport(t)
113 if err := s.Encode().Write(p); err != nil {
114 panic(err)
115 }
116 return t.Buffer.Bytes()
117 }
+0
-192
tracing/zipkin/kafka_test.go less more
0 package zipkin_test
1
2 import (
3 "errors"
4 "testing"
5 "time"
6
7 "github.com/apache/thrift/lib/go/thrift"
8 "gopkg.in/Shopify/sarama.v1"
9
10 "github.com/go-kit/kit/log"
11 "github.com/go-kit/kit/tracing/zipkin"
12 "github.com/go-kit/kit/tracing/zipkin/_thrift/gen-go/zipkincore"
13 )
14
15 type stubProducer struct {
16 in chan *sarama.ProducerMessage
17 err chan *sarama.ProducerError
18 kdown bool
19 closed bool
20 }
21
22 func (p *stubProducer) AsyncClose() {}
23 func (p *stubProducer) Close() error {
24 if p.kdown {
25 return errors.New("Kafka is down")
26 }
27 p.closed = true
28 return nil
29 }
30 func (p *stubProducer) Input() chan<- *sarama.ProducerMessage { return p.in }
31 func (p *stubProducer) Successes() <-chan *sarama.ProducerMessage { return nil }
32 func (p *stubProducer) Errors() <-chan *sarama.ProducerError { return p.err }
33
34 func newStubProducer(kdown bool) *stubProducer {
35 return &stubProducer{
36 make(chan *sarama.ProducerMessage),
37 make(chan *sarama.ProducerError),
38 kdown,
39 false,
40 }
41 }
42
43 var spans = []*zipkin.Span{
44 zipkin.NewSpan("203.0.113.10:1234", "service1", "avg", 123, 456, 0),
45 zipkin.NewSpan("203.0.113.10:1234", "service2", "sum", 123, 789, 456),
46 zipkin.NewSpan("203.0.113.10:1234", "service2", "div", 123, 101112, 456),
47 }
48
49 func TestKafkaProduce(t *testing.T) {
50 p := newStubProducer(false)
51 c, err := zipkin.NewKafkaCollector(
52 []string{"192.0.2.10:9092"}, zipkin.KafkaProducer(p),
53 )
54 if err != nil {
55 t.Fatal(err)
56 }
57
58 for _, want := range spans {
59 m := collectSpan(t, c, p, want)
60 testMetadata(t, m)
61 got := deserializeSpan(t, m.Value)
62 testEqual(t, want, got)
63 }
64 }
65
66 func TestKafkaClose(t *testing.T) {
67 p := newStubProducer(false)
68 c, err := zipkin.NewKafkaCollector(
69 []string{"192.0.2.10:9092"}, zipkin.KafkaProducer(p),
70 )
71 if err != nil {
72 t.Fatal(err)
73 }
74 if err = c.Close(); err != nil {
75 t.Fatal(err)
76 }
77 if !p.closed {
78 t.Fatal("producer not closed")
79 }
80 }
81
82 func TestKafkaCloseError(t *testing.T) {
83 p := newStubProducer(true)
84 c, err := zipkin.NewKafkaCollector(
85 []string{"192.0.2.10:9092"}, zipkin.KafkaProducer(p),
86 )
87 if err != nil {
88 t.Fatal(err)
89 }
90 if err = c.Close(); err == nil {
91 t.Error("no error on close")
92 }
93 }
94
95 func TestKafkaErrors(t *testing.T) {
96 p := newStubProducer(true)
97 errs := make(chan []interface{}, len(spans))
98 lg := log.Logger(log.LoggerFunc(func(keyvals ...interface{}) error {
99 for i := 0; i < len(keyvals); i += 2 {
100 if keyvals[i] == "result" && keyvals[i+1] == "failed to produce msg" {
101 errs <- keyvals
102 }
103 }
104 return nil
105 }))
106 c, err := zipkin.NewKafkaCollector(
107 []string{"192.0.2.10:9092"},
108 zipkin.KafkaProducer(p),
109 zipkin.KafkaLogger(lg),
110 )
111 if err != nil {
112 t.Fatal(err)
113 }
114 for _, want := range spans {
115 _ = collectSpan(t, c, p, want)
116 }
117
118 for i := 0; i < len(spans); i++ {
119 select {
120 case <-errs:
121 case <-time.After(100 * time.Millisecond):
122 t.Fatalf("errors not logged. got %d, wanted %d", i, len(spans))
123 }
124 }
125 }
126
127 func collectSpan(t *testing.T, c zipkin.Collector, p *stubProducer, s *zipkin.Span) *sarama.ProducerMessage {
128 var m *sarama.ProducerMessage
129 rcvd := make(chan bool, 1)
130 go func() {
131 select {
132 case m = <-p.in:
133 rcvd <- true
134 if p.kdown {
135 p.err <- &sarama.ProducerError{m, errors.New("kafka is down")}
136 }
137 case <-time.After(100 * time.Millisecond):
138 rcvd <- false
139 }
140 }()
141
142 if err := c.Collect(s); err != nil {
143 t.Errorf("error during collection: %v", err)
144 }
145 if !<-rcvd {
146 t.Fatal("span message was not produced")
147 }
148 return m
149 }
150
151 func testMetadata(t *testing.T, m *sarama.ProducerMessage) {
152 if m.Topic != "zipkin" {
153 t.Errorf("produced to topic %q, want %q", m.Topic, "zipkin")
154 }
155 if m.Key != nil {
156 t.Errorf("produced with key %q, want nil", m.Key)
157 }
158 }
159
160 func deserializeSpan(t *testing.T, e sarama.Encoder) *zipkincore.Span {
161 bytes, err := e.Encode()
162 if err != nil {
163 t.Errorf("error in encoding: %v", err)
164 }
165 s := zipkincore.NewSpan()
166 mb := thrift.NewTMemoryBufferLen(len(bytes))
167 mb.Write(bytes)
168 mb.Flush()
169 pt := thrift.NewTBinaryProtocolTransport(mb)
170 err = s.Read(pt)
171 if err != nil {
172 t.Errorf("error in decoding: %v", err)
173 }
174 return s
175 }
176
177 func testEqual(t *testing.T, want *zipkin.Span, got *zipkincore.Span) {
178 if got.TraceId != want.TraceID() {
179 t.Errorf("trace_id %d, want %d", got.TraceId, want.TraceID())
180 }
181 if got.Id != want.SpanID() {
182 t.Errorf("id %d, want %d", got.Id, want.SpanID())
183 }
184 if got.ParentId == nil {
185 if want.ParentSpanID() != 0 {
186 t.Errorf("parent_id %d, want %d", got.ParentId, want.ParentSpanID())
187 }
188 } else if *got.ParentId != want.ParentSpanID() {
189 t.Errorf("parent_id %d, want %d", got.ParentId, want.ParentSpanID())
190 }
191 }
+0
-26
tracing/zipkin/sample.go less more
0 package zipkin
1
2 import "math"
3
4 // Sampler functions return if a Zipkin span should be sampled, based on its
5 // traceID.
6 type Sampler func(id int64) bool
7
8 // SampleRate returns a sampler function using a particular sample rate and a
9 // sample salt to identify if a Zipkin span based on its spanID should be
10 // collected.
11 func SampleRate(rate float64, salt int64) Sampler {
12 if rate <= 0 {
13 return func(_ int64) bool {
14 return false
15 }
16 }
17 if rate >= 1.0 {
18 return func(_ int64) bool {
19 return true
20 }
21 }
22 return func(id int64) bool {
23 return int64(math.Abs(float64(id^salt)))%10000 < int64(rate*10000)
24 }
25 }
+0
-36
tracing/zipkin/sample_test.go less more
0 package zipkin_test
1
2 import (
3 "testing"
4
5 "github.com/go-kit/kit/tracing/zipkin"
6 )
7
8 func TestSampleRate(t *testing.T) {
9 type triple struct {
10 id, salt int64
11 rate float64
12 }
13 for input, want := range map[triple]bool{
14 triple{123, 456, 1.0}: true,
15 triple{123, 456, 999}: true,
16 triple{123, 456, 0.0}: false,
17 triple{123, 456, -42}: false,
18 triple{1229998, 0, 0.01}: false,
19 triple{1229999, 0, 0.01}: false,
20 triple{1230000, 0, 0.01}: true,
21 triple{1230001, 0, 0.01}: true,
22 triple{1230098, 0, 0.01}: true,
23 triple{1230099, 0, 0.01}: true,
24 triple{1230100, 0, 0.01}: false,
25 triple{1230101, 0, 0.01}: false,
26 triple{1, 9999999, 0.01}: false,
27 triple{999, 0, 0.99}: true,
28 triple{9999, 0, 0.99}: false,
29 } {
30 sampler := zipkin.SampleRate(input.rate, input.salt)
31 if have := sampler(input.id); want != have {
32 t.Errorf("%#+v: want %v, have %v", input, want, have)
33 }
34 }
35 }
+0
-205
tracing/zipkin/scribe.go less more
0 package zipkin
1
2 import (
3 "encoding/base64"
4 "fmt"
5 "math/rand"
6 "net"
7 "time"
8
9 "github.com/apache/thrift/lib/go/thrift"
10
11 "github.com/go-kit/kit/log"
12 "github.com/go-kit/kit/tracing/zipkin/_thrift/gen-go/scribe"
13 )
14
15 const defaultScribeCategory = "zipkin"
16
17 // defaultBatchInterval in seconds
18 const defaultBatchInterval = 1
19
20 // ScribeCollector implements Collector by forwarding spans to a Scribe
21 // service, in batches.
22 type ScribeCollector struct {
23 client scribe.Scribe
24 factory func() (scribe.Scribe, error)
25 spanc chan *Span
26 sendc chan struct{}
27 batch []*scribe.LogEntry
28 nextSend time.Time
29 batchInterval time.Duration
30 batchSize int
31 shouldSample Sampler
32 logger log.Logger
33 category string
34 quit chan struct{}
35 }
36
37 // NewScribeCollector returns a new Scribe-backed Collector. addr should be a
38 // TCP endpoint of the form "host:port". timeout is passed to the Thrift dial
39 // function NewTSocketFromAddrTimeout. batchSize and batchInterval control the
40 // maximum size and interval of a batch of spans; as soon as either limit is
41 // reached, the batch is sent. The logger is used to log errors, such as batch
42 // send failures; users should provide an appropriate context, if desired.
43 func NewScribeCollector(addr string, timeout time.Duration, options ...ScribeOption) (Collector, error) {
44 factory := scribeClientFactory(addr, timeout)
45 client, err := factory()
46 if err != nil {
47 return nil, err
48 }
49 c := &ScribeCollector{
50 client: client,
51 factory: factory,
52 spanc: make(chan *Span),
53 sendc: make(chan struct{}),
54 batch: []*scribe.LogEntry{},
55 batchInterval: defaultBatchInterval * time.Second,
56 batchSize: 100,
57 shouldSample: SampleRate(1.0, rand.Int63()),
58 logger: log.NewNopLogger(),
59 category: defaultScribeCategory,
60 quit: make(chan struct{}),
61 }
62 for _, option := range options {
63 option(c)
64 }
65 c.nextSend = time.Now().Add(c.batchInterval)
66 go c.loop()
67 return c, nil
68 }
69
70 // Collect implements Collector.
71 func (c *ScribeCollector) Collect(s *Span) error {
72 if c.ShouldSample(s) || s.debug {
73 c.spanc <- s
74 }
75 return nil // accepted
76 }
77
78 // ShouldSample implements Collector.
79 func (c *ScribeCollector) ShouldSample(s *Span) bool {
80 if !s.sampled && s.runSampler {
81 s.runSampler = false
82 s.sampled = c.shouldSample(s.TraceID())
83 }
84 return s.sampled
85 }
86
87 // Close implements Collector.
88 func (c *ScribeCollector) Close() error {
89 close(c.quit)
90 return nil
91 }
92
93 func (c *ScribeCollector) loop() {
94 tickc := time.Tick(c.batchInterval / 10)
95
96 for {
97 select {
98 case span := <-c.spanc:
99 c.batch = append(c.batch, &scribe.LogEntry{
100 Category: c.category,
101 Message: scribeSerialize(span),
102 })
103 if len(c.batch) >= c.batchSize {
104 go c.sendNow()
105 }
106
107 case <-tickc:
108 if time.Now().After(c.nextSend) {
109 go c.sendNow()
110 }
111
112 case <-c.sendc:
113 c.nextSend = time.Now().Add(c.batchInterval)
114 if err := c.send(c.batch); err != nil {
115 c.logger.Log("err", err.Error())
116 }
117 c.batch = c.batch[:0]
118 case <-c.quit:
119 return
120 }
121 }
122 }
123
124 func (c *ScribeCollector) sendNow() {
125 c.sendc <- struct{}{}
126 }
127
128 func (c *ScribeCollector) send(batch []*scribe.LogEntry) error {
129 if c.client == nil {
130 var err error
131 if c.client, err = c.factory(); err != nil {
132 return fmt.Errorf("during reconnect: %v", err)
133 }
134 }
135 if rc, err := c.client.Log(c.batch); err != nil {
136 c.client = nil
137 return fmt.Errorf("during Log: %v", err)
138 } else if rc != scribe.ResultCode_OK {
139 // probably transient error; don't reset client
140 return fmt.Errorf("remote returned %s", rc)
141 }
142 return nil
143 }
144
145 // ScribeOption sets a parameter for the StdlibAdapter.
146 type ScribeOption func(s *ScribeCollector)
147
148 // ScribeBatchSize sets the maximum batch size, after which a collect will be
149 // triggered. The default batch size is 100 traces.
150 func ScribeBatchSize(n int) ScribeOption {
151 return func(s *ScribeCollector) { s.batchSize = n }
152 }
153
154 // ScribeBatchInterval sets the maximum duration we will buffer traces before
155 // emitting them to the collector. The default batch interval is 1 second.
156 func ScribeBatchInterval(d time.Duration) ScribeOption {
157 return func(s *ScribeCollector) { s.batchInterval = d }
158 }
159
160 // ScribeSampleRate sets the sample rate used to determine if a trace will be
161 // sent to the collector. By default, the sample rate is 1.0, i.e. all traces
162 // are sent.
163 func ScribeSampleRate(sr Sampler) ScribeOption {
164 return func(s *ScribeCollector) { s.shouldSample = sr }
165 }
166
167 // ScribeLogger sets the logger used to report errors in the collection
168 // process. By default, a no-op logger is used, i.e. no errors are logged
169 // anywhere. It's important to set this option in a production service.
170 func ScribeLogger(logger log.Logger) ScribeOption {
171 return func(s *ScribeCollector) { s.logger = logger }
172 }
173
174 // ScribeCategory sets the Scribe category used to transmit the spans.
175 func ScribeCategory(category string) ScribeOption {
176 return func(s *ScribeCollector) { s.category = category }
177 }
178
179 func scribeClientFactory(addr string, timeout time.Duration) func() (scribe.Scribe, error) {
180 return func() (scribe.Scribe, error) {
181 a, err := net.ResolveTCPAddr("tcp", addr)
182 if err != nil {
183 return nil, err
184 }
185 socket := thrift.NewTSocketFromAddrTimeout(a, timeout)
186 transport := thrift.NewTFramedTransport(socket)
187 if err := transport.Open(); err != nil {
188 socket.Close()
189 return nil, err
190 }
191 proto := thrift.NewTBinaryProtocolTransport(transport)
192 client := scribe.NewScribeClientProtocol(transport, proto, proto)
193 return client, nil
194 }
195 }
196
197 func scribeSerialize(s *Span) string {
198 t := thrift.NewTMemoryBuffer()
199 p := thrift.NewTBinaryProtocolTransport(t)
200 if err := s.Encode().Write(p); err != nil {
201 panic(err)
202 }
203 return base64.StdEncoding.EncodeToString(t.Buffer.Bytes())
204 }
+0
-197
tracing/zipkin/scribe_test.go less more
0 package zipkin_test
1
2 import (
3 "encoding/base64"
4 "fmt"
5 "math/rand"
6 "net"
7 "sync"
8 "testing"
9 "time"
10
11 "github.com/apache/thrift/lib/go/thrift"
12
13 "github.com/go-kit/kit/tracing/zipkin"
14 "github.com/go-kit/kit/tracing/zipkin/_thrift/gen-go/scribe"
15 "github.com/go-kit/kit/tracing/zipkin/_thrift/gen-go/zipkincore"
16 )
17
18 func TestScribeCollector(t *testing.T) {
19 server := newScribeServer(t)
20
21 timeout := time.Second
22 batchInterval := time.Millisecond
23 c, err := zipkin.NewScribeCollector(server.addr(), timeout, zipkin.ScribeBatchSize(0), zipkin.ScribeBatchInterval(batchInterval))
24 if err != nil {
25 t.Fatal(err)
26 }
27
28 var (
29 serviceName = "service"
30 methodName = "method"
31 traceID = int64(123)
32 spanID = int64(456)
33 parentSpanID = int64(0)
34 value = "foo"
35 )
36
37 span := zipkin.NewSpan("1.2.3.4:1234", serviceName, methodName, traceID, spanID, parentSpanID)
38 span.Annotate("foo")
39 if err := c.Collect(span); err != nil {
40 t.Errorf("error during collection: %v", err)
41 }
42
43 // Need to yield to the select loop to accept the send request, and then
44 // yield again to the send operation to write to the socket. I think the
45 // best way to do that is just give it some time.
46
47 deadline := time.Now().Add(1 * time.Second)
48 for {
49 if time.Now().After(deadline) {
50 t.Fatalf("never received a span")
51 }
52 if want, have := 1, len(server.spans()); want != have {
53 time.Sleep(time.Millisecond)
54 continue
55 }
56 break
57 }
58
59 gotSpan := server.spans()[0]
60 if want, have := methodName, gotSpan.GetName(); want != have {
61 t.Errorf("want %q, have %q", want, have)
62 }
63 if want, have := traceID, gotSpan.GetTraceId(); want != have {
64 t.Errorf("want %d, have %d", want, have)
65 }
66 if want, have := spanID, gotSpan.GetId(); want != have {
67 t.Errorf("want %d, have %d", want, have)
68 }
69 if want, have := parentSpanID, gotSpan.GetParentId(); want != have {
70 t.Errorf("want %d, have %d", want, have)
71 }
72
73 if want, have := 1, len(gotSpan.GetAnnotations()); want != have {
74 t.Fatalf("want %d, have %d", want, have)
75 }
76
77 gotAnnotation := gotSpan.GetAnnotations()[0]
78 if want, have := value, gotAnnotation.GetValue(); want != have {
79 t.Errorf("want %q, have %q", want, have)
80 }
81 }
82
83 type scribeServer struct {
84 t *testing.T
85 transport *thrift.TServerSocket
86 address string
87 server *thrift.TSimpleServer
88 handler *scribeHandler
89 }
90
91 func newScribeServer(t *testing.T) *scribeServer {
92 protocolFactory := thrift.NewTBinaryProtocolFactoryDefault()
93 transportFactory := thrift.NewTFramedTransportFactory(thrift.NewTTransportFactory())
94
95 var port int
96 var transport *thrift.TServerSocket
97 var err error
98 for i := 0; i < 10; i++ {
99 port = 10000 + rand.Intn(10000)
100 transport, err = thrift.NewTServerSocket(fmt.Sprintf(":%d", port))
101 if err != nil {
102 t.Logf("port %d: %v", port, err)
103 continue
104 }
105 break
106 }
107 if err != nil {
108 t.Fatal(err)
109 }
110
111 handler := newScribeHandler(t)
112 server := thrift.NewTSimpleServer4(
113 scribe.NewScribeProcessor(handler),
114 transport,
115 transportFactory,
116 protocolFactory,
117 )
118
119 go server.Serve()
120
121 deadline := time.Now().Add(time.Second)
122 for !canConnect(port) {
123 if time.Now().After(deadline) {
124 t.Fatal("server never started")
125 }
126 time.Sleep(time.Millisecond)
127 }
128
129 return &scribeServer{
130 transport: transport,
131 address: fmt.Sprintf("127.0.0.1:%d", port),
132 handler: handler,
133 }
134 }
135
136 func (s *scribeServer) addr() string {
137 return s.address
138 }
139
140 func (s *scribeServer) spans() []*zipkincore.Span {
141 return s.handler.spans()
142 }
143
144 type scribeHandler struct {
145 t *testing.T
146 sync.RWMutex
147 entries []*scribe.LogEntry
148 }
149
150 func newScribeHandler(t *testing.T) *scribeHandler {
151 return &scribeHandler{t: t}
152 }
153
154 func (h *scribeHandler) Log(messages []*scribe.LogEntry) (scribe.ResultCode, error) {
155 h.Lock()
156 defer h.Unlock()
157 for _, m := range messages {
158 h.entries = append(h.entries, m)
159 }
160 return scribe.ResultCode_OK, nil
161 }
162
163 func (h *scribeHandler) spans() []*zipkincore.Span {
164 h.RLock()
165 defer h.RUnlock()
166 spans := []*zipkincore.Span{}
167 for _, m := range h.entries {
168 decoded, err := base64.StdEncoding.DecodeString(m.GetMessage())
169 if err != nil {
170 h.t.Error(err)
171 continue
172 }
173 buffer := thrift.NewTMemoryBuffer()
174 if _, err := buffer.Write(decoded); err != nil {
175 h.t.Error(err)
176 continue
177 }
178 transport := thrift.NewTBinaryProtocolTransport(buffer)
179 zs := &zipkincore.Span{}
180 if err := zs.Read(transport); err != nil {
181 h.t.Error(err)
182 continue
183 }
184 spans = append(spans, zs)
185 }
186 return spans
187 }
188
189 func canConnect(port int) bool {
190 c, err := net.Dial("tcp", fmt.Sprintf("127.0.0.1:%d", port))
191 if err != nil {
192 return false
193 }
194 c.Close()
195 return true
196 }
+0
-347
tracing/zipkin/span.go less more
0 package zipkin
1
2 import (
3 "encoding/binary"
4 "fmt"
5 "math"
6 "net"
7 "strconv"
8 "time"
9
10 "golang.org/x/net/context"
11
12 "github.com/go-kit/kit/tracing/zipkin/_thrift/gen-go/zipkincore"
13 )
14
15 // A Span is a named collection of annotations. It represents meaningful
16 // information about a single method call, i.e. a single request against a
17 // service. Clients should annotate the span, and submit it when the request
18 // that generated it is complete.
19 type Span struct {
20 host *zipkincore.Endpoint
21 methodName string
22
23 traceID int64
24 spanID int64
25 parentSpanID int64
26
27 annotations []annotation
28 binaryAnnotations []binaryAnnotation
29
30 debug bool
31 sampled bool
32 runSampler bool
33 }
34
35 // NewSpan returns a new Span, which can be annotated and collected by a
36 // collector. Spans are passed through the request context to each middleware
37 // under the SpanContextKey.
38 func NewSpan(hostport, serviceName, methodName string, traceID, spanID, parentSpanID int64) *Span {
39 return &Span{
40 host: makeEndpoint(hostport, serviceName),
41 methodName: methodName,
42 traceID: traceID,
43 spanID: spanID,
44 parentSpanID: parentSpanID,
45 runSampler: true,
46 }
47 }
48
49 // makeEndpoint takes the hostport and service name that represent this Zipkin
50 // service, and returns an endpoint that's embedded into the Zipkin core Span
51 // type. It will return a nil endpoint if the input parameters are malformed.
52 func makeEndpoint(hostport, serviceName string) *zipkincore.Endpoint {
53 host, port, err := net.SplitHostPort(hostport)
54 if err != nil {
55 return nil
56 }
57 portInt, err := strconv.ParseInt(port, 10, 16)
58 if err != nil {
59 return nil
60 }
61 addrs, err := net.LookupIP(host)
62 if err != nil {
63 return nil
64 }
65 // we need the first IPv4 address.
66 var addr net.IP
67 for i := range addrs {
68 addr = addrs[i].To4()
69 if addr != nil {
70 break
71 }
72 }
73 if addr == nil {
74 // none of the returned addresses is IPv4.
75 return nil
76 }
77 endpoint := zipkincore.NewEndpoint()
78 endpoint.Ipv4 = (int32)(binary.BigEndian.Uint32(addr))
79 endpoint.Port = int16(portInt)
80 endpoint.ServiceName = serviceName
81 return endpoint
82 }
83
84 // MakeNewSpanFunc returns a function that generates a new Zipkin span.
85 func MakeNewSpanFunc(hostport, serviceName, methodName string) NewSpanFunc {
86 return func(traceID, spanID, parentSpanID int64) *Span {
87 return NewSpan(hostport, serviceName, methodName, traceID, spanID, parentSpanID)
88 }
89 }
90
91 // NewSpanFunc takes trace, span, & parent span IDs to produce a Span object.
92 type NewSpanFunc func(traceID, spanID, parentSpanID int64) *Span
93
94 // TraceID returns the ID of the trace that this span is a member of.
95 func (s *Span) TraceID() int64 { return s.traceID }
96
97 // SpanID returns the ID of this span.
98 func (s *Span) SpanID() int64 { return s.spanID }
99
100 // ParentSpanID returns the ID of the span which invoked this span.
101 // It may be zero.
102 func (s *Span) ParentSpanID() int64 { return s.parentSpanID }
103
104 // Sample forces sampling of this span.
105 func (s *Span) Sample() {
106 s.sampled = true
107 }
108
109 // SetDebug forces debug mode on this span.
110 func (s *Span) SetDebug() {
111 s.debug = true
112 }
113
114 // Annotate annotates the span with the given value.
115 func (s *Span) Annotate(value string) {
116 s.annotations = append(s.annotations, annotation{
117 timestamp: time.Now(),
118 value: value,
119 host: s.host,
120 })
121 }
122
123 // AnnotateBinary annotates the span with a key and a value that will be []byte
124 // encoded.
125 func (s *Span) AnnotateBinary(key string, value interface{}) {
126 var a zipkincore.AnnotationType
127 var b []byte
128 // We are not using zipkincore.AnnotationType_I16 for types that could fit
129 // as reporting on it seems to be broken on the zipkin web interface
130 // (however, we can properly extract the number from zipkin storage
131 // directly). int64 has issues with negative numbers but seems ok for
132 // positive numbers needing more than 32 bit.
133 switch v := value.(type) {
134 case bool:
135 a = zipkincore.AnnotationType_BOOL
136 b = []byte("\x00")
137 if v {
138 b = []byte("\x01")
139 }
140 case []byte:
141 a = zipkincore.AnnotationType_BYTES
142 b = v
143 case byte:
144 a = zipkincore.AnnotationType_I32
145 b = make([]byte, 4)
146 binary.BigEndian.PutUint32(b, uint32(v))
147 case int8:
148 a = zipkincore.AnnotationType_I32
149 b = make([]byte, 4)
150 binary.BigEndian.PutUint32(b, uint32(v))
151 case int16:
152 a = zipkincore.AnnotationType_I32
153 b = make([]byte, 4)
154 binary.BigEndian.PutUint32(b, uint32(v))
155 case uint16:
156 a = zipkincore.AnnotationType_I32
157 b = make([]byte, 4)
158 binary.BigEndian.PutUint32(b, uint32(v))
159 case int32:
160 a = zipkincore.AnnotationType_I32
161 b = make([]byte, 4)
162 binary.BigEndian.PutUint32(b, uint32(v))
163 case uint32:
164 a = zipkincore.AnnotationType_I32
165 b = make([]byte, 4)
166 binary.BigEndian.PutUint32(b, uint32(v))
167 case int64:
168 a = zipkincore.AnnotationType_I64
169 b = make([]byte, 8)
170 binary.BigEndian.PutUint64(b, uint64(v))
171 case int:
172 a = zipkincore.AnnotationType_I32
173 b = make([]byte, 8)
174 binary.BigEndian.PutUint32(b, uint32(v))
175 case uint:
176 a = zipkincore.AnnotationType_I32
177 b = make([]byte, 8)
178 binary.BigEndian.PutUint32(b, uint32(v))
179 case uint64:
180 a = zipkincore.AnnotationType_I64
181 b = make([]byte, 8)
182 binary.BigEndian.PutUint64(b, uint64(v))
183 case float32:
184 a = zipkincore.AnnotationType_DOUBLE
185 b = make([]byte, 8)
186 bits := math.Float64bits(float64(v))
187 binary.BigEndian.PutUint64(b, bits)
188 case float64:
189 a = zipkincore.AnnotationType_DOUBLE
190 b = make([]byte, 8)
191 bits := math.Float64bits(v)
192 binary.BigEndian.PutUint64(b, bits)
193 case string:
194 a = zipkincore.AnnotationType_STRING
195 b = []byte(v)
196 default:
197 // we have no handler for type's value, but let's get a string
198 // representation of it.
199 a = zipkincore.AnnotationType_STRING
200 b = []byte(fmt.Sprintf("%+v", value))
201 }
202 s.binaryAnnotations = append(s.binaryAnnotations, binaryAnnotation{
203 key: key,
204 value: b,
205 annotationType: a,
206 host: s.host,
207 })
208 }
209
210 // AnnotateString annotates the span with a key and a string value.
211 // Deprecated: use AnnotateBinary instead.
212 func (s *Span) AnnotateString(key, value string) {
213 s.binaryAnnotations = append(s.binaryAnnotations, binaryAnnotation{
214 key: key,
215 value: []byte(value),
216 annotationType: zipkincore.AnnotationType_STRING,
217 host: s.host,
218 })
219 }
220
221 // SpanOption sets an optional parameter for Spans.
222 type SpanOption func(s *Span)
223
224 // ServerAddr will create a ServerAddr annotation with its own zipkin Endpoint
225 // when used with NewChildSpan. This is typically used when the NewChildSpan is
226 // used to annotate non Zipkin aware resources like databases and caches.
227 func ServerAddr(hostport, serviceName string) SpanOption {
228 return func(s *Span) {
229 e := makeEndpoint(hostport, serviceName)
230 if e != nil {
231 host := s.host
232 s.host = e // set temporary Endpoint
233 s.AnnotateBinary(ServerAddress, true) // use
234 s.host = host // reset
235 }
236 }
237 }
238
239 // Host will update the default zipkin Endpoint of the Span it is used with.
240 func Host(hostport, serviceName string) SpanOption {
241 return func(s *Span) {
242 e := makeEndpoint(hostport, serviceName)
243 if e != nil {
244 s.host = e // update
245 }
246 }
247 }
248
249 // Debug will set the Span to debug mode forcing Samplers to pass the Span.
250 func Debug(debug bool) SpanOption {
251 return func(s *Span) {
252 s.debug = debug
253 }
254 }
255
256 // CollectFunc will collect the span created with NewChildSpan.
257 type CollectFunc func()
258
259 // NewChildSpan returns a new child Span of a parent Span extracted from the
260 // passed context. It can be used to annotate resources like databases, caches,
261 // etc. and treat them as if they are a regular service. For tracing client
262 // endpoints use AnnotateClient instead.
263 func NewChildSpan(ctx context.Context, collector Collector, methodName string, options ...SpanOption) (*Span, CollectFunc) {
264 span, ok := FromContext(ctx)
265 if !ok {
266 return nil, func() {}
267 }
268 childSpan := &Span{
269 host: span.host,
270 methodName: methodName,
271 traceID: span.traceID,
272 spanID: newID(),
273 parentSpanID: span.spanID,
274 debug: span.debug,
275 sampled: span.sampled,
276 runSampler: span.runSampler,
277 }
278 childSpan.Annotate(ClientSend)
279 for _, option := range options {
280 option(childSpan)
281 }
282 collectFunc := func() {
283 if childSpan != nil {
284 childSpan.Annotate(ClientReceive)
285 collector.Collect(childSpan)
286 childSpan = nil
287 }
288 }
289 return childSpan, collectFunc
290 }
291
292 // IsSampled returns if the span is set to be sampled.
293 func (s *Span) IsSampled() bool {
294 return s.sampled
295 }
296
297 // Encode creates a Thrift Span from the gokit Span.
298 func (s *Span) Encode() *zipkincore.Span {
299 // TODO lots of garbage here. We can improve by preallocating e.g. the
300 // Thrift stuff into an encoder struct, owned by the ScribeCollector.
301 zs := zipkincore.Span{
302 TraceId: s.traceID,
303 Name: s.methodName,
304 Id: s.spanID,
305 Debug: s.debug,
306 }
307
308 if s.parentSpanID != 0 {
309 zs.ParentId = new(int64)
310 (*zs.ParentId) = s.parentSpanID
311 }
312
313 zs.Annotations = make([]*zipkincore.Annotation, len(s.annotations))
314 for i, a := range s.annotations {
315 zs.Annotations[i] = &zipkincore.Annotation{
316 Timestamp: a.timestamp.UnixNano() / 1e3,
317 Value: a.value,
318 Host: a.host,
319 }
320 }
321
322 zs.BinaryAnnotations = make([]*zipkincore.BinaryAnnotation, len(s.binaryAnnotations))
323 for i, a := range s.binaryAnnotations {
324 zs.BinaryAnnotations[i] = &zipkincore.BinaryAnnotation{
325 Key: a.key,
326 Value: a.value,
327 AnnotationType: a.annotationType,
328 Host: a.host,
329 }
330 }
331
332 return &zs
333 }
334
335 type annotation struct {
336 timestamp time.Time
337 value string
338 host *zipkincore.Endpoint
339 }
340
341 type binaryAnnotation struct {
342 key string
343 value []byte
344 annotationType zipkincore.AnnotationType
345 host *zipkincore.Endpoint
346 }
+0
-54
tracing/zipkin/span_test.go less more
0 package zipkin_test
1
2 import (
3 "bytes"
4 "testing"
5
6 "github.com/go-kit/kit/tracing/zipkin"
7 )
8
9 func TestAnnotateBinaryEncodesKeyValueAsBytes(t *testing.T) {
10 key := "awesome-bytes-test"
11 value := []byte("this is neat")
12
13 span := &zipkin.Span{}
14 span.AnnotateBinary(key, value)
15
16 encodedSpan := span.Encode()
17 annotations := encodedSpan.GetBinaryAnnotations()
18
19 if len(annotations) == 0 {
20 t.Error("want non-zero length slice, have empty slice")
21 }
22
23 if want, have := key, annotations[0].Key; want != have {
24 t.Errorf("want %q, got %q", want, have)
25 }
26
27 if want, have := value, annotations[0].Value; bytes.Compare(want, have) != 0 {
28 t.Errorf("want %s, got %s", want, have)
29 }
30 }
31
32 func TestAnnotateStringEncodesKeyValueAsBytes(t *testing.T) {
33 key := "awesome-string-test"
34 value := "this is neat"
35
36 span := &zipkin.Span{}
37 span.AnnotateString(key, value)
38
39 encodedSpan := span.Encode()
40 annotations := encodedSpan.GetBinaryAnnotations()
41
42 if len(annotations) == 0 {
43 t.Error("want non-zero length slice, have empty slice")
44 }
45
46 if want, have := key, annotations[0].Key; want != have {
47 t.Errorf("want %q, got %q", want, have)
48 }
49
50 if want, have := value, annotations[0].Value; bytes.Compare([]byte(want), have) != 0 {
51 t.Errorf("want %s, got %s", want, have)
52 }
53 }
+0
-332
tracing/zipkin/zipkin.go less more
0 package zipkin
1
2 import (
3 "math/rand"
4 "net/http"
5 "strconv"
6
7 "golang.org/x/net/context"
8 "google.golang.org/grpc/metadata"
9
10 "github.com/go-kit/kit/endpoint"
11 "github.com/go-kit/kit/log"
12 )
13
14 // In Zipkin, "spans are considered to start and stop with the client." The
15 // client is responsible for creating a new span ID for each outgoing request,
16 // copying its span ID to the parent span ID, and maintaining the same trace
17 // ID. The server-receive and server-send annotations can be considered value
18 // added information and aren't strictly necessary.
19 //
20 // Further reading:
21 // • http://www.slideshare.net/johanoskarsson/zipkin-runtime-open-house
22 // • https://groups.google.com/forum/#!topic/zipkin-user/KilwtSA0g1k
23 // • https://gist.github.com/yoavaa/3478d3a0df666f21a98c
24
25 const (
26 // SpanContextKey holds the key used to store Zipkin spans in the context.
27 SpanContextKey = "Zipkin-Span"
28
29 // https://github.com/racker/tryfer#headers
30 traceIDHTTPHeader = "X-B3-TraceId"
31 spanIDHTTPHeader = "X-B3-SpanId"
32 parentSpanIDHTTPHeader = "X-B3-ParentSpanId"
33 sampledHTTPHeader = "X-B3-Sampled"
34
35 // gRPC keys are always lowercase
36 traceIDGRPCKey = "x-b3-traceid"
37 spanIDGRPCKey = "x-b3-spanid"
38 parentSpanIDGRPCKey = "x-b3-parentspanid"
39 sampledGRPCKey = "x-b3-sampled"
40
41 // ClientSend is the annotation value used to mark a client sending a
42 // request to a server.
43 ClientSend = "cs"
44
45 // ServerReceive is the annotation value used to mark a server's receipt
46 // of a request from a client.
47 ServerReceive = "sr"
48
49 // ServerSend is the annotation value used to mark a server's completion
50 // of a request and response to a client.
51 ServerSend = "ss"
52
53 // ClientReceive is the annotation value used to mark a client's receipt
54 // of a completed request from a server.
55 ClientReceive = "cr"
56
57 // ServerAddress allows to annotate the server endpoint in case the server
58 // side trace is not instrumented as with resources like caches and
59 // databases.
60 ServerAddress = "sa"
61
62 // ClientAddress allows to annotate the client origin in case the client was
63 // forwarded by a proxy which does not instrument itself.
64 ClientAddress = "ca"
65 )
66
67 // AnnotateServer returns a server.Middleware that extracts a span from the
68 // context, adds server-receive and server-send annotations at the boundaries,
69 // and submits the span to the collector. If no span is found in the context,
70 // a new span is generated and inserted.
71 func AnnotateServer(newSpan NewSpanFunc, c Collector) endpoint.Middleware {
72 return func(next endpoint.Endpoint) endpoint.Endpoint {
73 return func(ctx context.Context, request interface{}) (interface{}, error) {
74 span, ok := FromContext(ctx)
75 if !ok {
76 traceID := newID()
77 span = newSpan(traceID, traceID, 0)
78 ctx = context.WithValue(ctx, SpanContextKey, span)
79 }
80 c.ShouldSample(span)
81 span.Annotate(ServerReceive)
82 defer func() { span.Annotate(ServerSend); c.Collect(span) }()
83 return next(ctx, request)
84 }
85 }
86 }
87
88 // AnnotateClient returns a middleware that extracts a parent span from the
89 // context, produces a client (child) span from it, adds client-send and
90 // client-receive annotations at the boundaries, and submits the span to the
91 // collector. If no span is found in the context, a new span is generated and
92 // inserted.
93 func AnnotateClient(newSpan NewSpanFunc, c Collector) endpoint.Middleware {
94 return func(next endpoint.Endpoint) endpoint.Endpoint {
95 return func(ctx context.Context, request interface{}) (interface{}, error) {
96 var clientSpan *Span
97 parentSpan, ok := FromContext(ctx)
98 if ok {
99 clientSpan = newSpan(parentSpan.TraceID(), newID(), parentSpan.SpanID())
100 clientSpan.runSampler = false
101 clientSpan.sampled = c.ShouldSample(parentSpan)
102 } else {
103 // Abnormal operation. Traces should always start server side.
104 // We create a root span but annotate with a warning.
105 traceID := newID()
106 clientSpan = newSpan(traceID, traceID, 0)
107 c.ShouldSample(clientSpan)
108 clientSpan.AnnotateBinary("warning", "missing server side trace")
109 }
110 ctx = context.WithValue(ctx, SpanContextKey, clientSpan) // set
111 defer func() { ctx = context.WithValue(ctx, SpanContextKey, parentSpan) }() // reset
112 clientSpan.Annotate(ClientSend)
113 defer func() { clientSpan.Annotate(ClientReceive); c.Collect(clientSpan) }()
114 return next(ctx, request)
115 }
116 }
117 }
118
119 // ToContext returns a function that satisfies transport/http.BeforeFunc. It
120 // takes a Zipkin span from the incoming HTTP request, and saves it in the
121 // request context. It's designed to be wired into a server's HTTP transport
122 // Before stack. The logger is used to report errors.
123 func ToContext(newSpan NewSpanFunc, logger log.Logger) func(ctx context.Context, r *http.Request) context.Context {
124 return func(ctx context.Context, r *http.Request) context.Context {
125 span := fromHTTP(newSpan, r, logger)
126 if span == nil {
127 return ctx
128 }
129 return context.WithValue(ctx, SpanContextKey, span)
130 }
131 }
132
133 // ToGRPCContext returns a function that satisfies transport/grpc.BeforeFunc. It
134 // takes a Zipkin span from the incoming GRPC request, and saves it in the
135 // request context. It's designed to be wired into a server's GRPC transport
136 // Before stack. The logger is used to report errors.
137 func ToGRPCContext(newSpan NewSpanFunc, logger log.Logger) func(ctx context.Context, md *metadata.MD) context.Context {
138 return func(ctx context.Context, md *metadata.MD) context.Context {
139 span := fromGRPC(newSpan, *md, logger)
140 if span == nil {
141 return ctx
142 }
143 return context.WithValue(ctx, SpanContextKey, span)
144 }
145 }
146
147 // ToRequest returns a function that satisfies transport/http.BeforeFunc. It
148 // takes a Zipkin span from the context, and injects it into the HTTP request.
149 // It's designed to be wired into a client's HTTP transport Before stack. It's
150 // expected that AnnotateClient has already ensured the span in the context is
151 // a child/client span.
152 func ToRequest(newSpan NewSpanFunc) func(ctx context.Context, r *http.Request) context.Context {
153 return func(ctx context.Context, r *http.Request) context.Context {
154 span, ok := FromContext(ctx)
155 if !ok {
156 return ctx
157 }
158 if id := span.TraceID(); id > 0 {
159 r.Header.Set(traceIDHTTPHeader, strconv.FormatInt(id, 16))
160 }
161 if id := span.SpanID(); id > 0 {
162 r.Header.Set(spanIDHTTPHeader, strconv.FormatInt(id, 16))
163 }
164 if id := span.ParentSpanID(); id > 0 {
165 r.Header.Set(parentSpanIDHTTPHeader, strconv.FormatInt(id, 16))
166 }
167 if span.IsSampled() {
168 r.Header.Set(sampledHTTPHeader, "1")
169 } else {
170 r.Header.Set(sampledHTTPHeader, "0")
171 }
172 return ctx
173 }
174 }
175
176 // ToGRPCRequest returns a function that satisfies transport/grpc.BeforeFunc. It
177 // takes a Zipkin span from the context, and injects it into the GRPC context.
178 // It's designed to be wired into a client's GRPC transport Before stack. It's
179 // expected that AnnotateClient has already ensured the span in the context is
180 // a child/client span.
181 func ToGRPCRequest(newSpan NewSpanFunc) func(ctx context.Context, md *metadata.MD) context.Context {
182 return func(ctx context.Context, md *metadata.MD) context.Context {
183 span, ok := FromContext(ctx)
184 if !ok {
185 return ctx
186 }
187 if id := span.TraceID(); id > 0 {
188 (*md)[traceIDGRPCKey] = append((*md)[traceIDGRPCKey], strconv.FormatInt(id, 16))
189 }
190 if id := span.SpanID(); id > 0 {
191 (*md)[spanIDGRPCKey] = append((*md)[spanIDGRPCKey], strconv.FormatInt(id, 16))
192 }
193 if id := span.ParentSpanID(); id > 0 {
194 (*md)[parentSpanIDGRPCKey] = append((*md)[parentSpanIDGRPCKey], strconv.FormatInt(id, 16))
195 }
196 if span.IsSampled() {
197 (*md)[sampledGRPCKey] = append((*md)[sampledGRPCKey], "1")
198 } else {
199 (*md)[sampledGRPCKey] = append((*md)[sampledGRPCKey], "0")
200 }
201 return ctx
202 }
203 }
204
205 func fromHTTP(newSpan NewSpanFunc, r *http.Request, logger log.Logger) *Span {
206 traceIDStr := r.Header.Get(traceIDHTTPHeader)
207 if traceIDStr == "" {
208 return nil
209 }
210 traceID, err := strconv.ParseInt(traceIDStr, 16, 64)
211 if err != nil {
212 logger.Log("msg", "invalid trace id found, ignoring trace", "err", err)
213 return nil
214 }
215 spanIDStr := r.Header.Get(spanIDHTTPHeader)
216 if spanIDStr == "" {
217 logger.Log("msg", "trace ID without span ID") // abnormal
218 spanIDStr = strconv.FormatInt(newID(), 64) // deal with it
219 }
220 spanID, err := strconv.ParseInt(spanIDStr, 16, 64)
221 if err != nil {
222 logger.Log(spanIDHTTPHeader, spanIDStr, "err", err) // abnormal
223 spanID = newID() // deal with it
224 }
225 parentSpanIDStr := r.Header.Get(parentSpanIDHTTPHeader)
226 if parentSpanIDStr == "" {
227 parentSpanIDStr = "0" // normal
228 }
229 parentSpanID, err := strconv.ParseInt(parentSpanIDStr, 16, 64)
230 if err != nil {
231 logger.Log(parentSpanIDHTTPHeader, parentSpanIDStr, "err", err) // abnormal
232 parentSpanID = 0 // the only way to deal with it
233 }
234 span := newSpan(traceID, spanID, parentSpanID)
235 switch r.Header.Get(sampledHTTPHeader) {
236 case "0":
237 span.runSampler = false
238 span.sampled = false
239 case "1":
240 span.runSampler = false
241 span.sampled = true
242 default:
243 // we don't know if the upstream trace was sampled. use our sampler
244 span.runSampler = true
245 }
246 return span
247 }
248
249 func fromGRPC(newSpan NewSpanFunc, md metadata.MD, logger log.Logger) *Span {
250 traceIDSlc := md[traceIDGRPCKey]
251 pos := len(traceIDSlc) - 1
252 if pos < 0 {
253 return nil
254 }
255 traceID, err := strconv.ParseInt(traceIDSlc[pos], 16, 64)
256 if err != nil {
257 logger.Log("msg", "invalid trace id found, ignoring trace", "err", err)
258 return nil
259 }
260 spanIDSlc := md[spanIDGRPCKey]
261 pos = len(spanIDSlc) - 1
262 if pos < 0 {
263 spanIDSlc = make([]string, 1)
264 pos = 0
265 }
266 if spanIDSlc[pos] == "" {
267 logger.Log("msg", "trace ID without span ID") // abnormal
268 spanIDSlc[pos] = strconv.FormatInt(newID(), 64) // deal with it
269 }
270 spanID, err := strconv.ParseInt(spanIDSlc[pos], 16, 64)
271 if err != nil {
272 logger.Log(spanIDHTTPHeader, spanIDSlc, "err", err) // abnormal
273 spanID = newID() // deal with it
274 }
275 parentSpanIDSlc := md[parentSpanIDGRPCKey]
276 pos = len(parentSpanIDSlc) - 1
277 if pos < 0 {
278 parentSpanIDSlc = make([]string, 1)
279 pos = 0
280 }
281 if parentSpanIDSlc[pos] == "" {
282 parentSpanIDSlc[pos] = "0" // normal
283 }
284 parentSpanID, err := strconv.ParseInt(parentSpanIDSlc[pos], 16, 64)
285 if err != nil {
286 logger.Log(parentSpanIDHTTPHeader, parentSpanIDSlc, "err", err) // abnormal
287 parentSpanID = 0 // the only way to deal with it
288 }
289 span := newSpan(traceID, spanID, parentSpanID)
290 var sampledHdr string
291 sampledSlc := md[sampledGRPCKey]
292 pos = len(sampledSlc) - 1
293 if pos >= 0 {
294 sampledHdr = sampledSlc[pos]
295 }
296 switch sampledHdr {
297 case "0":
298 span.runSampler = false
299 span.sampled = false
300 case "1":
301 span.runSampler = false
302 span.sampled = true
303 default:
304 // we don't know if the upstream trace was sampled. use our sampler
305 span.runSampler = true
306 }
307 return span
308 }
309
310 // FromContext extracts an existing Zipkin span if it is stored in the provided
311 // context. If you add context.Context as the first parameter in your service
312 // methods you can annotate spans from within business logic. Typical use case
313 // is to AnnotateDuration on interaction with resources like databases.
314 func FromContext(ctx context.Context) (*Span, bool) {
315 val := ctx.Value(SpanContextKey)
316 if val == nil {
317 return nil, false
318 }
319 span, ok := val.(*Span)
320 if !ok {
321 panic(SpanContextKey + " value isn't a span object")
322 }
323 return span, true
324 }
325
326 func newID() int64 {
327 // https://github.com/wadey/go-zipkin/blob/46e5f01/trace.go#L183-188
328 // https://github.com/twitter/zipkin/issues/199
329 // :(
330 return rand.Int63() & 0x001fffffffffffff
331 }
+0
-282
tracing/zipkin/zipkin_test.go less more
0 package zipkin_test
1
2 import (
3 "fmt"
4 "io/ioutil"
5 "net/http"
6 "reflect"
7 "runtime"
8 "strconv"
9 "strings"
10 "testing"
11
12 "golang.org/x/net/context"
13 "google.golang.org/grpc/metadata"
14
15 "github.com/go-kit/kit/endpoint"
16 "github.com/go-kit/kit/log"
17 "github.com/go-kit/kit/tracing/zipkin"
18 )
19
20 func TestToContext(t *testing.T) {
21 const (
22 hostport = "5.5.5.5:5555"
23 serviceName = "foo-service"
24 methodName = "foo-method"
25 traceID int64 = 12
26 spanID int64 = 34
27 parentSpanID int64 = 56
28 sampled = "1"
29 )
30
31 r, _ := http.NewRequest("GET", "https://best.horse", nil)
32 r.Header.Set("X-B3-TraceId", strconv.FormatInt(traceID, 16))
33 r.Header.Set("X-B3-SpanId", strconv.FormatInt(spanID, 16))
34 r.Header.Set("X-B3-ParentSpanId", strconv.FormatInt(parentSpanID, 16))
35 r.Header.Set("X-B3-Sampled", sampled)
36
37 newSpan := zipkin.MakeNewSpanFunc(hostport, serviceName, methodName)
38 toContext := zipkin.ToContext(newSpan, log.NewLogfmtLogger(ioutil.Discard))
39
40 ctx := toContext(context.Background(), r)
41 val := ctx.Value(zipkin.SpanContextKey)
42 if val == nil {
43 t.Fatalf("%s returned no value", zipkin.SpanContextKey)
44 }
45 span, ok := val.(*zipkin.Span)
46 if !ok {
47 t.Fatalf("%s was not a Span object", zipkin.SpanContextKey)
48 }
49
50 for want, haveFunc := range map[int64]func() int64{
51 traceID: span.TraceID,
52 spanID: span.SpanID,
53 parentSpanID: span.ParentSpanID,
54 } {
55 if have := haveFunc(); want != have {
56 name := runtime.FuncForPC(reflect.ValueOf(haveFunc).Pointer()).Name()
57 name = strings.Split(name, "·")[0]
58 toks := strings.Split(name, ".")
59 name = toks[len(toks)-1]
60 t.Errorf("%s: want %d, have %d", name, want, have)
61 }
62 }
63 if want, have := true, span.IsSampled(); want != have {
64 t.Errorf("IsSampled: want %v, have %v", want, have)
65 }
66 }
67
68 func TestFromContext(t *testing.T) {
69 const (
70 hostport = "5.5.5.5:5555"
71 serviceName = "foo-service"
72 methodName = "foo-method"
73 traceID int64 = 14
74 spanID int64 = 36
75 parentSpanID int64 = 58
76 )
77
78 newSpan := zipkin.NewSpan(hostport, serviceName, methodName, traceID, spanID, parentSpanID)
79 newSpan.Sample()
80 ctx := context.WithValue(
81 context.Background(),
82 zipkin.SpanContextKey,
83 newSpan,
84 )
85
86 span, ok := zipkin.FromContext(ctx)
87 if !ok {
88 t.Fatalf("expected a context value in %q", zipkin.SpanContextKey)
89 }
90 if span == nil {
91 t.Fatal("expected a Zipkin span object")
92 }
93 for want, haveFunc := range map[int64]func() int64{
94 traceID: span.TraceID,
95 spanID: span.SpanID,
96 parentSpanID: span.ParentSpanID,
97 } {
98 if have := haveFunc(); want != have {
99 name := runtime.FuncForPC(reflect.ValueOf(haveFunc).Pointer()).Name()
100 name = strings.Split(name, "·")[0]
101 toks := strings.Split(name, ".")
102 name = toks[len(toks)-1]
103 t.Errorf("%s: want %d, have %d", name, want, have)
104 }
105 }
106 if want, have := true, span.IsSampled(); want != have {
107 t.Errorf("IsSampled: want %v, have %v", want, have)
108 }
109 }
110
111 func TestToGRPCContext(t *testing.T) {
112 const (
113 hostport = "5.5.5.5:5555"
114 serviceName = "foo-service"
115 methodName = "foo-method"
116 traceID int64 = 12
117 spanID int64 = 34
118 parentSpanID int64 = 56
119 )
120
121 md := metadata.MD{
122 "x-b3-traceid": []string{strconv.FormatInt(traceID, 16)},
123 "x-b3-spanid": []string{strconv.FormatInt(spanID, 16)},
124 "x-b3-parentspanid": []string{strconv.FormatInt(parentSpanID, 16)},
125 "x-b3-sampled": []string{"1"},
126 }
127
128 newSpan := zipkin.MakeNewSpanFunc(hostport, serviceName, methodName)
129 toContext := zipkin.ToGRPCContext(newSpan, log.NewLogfmtLogger(ioutil.Discard))
130
131 ctx := toContext(context.Background(), &md)
132 val := ctx.Value(zipkin.SpanContextKey)
133 if val == nil {
134 t.Fatalf("%s returned no value", zipkin.SpanContextKey)
135 }
136 span, ok := val.(*zipkin.Span)
137 if !ok {
138 t.Fatalf("%s was not a Span object", zipkin.SpanContextKey)
139 }
140
141 for want, haveFunc := range map[int64]func() int64{
142 traceID: span.TraceID,
143 spanID: span.SpanID,
144 parentSpanID: span.ParentSpanID,
145 } {
146 if have := haveFunc(); want != have {
147 name := runtime.FuncForPC(reflect.ValueOf(haveFunc).Pointer()).Name()
148 name = strings.Split(name, "·")[0]
149 toks := strings.Split(name, ".")
150 name = toks[len(toks)-1]
151 t.Errorf("%s: want %d, have %d", name, want, have)
152 }
153 }
154 if want, have := true, span.IsSampled(); want != have {
155 t.Errorf("IsSampled: want %v, have %v", want, have)
156 }
157 }
158
159 func TestToRequest(t *testing.T) {
160 const (
161 hostport = "5.5.5.5:5555"
162 serviceName = "foo-service"
163 methodName = "foo-method"
164 traceID int64 = 20
165 spanID int64 = 40
166 parentSpanID int64 = 90
167 sampled = "1"
168 )
169
170 newSpan := zipkin.MakeNewSpanFunc(hostport, serviceName, methodName)
171 span := newSpan(traceID, spanID, parentSpanID)
172 span.Sample()
173 ctx := context.WithValue(context.Background(), zipkin.SpanContextKey, span)
174 r, _ := http.NewRequest("GET", "https://best.horse", nil)
175 ctx = zipkin.ToRequest(newSpan)(ctx, r)
176
177 for header, wantInt := range map[string]int64{
178 "X-B3-TraceId": traceID,
179 "X-B3-SpanId": spanID,
180 "X-B3-ParentSpanId": parentSpanID,
181 } {
182 if want, have := strconv.FormatInt(wantInt, 16), r.Header.Get(header); want != have {
183 t.Errorf("%s: want %q, have %q", header, want, have)
184 }
185 }
186 if want, have := sampled, r.Header.Get("X-B3-Sampled"); want != have {
187 t.Errorf("X-B3-Sampled: want %q, have %q", want, have)
188 }
189 }
190
191 func TestToGRPCRequest(t *testing.T) {
192 const (
193 hostport = "5.5.5.5:5555"
194 serviceName = "foo-service"
195 methodName = "foo-method"
196 traceID int64 = 20
197 spanID int64 = 40
198 parentSpanID int64 = 90
199 sampled = "1"
200 )
201
202 newSpan := zipkin.MakeNewSpanFunc(hostport, serviceName, methodName)
203 span := newSpan(traceID, spanID, parentSpanID)
204 span.Sample()
205 ctx := context.WithValue(context.Background(), zipkin.SpanContextKey, span)
206 md := &metadata.MD{}
207 ctx = zipkin.ToGRPCRequest(newSpan)(ctx, md)
208
209 for header, wantInt := range map[string]int64{
210 "x-b3-traceid": traceID,
211 "x-b3-spanid": spanID,
212 "x-b3-parentspanid": parentSpanID,
213 } {
214 if want, have := strconv.FormatInt(wantInt, 16), (*md)[header][0]; want != have {
215 t.Errorf("%s: want %q, have %q", header, want, have)
216 }
217 }
218 if want, have := sampled, (*md)["x-b3-sampled"][0]; want != have {
219 t.Errorf("x-b3-sampled: want %q, have %q", want, have)
220 }
221
222 }
223
224 func TestAnnotateServer(t *testing.T) {
225 if err := testAnnotate(zipkin.AnnotateServer, zipkin.ServerReceive, zipkin.ServerSend); err != nil {
226 t.Fatal(err)
227 }
228 }
229
230 func TestAnnotateClient(t *testing.T) {
231 if err := testAnnotate(zipkin.AnnotateClient, zipkin.ClientSend, zipkin.ClientReceive); err != nil {
232 t.Fatal(err)
233 }
234 }
235
236 func testAnnotate(
237 annotate func(newSpan zipkin.NewSpanFunc, c zipkin.Collector) endpoint.Middleware,
238 wantAnnotations ...string,
239 ) error {
240 const (
241 hostport = "1.2.3.4:1234"
242 serviceName = "some-service"
243 methodName = "some-method"
244 )
245
246 newSpan := zipkin.MakeNewSpanFunc(hostport, serviceName, methodName)
247 collector := &countingCollector{}
248
249 var e endpoint.Endpoint
250 e = func(context.Context, interface{}) (interface{}, error) { return struct{}{}, nil }
251 e = annotate(newSpan, collector)(e)
252
253 if want, have := 0, len(collector.annotations); want != have {
254 return fmt.Errorf("pre-invocation: want %d, have %d", want, have)
255 }
256 if _, err := e(context.Background(), struct{}{}); err != nil {
257 return fmt.Errorf("during invocation: %v", err)
258 }
259 if want, have := wantAnnotations, collector.annotations; !reflect.DeepEqual(want, have) {
260 return fmt.Errorf("after invocation: want %v, have %v", want, have)
261 }
262
263 return nil
264 }
265
266 type countingCollector struct{ annotations []string }
267
268 func (c *countingCollector) Collect(s *zipkin.Span) error {
269 for _, annotation := range s.Encode().GetAnnotations() {
270 c.annotations = append(c.annotations, annotation.GetValue())
271 }
272 return nil
273 }
274
275 func (c *countingCollector) ShouldSample(s *zipkin.Span) bool {
276 return true
277 }
278
279 func (c *countingCollector) Close() error {
280 return nil
281 }