blob: d55cca0241e7f52d0acf350ce332aba7681c663c [file] [log] [blame]
khenaidood948f772021-08-11 17:49:24 -04001// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT.
2
3package jaeger
4
5import(
6 "bytes"
7 "context"
8 "database/sql/driver"
9 "errors"
10 "fmt"
11 "time"
12 "github.com/uber/jaeger-client-go/thrift"
13)
14
15// (needed to ensure safety because of naive import list construction.)
16var _ = thrift.ZERO
17var _ = fmt.Printf
18var _ = context.Background
19var _ = time.Now
20var _ = bytes.Equal
21
22type TagType int64
23const (
24 TagType_STRING TagType = 0
25 TagType_DOUBLE TagType = 1
26 TagType_BOOL TagType = 2
27 TagType_LONG TagType = 3
28 TagType_BINARY TagType = 4
29)
30
31func (p TagType) String() string {
32 switch p {
33 case TagType_STRING: return "STRING"
34 case TagType_DOUBLE: return "DOUBLE"
35 case TagType_BOOL: return "BOOL"
36 case TagType_LONG: return "LONG"
37 case TagType_BINARY: return "BINARY"
38 }
39 return "<UNSET>"
40}
41
42func TagTypeFromString(s string) (TagType, error) {
43 switch s {
44 case "STRING": return TagType_STRING, nil
45 case "DOUBLE": return TagType_DOUBLE, nil
46 case "BOOL": return TagType_BOOL, nil
47 case "LONG": return TagType_LONG, nil
48 case "BINARY": return TagType_BINARY, nil
49 }
50 return TagType(0), fmt.Errorf("not a valid TagType string")
51}
52
53
54func TagTypePtr(v TagType) *TagType { return &v }
55
56func (p TagType) MarshalText() ([]byte, error) {
57return []byte(p.String()), nil
58}
59
60func (p *TagType) UnmarshalText(text []byte) error {
61q, err := TagTypeFromString(string(text))
62if (err != nil) {
63return err
64}
65*p = q
66return nil
67}
68
69func (p *TagType) Scan(value interface{}) error {
70v, ok := value.(int64)
71if !ok {
72return errors.New("Scan value is not int64")
73}
74*p = TagType(v)
75return nil
76}
77
78func (p * TagType) Value() (driver.Value, error) {
79 if p == nil {
80 return nil, nil
81 }
82return int64(*p), nil
83}
84type SpanRefType int64
85const (
86 SpanRefType_CHILD_OF SpanRefType = 0
87 SpanRefType_FOLLOWS_FROM SpanRefType = 1
88)
89
90func (p SpanRefType) String() string {
91 switch p {
92 case SpanRefType_CHILD_OF: return "CHILD_OF"
93 case SpanRefType_FOLLOWS_FROM: return "FOLLOWS_FROM"
94 }
95 return "<UNSET>"
96}
97
98func SpanRefTypeFromString(s string) (SpanRefType, error) {
99 switch s {
100 case "CHILD_OF": return SpanRefType_CHILD_OF, nil
101 case "FOLLOWS_FROM": return SpanRefType_FOLLOWS_FROM, nil
102 }
103 return SpanRefType(0), fmt.Errorf("not a valid SpanRefType string")
104}
105
106
107func SpanRefTypePtr(v SpanRefType) *SpanRefType { return &v }
108
109func (p SpanRefType) MarshalText() ([]byte, error) {
110return []byte(p.String()), nil
111}
112
113func (p *SpanRefType) UnmarshalText(text []byte) error {
114q, err := SpanRefTypeFromString(string(text))
115if (err != nil) {
116return err
117}
118*p = q
119return nil
120}
121
122func (p *SpanRefType) Scan(value interface{}) error {
123v, ok := value.(int64)
124if !ok {
125return errors.New("Scan value is not int64")
126}
127*p = SpanRefType(v)
128return nil
129}
130
131func (p * SpanRefType) Value() (driver.Value, error) {
132 if p == nil {
133 return nil, nil
134 }
135return int64(*p), nil
136}
137// Attributes:
138// - Key
139// - VType
140// - VStr
141// - VDouble
142// - VBool
143// - VLong
144// - VBinary
145type Tag struct {
146 Key string `thrift:"key,1,required" db:"key" json:"key"`
147 VType TagType `thrift:"vType,2,required" db:"vType" json:"vType"`
148 VStr *string `thrift:"vStr,3" db:"vStr" json:"vStr,omitempty"`
149 VDouble *float64 `thrift:"vDouble,4" db:"vDouble" json:"vDouble,omitempty"`
150 VBool *bool `thrift:"vBool,5" db:"vBool" json:"vBool,omitempty"`
151 VLong *int64 `thrift:"vLong,6" db:"vLong" json:"vLong,omitempty"`
152 VBinary []byte `thrift:"vBinary,7" db:"vBinary" json:"vBinary,omitempty"`
153}
154
155func NewTag() *Tag {
156 return &Tag{}
157}
158
159
160func (p *Tag) GetKey() string {
161 return p.Key
162}
163
164func (p *Tag) GetVType() TagType {
165 return p.VType
166}
167var Tag_VStr_DEFAULT string
168func (p *Tag) GetVStr() string {
169 if !p.IsSetVStr() {
170 return Tag_VStr_DEFAULT
171 }
172return *p.VStr
173}
174var Tag_VDouble_DEFAULT float64
175func (p *Tag) GetVDouble() float64 {
176 if !p.IsSetVDouble() {
177 return Tag_VDouble_DEFAULT
178 }
179return *p.VDouble
180}
181var Tag_VBool_DEFAULT bool
182func (p *Tag) GetVBool() bool {
183 if !p.IsSetVBool() {
184 return Tag_VBool_DEFAULT
185 }
186return *p.VBool
187}
188var Tag_VLong_DEFAULT int64
189func (p *Tag) GetVLong() int64 {
190 if !p.IsSetVLong() {
191 return Tag_VLong_DEFAULT
192 }
193return *p.VLong
194}
195var Tag_VBinary_DEFAULT []byte
196
197func (p *Tag) GetVBinary() []byte {
198 return p.VBinary
199}
200func (p *Tag) IsSetVStr() bool {
201 return p.VStr != nil
202}
203
204func (p *Tag) IsSetVDouble() bool {
205 return p.VDouble != nil
206}
207
208func (p *Tag) IsSetVBool() bool {
209 return p.VBool != nil
210}
211
212func (p *Tag) IsSetVLong() bool {
213 return p.VLong != nil
214}
215
216func (p *Tag) IsSetVBinary() bool {
217 return p.VBinary != nil
218}
219
220func (p *Tag) Read(ctx context.Context, iprot thrift.TProtocol) error {
221 if _, err := iprot.ReadStructBegin(ctx); err != nil {
222 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
223 }
224
225 var issetKey bool = false;
226 var issetVType bool = false;
227
228 for {
229 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
230 if err != nil {
231 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
232 }
233 if fieldTypeId == thrift.STOP { break; }
234 switch fieldId {
235 case 1:
236 if fieldTypeId == thrift.STRING {
237 if err := p.ReadField1(ctx, iprot); err != nil {
238 return err
239 }
240 issetKey = true
241 } else {
242 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
243 return err
244 }
245 }
246 case 2:
247 if fieldTypeId == thrift.I32 {
248 if err := p.ReadField2(ctx, iprot); err != nil {
249 return err
250 }
251 issetVType = true
252 } else {
253 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
254 return err
255 }
256 }
257 case 3:
258 if fieldTypeId == thrift.STRING {
259 if err := p.ReadField3(ctx, iprot); err != nil {
260 return err
261 }
262 } else {
263 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
264 return err
265 }
266 }
267 case 4:
268 if fieldTypeId == thrift.DOUBLE {
269 if err := p.ReadField4(ctx, iprot); err != nil {
270 return err
271 }
272 } else {
273 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
274 return err
275 }
276 }
277 case 5:
278 if fieldTypeId == thrift.BOOL {
279 if err := p.ReadField5(ctx, iprot); err != nil {
280 return err
281 }
282 } else {
283 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
284 return err
285 }
286 }
287 case 6:
288 if fieldTypeId == thrift.I64 {
289 if err := p.ReadField6(ctx, iprot); err != nil {
290 return err
291 }
292 } else {
293 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
294 return err
295 }
296 }
297 case 7:
298 if fieldTypeId == thrift.STRING {
299 if err := p.ReadField7(ctx, iprot); err != nil {
300 return err
301 }
302 } else {
303 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
304 return err
305 }
306 }
307 default:
308 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
309 return err
310 }
311 }
312 if err := iprot.ReadFieldEnd(ctx); err != nil {
313 return err
314 }
315 }
316 if err := iprot.ReadStructEnd(ctx); err != nil {
317 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
318 }
319 if !issetKey{
320 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Key is not set"));
321 }
322 if !issetVType{
323 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field VType is not set"));
324 }
325 return nil
326}
327
328func (p *Tag) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
329 if v, err := iprot.ReadString(ctx); err != nil {
330 return thrift.PrependError("error reading field 1: ", err)
331} else {
332 p.Key = v
333}
334 return nil
335}
336
337func (p *Tag) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
338 if v, err := iprot.ReadI32(ctx); err != nil {
339 return thrift.PrependError("error reading field 2: ", err)
340} else {
341 temp := TagType(v)
342 p.VType = temp
343}
344 return nil
345}
346
347func (p *Tag) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
348 if v, err := iprot.ReadString(ctx); err != nil {
349 return thrift.PrependError("error reading field 3: ", err)
350} else {
351 p.VStr = &v
352}
353 return nil
354}
355
356func (p *Tag) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
357 if v, err := iprot.ReadDouble(ctx); err != nil {
358 return thrift.PrependError("error reading field 4: ", err)
359} else {
360 p.VDouble = &v
361}
362 return nil
363}
364
365func (p *Tag) ReadField5(ctx context.Context, iprot thrift.TProtocol) error {
366 if v, err := iprot.ReadBool(ctx); err != nil {
367 return thrift.PrependError("error reading field 5: ", err)
368} else {
369 p.VBool = &v
370}
371 return nil
372}
373
374func (p *Tag) ReadField6(ctx context.Context, iprot thrift.TProtocol) error {
375 if v, err := iprot.ReadI64(ctx); err != nil {
376 return thrift.PrependError("error reading field 6: ", err)
377} else {
378 p.VLong = &v
379}
380 return nil
381}
382
383func (p *Tag) ReadField7(ctx context.Context, iprot thrift.TProtocol) error {
384 if v, err := iprot.ReadBinary(ctx); err != nil {
385 return thrift.PrependError("error reading field 7: ", err)
386} else {
387 p.VBinary = v
388}
389 return nil
390}
391
392func (p *Tag) Write(ctx context.Context, oprot thrift.TProtocol) error {
393 if err := oprot.WriteStructBegin(ctx, "Tag"); err != nil {
394 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
395 if p != nil {
396 if err := p.writeField1(ctx, oprot); err != nil { return err }
397 if err := p.writeField2(ctx, oprot); err != nil { return err }
398 if err := p.writeField3(ctx, oprot); err != nil { return err }
399 if err := p.writeField4(ctx, oprot); err != nil { return err }
400 if err := p.writeField5(ctx, oprot); err != nil { return err }
401 if err := p.writeField6(ctx, oprot); err != nil { return err }
402 if err := p.writeField7(ctx, oprot); err != nil { return err }
403 }
404 if err := oprot.WriteFieldStop(ctx); err != nil {
405 return thrift.PrependError("write field stop error: ", err) }
406 if err := oprot.WriteStructEnd(ctx); err != nil {
407 return thrift.PrependError("write struct stop error: ", err) }
408 return nil
409}
410
411func (p *Tag) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
412 if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRING, 1); err != nil {
413 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) }
414 if err := oprot.WriteString(ctx, string(p.Key)); err != nil {
415 return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err) }
416 if err := oprot.WriteFieldEnd(ctx); err != nil {
417 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) }
418 return err
419}
420
421func (p *Tag) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
422 if err := oprot.WriteFieldBegin(ctx, "vType", thrift.I32, 2); err != nil {
423 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:vType: ", p), err) }
424 if err := oprot.WriteI32(ctx, int32(p.VType)); err != nil {
425 return thrift.PrependError(fmt.Sprintf("%T.vType (2) field write error: ", p), err) }
426 if err := oprot.WriteFieldEnd(ctx); err != nil {
427 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:vType: ", p), err) }
428 return err
429}
430
431func (p *Tag) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) {
432 if p.IsSetVStr() {
433 if err := oprot.WriteFieldBegin(ctx, "vStr", thrift.STRING, 3); err != nil {
434 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:vStr: ", p), err) }
435 if err := oprot.WriteString(ctx, string(*p.VStr)); err != nil {
436 return thrift.PrependError(fmt.Sprintf("%T.vStr (3) field write error: ", p), err) }
437 if err := oprot.WriteFieldEnd(ctx); err != nil {
438 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:vStr: ", p), err) }
439 }
440 return err
441}
442
443func (p *Tag) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) {
444 if p.IsSetVDouble() {
445 if err := oprot.WriteFieldBegin(ctx, "vDouble", thrift.DOUBLE, 4); err != nil {
446 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:vDouble: ", p), err) }
447 if err := oprot.WriteDouble(ctx, float64(*p.VDouble)); err != nil {
448 return thrift.PrependError(fmt.Sprintf("%T.vDouble (4) field write error: ", p), err) }
449 if err := oprot.WriteFieldEnd(ctx); err != nil {
450 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:vDouble: ", p), err) }
451 }
452 return err
453}
454
455func (p *Tag) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) {
456 if p.IsSetVBool() {
457 if err := oprot.WriteFieldBegin(ctx, "vBool", thrift.BOOL, 5); err != nil {
458 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:vBool: ", p), err) }
459 if err := oprot.WriteBool(ctx, bool(*p.VBool)); err != nil {
460 return thrift.PrependError(fmt.Sprintf("%T.vBool (5) field write error: ", p), err) }
461 if err := oprot.WriteFieldEnd(ctx); err != nil {
462 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:vBool: ", p), err) }
463 }
464 return err
465}
466
467func (p *Tag) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) {
468 if p.IsSetVLong() {
469 if err := oprot.WriteFieldBegin(ctx, "vLong", thrift.I64, 6); err != nil {
470 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:vLong: ", p), err) }
471 if err := oprot.WriteI64(ctx, int64(*p.VLong)); err != nil {
472 return thrift.PrependError(fmt.Sprintf("%T.vLong (6) field write error: ", p), err) }
473 if err := oprot.WriteFieldEnd(ctx); err != nil {
474 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:vLong: ", p), err) }
475 }
476 return err
477}
478
479func (p *Tag) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) {
480 if p.IsSetVBinary() {
481 if err := oprot.WriteFieldBegin(ctx, "vBinary", thrift.STRING, 7); err != nil {
482 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:vBinary: ", p), err) }
483 if err := oprot.WriteBinary(ctx, p.VBinary); err != nil {
484 return thrift.PrependError(fmt.Sprintf("%T.vBinary (7) field write error: ", p), err) }
485 if err := oprot.WriteFieldEnd(ctx); err != nil {
486 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:vBinary: ", p), err) }
487 }
488 return err
489}
490
491func (p *Tag) Equals(other *Tag) bool {
492 if p == other {
493 return true
494 } else if p == nil || other == nil {
495 return false
496 }
497 if p.Key != other.Key { return false }
498 if p.VType != other.VType { return false }
499 if p.VStr != other.VStr {
500 if p.VStr == nil || other.VStr == nil {
501 return false
502 }
503 if (*p.VStr) != (*other.VStr) { return false }
504 }
505 if p.VDouble != other.VDouble {
506 if p.VDouble == nil || other.VDouble == nil {
507 return false
508 }
509 if (*p.VDouble) != (*other.VDouble) { return false }
510 }
511 if p.VBool != other.VBool {
512 if p.VBool == nil || other.VBool == nil {
513 return false
514 }
515 if (*p.VBool) != (*other.VBool) { return false }
516 }
517 if p.VLong != other.VLong {
518 if p.VLong == nil || other.VLong == nil {
519 return false
520 }
521 if (*p.VLong) != (*other.VLong) { return false }
522 }
523 if bytes.Compare(p.VBinary, other.VBinary) != 0 { return false }
524 return true
525}
526
527func (p *Tag) String() string {
528 if p == nil {
529 return "<nil>"
530 }
531 return fmt.Sprintf("Tag(%+v)", *p)
532}
533
534// Attributes:
535// - Timestamp
536// - Fields
537type Log struct {
538 Timestamp int64 `thrift:"timestamp,1,required" db:"timestamp" json:"timestamp"`
539 Fields []*Tag `thrift:"fields,2,required" db:"fields" json:"fields"`
540}
541
542func NewLog() *Log {
543 return &Log{}
544}
545
546
547func (p *Log) GetTimestamp() int64 {
548 return p.Timestamp
549}
550
551func (p *Log) GetFields() []*Tag {
552 return p.Fields
553}
554func (p *Log) Read(ctx context.Context, iprot thrift.TProtocol) error {
555 if _, err := iprot.ReadStructBegin(ctx); err != nil {
556 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
557 }
558
559 var issetTimestamp bool = false;
560 var issetFields bool = false;
561
562 for {
563 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
564 if err != nil {
565 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
566 }
567 if fieldTypeId == thrift.STOP { break; }
568 switch fieldId {
569 case 1:
570 if fieldTypeId == thrift.I64 {
571 if err := p.ReadField1(ctx, iprot); err != nil {
572 return err
573 }
574 issetTimestamp = true
575 } else {
576 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
577 return err
578 }
579 }
580 case 2:
581 if fieldTypeId == thrift.LIST {
582 if err := p.ReadField2(ctx, iprot); err != nil {
583 return err
584 }
585 issetFields = true
586 } else {
587 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
588 return err
589 }
590 }
591 default:
592 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
593 return err
594 }
595 }
596 if err := iprot.ReadFieldEnd(ctx); err != nil {
597 return err
598 }
599 }
600 if err := iprot.ReadStructEnd(ctx); err != nil {
601 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
602 }
603 if !issetTimestamp{
604 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Timestamp is not set"));
605 }
606 if !issetFields{
607 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Fields is not set"));
608 }
609 return nil
610}
611
612func (p *Log) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
613 if v, err := iprot.ReadI64(ctx); err != nil {
614 return thrift.PrependError("error reading field 1: ", err)
615} else {
616 p.Timestamp = v
617}
618 return nil
619}
620
621func (p *Log) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
622 _, size, err := iprot.ReadListBegin(ctx)
623 if err != nil {
624 return thrift.PrependError("error reading list begin: ", err)
625 }
626 tSlice := make([]*Tag, 0, size)
627 p.Fields = tSlice
628 for i := 0; i < size; i ++ {
629 _elem0 := &Tag{}
630 if err := _elem0.Read(ctx, iprot); err != nil {
631 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem0), err)
632 }
633 p.Fields = append(p.Fields, _elem0)
634 }
635 if err := iprot.ReadListEnd(ctx); err != nil {
636 return thrift.PrependError("error reading list end: ", err)
637 }
638 return nil
639}
640
641func (p *Log) Write(ctx context.Context, oprot thrift.TProtocol) error {
642 if err := oprot.WriteStructBegin(ctx, "Log"); err != nil {
643 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
644 if p != nil {
645 if err := p.writeField1(ctx, oprot); err != nil { return err }
646 if err := p.writeField2(ctx, oprot); err != nil { return err }
647 }
648 if err := oprot.WriteFieldStop(ctx); err != nil {
649 return thrift.PrependError("write field stop error: ", err) }
650 if err := oprot.WriteStructEnd(ctx); err != nil {
651 return thrift.PrependError("write struct stop error: ", err) }
652 return nil
653}
654
655func (p *Log) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
656 if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 1); err != nil {
657 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:timestamp: ", p), err) }
658 if err := oprot.WriteI64(ctx, int64(p.Timestamp)); err != nil {
659 return thrift.PrependError(fmt.Sprintf("%T.timestamp (1) field write error: ", p), err) }
660 if err := oprot.WriteFieldEnd(ctx); err != nil {
661 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:timestamp: ", p), err) }
662 return err
663}
664
665func (p *Log) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
666 if err := oprot.WriteFieldBegin(ctx, "fields", thrift.LIST, 2); err != nil {
667 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:fields: ", p), err) }
668 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Fields)); err != nil {
669 return thrift.PrependError("error writing list begin: ", err)
670 }
671 for _, v := range p.Fields {
672 if err := v.Write(ctx, oprot); err != nil {
673 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
674 }
675 }
676 if err := oprot.WriteListEnd(ctx); err != nil {
677 return thrift.PrependError("error writing list end: ", err)
678 }
679 if err := oprot.WriteFieldEnd(ctx); err != nil {
680 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:fields: ", p), err) }
681 return err
682}
683
684func (p *Log) Equals(other *Log) bool {
685 if p == other {
686 return true
687 } else if p == nil || other == nil {
688 return false
689 }
690 if p.Timestamp != other.Timestamp { return false }
691 if len(p.Fields) != len(other.Fields) { return false }
692 for i, _tgt := range p.Fields {
693 _src1 := other.Fields[i]
694 if !_tgt.Equals(_src1) { return false }
695 }
696 return true
697}
698
699func (p *Log) String() string {
700 if p == nil {
701 return "<nil>"
702 }
703 return fmt.Sprintf("Log(%+v)", *p)
704}
705
706// Attributes:
707// - RefType
708// - TraceIdLow
709// - TraceIdHigh
710// - SpanId
711type SpanRef struct {
712 RefType SpanRefType `thrift:"refType,1,required" db:"refType" json:"refType"`
713 TraceIdLow int64 `thrift:"traceIdLow,2,required" db:"traceIdLow" json:"traceIdLow"`
714 TraceIdHigh int64 `thrift:"traceIdHigh,3,required" db:"traceIdHigh" json:"traceIdHigh"`
715 SpanId int64 `thrift:"spanId,4,required" db:"spanId" json:"spanId"`
716}
717
718func NewSpanRef() *SpanRef {
719 return &SpanRef{}
720}
721
722
723func (p *SpanRef) GetRefType() SpanRefType {
724 return p.RefType
725}
726
727func (p *SpanRef) GetTraceIdLow() int64 {
728 return p.TraceIdLow
729}
730
731func (p *SpanRef) GetTraceIdHigh() int64 {
732 return p.TraceIdHigh
733}
734
735func (p *SpanRef) GetSpanId() int64 {
736 return p.SpanId
737}
738func (p *SpanRef) Read(ctx context.Context, iprot thrift.TProtocol) error {
739 if _, err := iprot.ReadStructBegin(ctx); err != nil {
740 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
741 }
742
743 var issetRefType bool = false;
744 var issetTraceIdLow bool = false;
745 var issetTraceIdHigh bool = false;
746 var issetSpanId bool = false;
747
748 for {
749 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
750 if err != nil {
751 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
752 }
753 if fieldTypeId == thrift.STOP { break; }
754 switch fieldId {
755 case 1:
756 if fieldTypeId == thrift.I32 {
757 if err := p.ReadField1(ctx, iprot); err != nil {
758 return err
759 }
760 issetRefType = true
761 } else {
762 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
763 return err
764 }
765 }
766 case 2:
767 if fieldTypeId == thrift.I64 {
768 if err := p.ReadField2(ctx, iprot); err != nil {
769 return err
770 }
771 issetTraceIdLow = true
772 } else {
773 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
774 return err
775 }
776 }
777 case 3:
778 if fieldTypeId == thrift.I64 {
779 if err := p.ReadField3(ctx, iprot); err != nil {
780 return err
781 }
782 issetTraceIdHigh = true
783 } else {
784 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
785 return err
786 }
787 }
788 case 4:
789 if fieldTypeId == thrift.I64 {
790 if err := p.ReadField4(ctx, iprot); err != nil {
791 return err
792 }
793 issetSpanId = true
794 } else {
795 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
796 return err
797 }
798 }
799 default:
800 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
801 return err
802 }
803 }
804 if err := iprot.ReadFieldEnd(ctx); err != nil {
805 return err
806 }
807 }
808 if err := iprot.ReadStructEnd(ctx); err != nil {
809 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
810 }
811 if !issetRefType{
812 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field RefType is not set"));
813 }
814 if !issetTraceIdLow{
815 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdLow is not set"));
816 }
817 if !issetTraceIdHigh{
818 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdHigh is not set"));
819 }
820 if !issetSpanId{
821 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SpanId is not set"));
822 }
823 return nil
824}
825
826func (p *SpanRef) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
827 if v, err := iprot.ReadI32(ctx); err != nil {
828 return thrift.PrependError("error reading field 1: ", err)
829} else {
830 temp := SpanRefType(v)
831 p.RefType = temp
832}
833 return nil
834}
835
836func (p *SpanRef) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
837 if v, err := iprot.ReadI64(ctx); err != nil {
838 return thrift.PrependError("error reading field 2: ", err)
839} else {
840 p.TraceIdLow = v
841}
842 return nil
843}
844
845func (p *SpanRef) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
846 if v, err := iprot.ReadI64(ctx); err != nil {
847 return thrift.PrependError("error reading field 3: ", err)
848} else {
849 p.TraceIdHigh = v
850}
851 return nil
852}
853
854func (p *SpanRef) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
855 if v, err := iprot.ReadI64(ctx); err != nil {
856 return thrift.PrependError("error reading field 4: ", err)
857} else {
858 p.SpanId = v
859}
860 return nil
861}
862
863func (p *SpanRef) Write(ctx context.Context, oprot thrift.TProtocol) error {
864 if err := oprot.WriteStructBegin(ctx, "SpanRef"); err != nil {
865 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
866 if p != nil {
867 if err := p.writeField1(ctx, oprot); err != nil { return err }
868 if err := p.writeField2(ctx, oprot); err != nil { return err }
869 if err := p.writeField3(ctx, oprot); err != nil { return err }
870 if err := p.writeField4(ctx, oprot); err != nil { return err }
871 }
872 if err := oprot.WriteFieldStop(ctx); err != nil {
873 return thrift.PrependError("write field stop error: ", err) }
874 if err := oprot.WriteStructEnd(ctx); err != nil {
875 return thrift.PrependError("write struct stop error: ", err) }
876 return nil
877}
878
879func (p *SpanRef) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
880 if err := oprot.WriteFieldBegin(ctx, "refType", thrift.I32, 1); err != nil {
881 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:refType: ", p), err) }
882 if err := oprot.WriteI32(ctx, int32(p.RefType)); err != nil {
883 return thrift.PrependError(fmt.Sprintf("%T.refType (1) field write error: ", p), err) }
884 if err := oprot.WriteFieldEnd(ctx); err != nil {
885 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:refType: ", p), err) }
886 return err
887}
888
889func (p *SpanRef) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
890 if err := oprot.WriteFieldBegin(ctx, "traceIdLow", thrift.I64, 2); err != nil {
891 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:traceIdLow: ", p), err) }
892 if err := oprot.WriteI64(ctx, int64(p.TraceIdLow)); err != nil {
893 return thrift.PrependError(fmt.Sprintf("%T.traceIdLow (2) field write error: ", p), err) }
894 if err := oprot.WriteFieldEnd(ctx); err != nil {
895 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:traceIdLow: ", p), err) }
896 return err
897}
898
899func (p *SpanRef) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) {
900 if err := oprot.WriteFieldBegin(ctx, "traceIdHigh", thrift.I64, 3); err != nil {
901 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:traceIdHigh: ", p), err) }
902 if err := oprot.WriteI64(ctx, int64(p.TraceIdHigh)); err != nil {
903 return thrift.PrependError(fmt.Sprintf("%T.traceIdHigh (3) field write error: ", p), err) }
904 if err := oprot.WriteFieldEnd(ctx); err != nil {
905 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:traceIdHigh: ", p), err) }
906 return err
907}
908
909func (p *SpanRef) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) {
910 if err := oprot.WriteFieldBegin(ctx, "spanId", thrift.I64, 4); err != nil {
911 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:spanId: ", p), err) }
912 if err := oprot.WriteI64(ctx, int64(p.SpanId)); err != nil {
913 return thrift.PrependError(fmt.Sprintf("%T.spanId (4) field write error: ", p), err) }
914 if err := oprot.WriteFieldEnd(ctx); err != nil {
915 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:spanId: ", p), err) }
916 return err
917}
918
919func (p *SpanRef) Equals(other *SpanRef) bool {
920 if p == other {
921 return true
922 } else if p == nil || other == nil {
923 return false
924 }
925 if p.RefType != other.RefType { return false }
926 if p.TraceIdLow != other.TraceIdLow { return false }
927 if p.TraceIdHigh != other.TraceIdHigh { return false }
928 if p.SpanId != other.SpanId { return false }
929 return true
930}
931
932func (p *SpanRef) String() string {
933 if p == nil {
934 return "<nil>"
935 }
936 return fmt.Sprintf("SpanRef(%+v)", *p)
937}
938
939// Attributes:
940// - TraceIdLow
941// - TraceIdHigh
942// - SpanId
943// - ParentSpanId
944// - OperationName
945// - References
946// - Flags
947// - StartTime
948// - Duration
949// - Tags
950// - Logs
951type Span struct {
952 TraceIdLow int64 `thrift:"traceIdLow,1,required" db:"traceIdLow" json:"traceIdLow"`
953 TraceIdHigh int64 `thrift:"traceIdHigh,2,required" db:"traceIdHigh" json:"traceIdHigh"`
954 SpanId int64 `thrift:"spanId,3,required" db:"spanId" json:"spanId"`
955 ParentSpanId int64 `thrift:"parentSpanId,4,required" db:"parentSpanId" json:"parentSpanId"`
956 OperationName string `thrift:"operationName,5,required" db:"operationName" json:"operationName"`
957 References []*SpanRef `thrift:"references,6" db:"references" json:"references,omitempty"`
958 Flags int32 `thrift:"flags,7,required" db:"flags" json:"flags"`
959 StartTime int64 `thrift:"startTime,8,required" db:"startTime" json:"startTime"`
960 Duration int64 `thrift:"duration,9,required" db:"duration" json:"duration"`
961 Tags []*Tag `thrift:"tags,10" db:"tags" json:"tags,omitempty"`
962 Logs []*Log `thrift:"logs,11" db:"logs" json:"logs,omitempty"`
963}
964
965func NewSpan() *Span {
966 return &Span{}
967}
968
969
970func (p *Span) GetTraceIdLow() int64 {
971 return p.TraceIdLow
972}
973
974func (p *Span) GetTraceIdHigh() int64 {
975 return p.TraceIdHigh
976}
977
978func (p *Span) GetSpanId() int64 {
979 return p.SpanId
980}
981
982func (p *Span) GetParentSpanId() int64 {
983 return p.ParentSpanId
984}
985
986func (p *Span) GetOperationName() string {
987 return p.OperationName
988}
989var Span_References_DEFAULT []*SpanRef
990
991func (p *Span) GetReferences() []*SpanRef {
992 return p.References
993}
994
995func (p *Span) GetFlags() int32 {
996 return p.Flags
997}
998
999func (p *Span) GetStartTime() int64 {
1000 return p.StartTime
1001}
1002
1003func (p *Span) GetDuration() int64 {
1004 return p.Duration
1005}
1006var Span_Tags_DEFAULT []*Tag
1007
1008func (p *Span) GetTags() []*Tag {
1009 return p.Tags
1010}
1011var Span_Logs_DEFAULT []*Log
1012
1013func (p *Span) GetLogs() []*Log {
1014 return p.Logs
1015}
1016func (p *Span) IsSetReferences() bool {
1017 return p.References != nil
1018}
1019
1020func (p *Span) IsSetTags() bool {
1021 return p.Tags != nil
1022}
1023
1024func (p *Span) IsSetLogs() bool {
1025 return p.Logs != nil
1026}
1027
1028func (p *Span) Read(ctx context.Context, iprot thrift.TProtocol) error {
1029 if _, err := iprot.ReadStructBegin(ctx); err != nil {
1030 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
1031 }
1032
1033 var issetTraceIdLow bool = false;
1034 var issetTraceIdHigh bool = false;
1035 var issetSpanId bool = false;
1036 var issetParentSpanId bool = false;
1037 var issetOperationName bool = false;
1038 var issetFlags bool = false;
1039 var issetStartTime bool = false;
1040 var issetDuration bool = false;
1041
1042 for {
1043 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
1044 if err != nil {
1045 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
1046 }
1047 if fieldTypeId == thrift.STOP { break; }
1048 switch fieldId {
1049 case 1:
1050 if fieldTypeId == thrift.I64 {
1051 if err := p.ReadField1(ctx, iprot); err != nil {
1052 return err
1053 }
1054 issetTraceIdLow = true
1055 } else {
1056 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1057 return err
1058 }
1059 }
1060 case 2:
1061 if fieldTypeId == thrift.I64 {
1062 if err := p.ReadField2(ctx, iprot); err != nil {
1063 return err
1064 }
1065 issetTraceIdHigh = true
1066 } else {
1067 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1068 return err
1069 }
1070 }
1071 case 3:
1072 if fieldTypeId == thrift.I64 {
1073 if err := p.ReadField3(ctx, iprot); err != nil {
1074 return err
1075 }
1076 issetSpanId = true
1077 } else {
1078 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1079 return err
1080 }
1081 }
1082 case 4:
1083 if fieldTypeId == thrift.I64 {
1084 if err := p.ReadField4(ctx, iprot); err != nil {
1085 return err
1086 }
1087 issetParentSpanId = true
1088 } else {
1089 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1090 return err
1091 }
1092 }
1093 case 5:
1094 if fieldTypeId == thrift.STRING {
1095 if err := p.ReadField5(ctx, iprot); err != nil {
1096 return err
1097 }
1098 issetOperationName = true
1099 } else {
1100 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1101 return err
1102 }
1103 }
1104 case 6:
1105 if fieldTypeId == thrift.LIST {
1106 if err := p.ReadField6(ctx, iprot); err != nil {
1107 return err
1108 }
1109 } else {
1110 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1111 return err
1112 }
1113 }
1114 case 7:
1115 if fieldTypeId == thrift.I32 {
1116 if err := p.ReadField7(ctx, iprot); err != nil {
1117 return err
1118 }
1119 issetFlags = true
1120 } else {
1121 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1122 return err
1123 }
1124 }
1125 case 8:
1126 if fieldTypeId == thrift.I64 {
1127 if err := p.ReadField8(ctx, iprot); err != nil {
1128 return err
1129 }
1130 issetStartTime = true
1131 } else {
1132 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1133 return err
1134 }
1135 }
1136 case 9:
1137 if fieldTypeId == thrift.I64 {
1138 if err := p.ReadField9(ctx, iprot); err != nil {
1139 return err
1140 }
1141 issetDuration = true
1142 } else {
1143 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1144 return err
1145 }
1146 }
1147 case 10:
1148 if fieldTypeId == thrift.LIST {
1149 if err := p.ReadField10(ctx, iprot); err != nil {
1150 return err
1151 }
1152 } else {
1153 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1154 return err
1155 }
1156 }
1157 case 11:
1158 if fieldTypeId == thrift.LIST {
1159 if err := p.ReadField11(ctx, iprot); err != nil {
1160 return err
1161 }
1162 } else {
1163 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1164 return err
1165 }
1166 }
1167 default:
1168 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1169 return err
1170 }
1171 }
1172 if err := iprot.ReadFieldEnd(ctx); err != nil {
1173 return err
1174 }
1175 }
1176 if err := iprot.ReadStructEnd(ctx); err != nil {
1177 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
1178 }
1179 if !issetTraceIdLow{
1180 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdLow is not set"));
1181 }
1182 if !issetTraceIdHigh{
1183 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdHigh is not set"));
1184 }
1185 if !issetSpanId{
1186 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SpanId is not set"));
1187 }
1188 if !issetParentSpanId{
1189 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ParentSpanId is not set"));
1190 }
1191 if !issetOperationName{
1192 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field OperationName is not set"));
1193 }
1194 if !issetFlags{
1195 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Flags is not set"));
1196 }
1197 if !issetStartTime{
1198 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StartTime is not set"));
1199 }
1200 if !issetDuration{
1201 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Duration is not set"));
1202 }
1203 return nil
1204}
1205
1206func (p *Span) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
1207 if v, err := iprot.ReadI64(ctx); err != nil {
1208 return thrift.PrependError("error reading field 1: ", err)
1209} else {
1210 p.TraceIdLow = v
1211}
1212 return nil
1213}
1214
1215func (p *Span) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
1216 if v, err := iprot.ReadI64(ctx); err != nil {
1217 return thrift.PrependError("error reading field 2: ", err)
1218} else {
1219 p.TraceIdHigh = v
1220}
1221 return nil
1222}
1223
1224func (p *Span) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
1225 if v, err := iprot.ReadI64(ctx); err != nil {
1226 return thrift.PrependError("error reading field 3: ", err)
1227} else {
1228 p.SpanId = v
1229}
1230 return nil
1231}
1232
1233func (p *Span) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
1234 if v, err := iprot.ReadI64(ctx); err != nil {
1235 return thrift.PrependError("error reading field 4: ", err)
1236} else {
1237 p.ParentSpanId = v
1238}
1239 return nil
1240}
1241
1242func (p *Span) ReadField5(ctx context.Context, iprot thrift.TProtocol) error {
1243 if v, err := iprot.ReadString(ctx); err != nil {
1244 return thrift.PrependError("error reading field 5: ", err)
1245} else {
1246 p.OperationName = v
1247}
1248 return nil
1249}
1250
1251func (p *Span) ReadField6(ctx context.Context, iprot thrift.TProtocol) error {
1252 _, size, err := iprot.ReadListBegin(ctx)
1253 if err != nil {
1254 return thrift.PrependError("error reading list begin: ", err)
1255 }
1256 tSlice := make([]*SpanRef, 0, size)
1257 p.References = tSlice
1258 for i := 0; i < size; i ++ {
1259 _elem2 := &SpanRef{}
1260 if err := _elem2.Read(ctx, iprot); err != nil {
1261 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem2), err)
1262 }
1263 p.References = append(p.References, _elem2)
1264 }
1265 if err := iprot.ReadListEnd(ctx); err != nil {
1266 return thrift.PrependError("error reading list end: ", err)
1267 }
1268 return nil
1269}
1270
1271func (p *Span) ReadField7(ctx context.Context, iprot thrift.TProtocol) error {
1272 if v, err := iprot.ReadI32(ctx); err != nil {
1273 return thrift.PrependError("error reading field 7: ", err)
1274} else {
1275 p.Flags = v
1276}
1277 return nil
1278}
1279
1280func (p *Span) ReadField8(ctx context.Context, iprot thrift.TProtocol) error {
1281 if v, err := iprot.ReadI64(ctx); err != nil {
1282 return thrift.PrependError("error reading field 8: ", err)
1283} else {
1284 p.StartTime = v
1285}
1286 return nil
1287}
1288
1289func (p *Span) ReadField9(ctx context.Context, iprot thrift.TProtocol) error {
1290 if v, err := iprot.ReadI64(ctx); err != nil {
1291 return thrift.PrependError("error reading field 9: ", err)
1292} else {
1293 p.Duration = v
1294}
1295 return nil
1296}
1297
1298func (p *Span) ReadField10(ctx context.Context, iprot thrift.TProtocol) error {
1299 _, size, err := iprot.ReadListBegin(ctx)
1300 if err != nil {
1301 return thrift.PrependError("error reading list begin: ", err)
1302 }
1303 tSlice := make([]*Tag, 0, size)
1304 p.Tags = tSlice
1305 for i := 0; i < size; i ++ {
1306 _elem3 := &Tag{}
1307 if err := _elem3.Read(ctx, iprot); err != nil {
1308 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem3), err)
1309 }
1310 p.Tags = append(p.Tags, _elem3)
1311 }
1312 if err := iprot.ReadListEnd(ctx); err != nil {
1313 return thrift.PrependError("error reading list end: ", err)
1314 }
1315 return nil
1316}
1317
1318func (p *Span) ReadField11(ctx context.Context, iprot thrift.TProtocol) error {
1319 _, size, err := iprot.ReadListBegin(ctx)
1320 if err != nil {
1321 return thrift.PrependError("error reading list begin: ", err)
1322 }
1323 tSlice := make([]*Log, 0, size)
1324 p.Logs = tSlice
1325 for i := 0; i < size; i ++ {
1326 _elem4 := &Log{}
1327 if err := _elem4.Read(ctx, iprot); err != nil {
1328 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err)
1329 }
1330 p.Logs = append(p.Logs, _elem4)
1331 }
1332 if err := iprot.ReadListEnd(ctx); err != nil {
1333 return thrift.PrependError("error reading list end: ", err)
1334 }
1335 return nil
1336}
1337
1338func (p *Span) Write(ctx context.Context, oprot thrift.TProtocol) error {
1339 if err := oprot.WriteStructBegin(ctx, "Span"); err != nil {
1340 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
1341 if p != nil {
1342 if err := p.writeField1(ctx, oprot); err != nil { return err }
1343 if err := p.writeField2(ctx, oprot); err != nil { return err }
1344 if err := p.writeField3(ctx, oprot); err != nil { return err }
1345 if err := p.writeField4(ctx, oprot); err != nil { return err }
1346 if err := p.writeField5(ctx, oprot); err != nil { return err }
1347 if err := p.writeField6(ctx, oprot); err != nil { return err }
1348 if err := p.writeField7(ctx, oprot); err != nil { return err }
1349 if err := p.writeField8(ctx, oprot); err != nil { return err }
1350 if err := p.writeField9(ctx, oprot); err != nil { return err }
1351 if err := p.writeField10(ctx, oprot); err != nil { return err }
1352 if err := p.writeField11(ctx, oprot); err != nil { return err }
1353 }
1354 if err := oprot.WriteFieldStop(ctx); err != nil {
1355 return thrift.PrependError("write field stop error: ", err) }
1356 if err := oprot.WriteStructEnd(ctx); err != nil {
1357 return thrift.PrependError("write struct stop error: ", err) }
1358 return nil
1359}
1360
1361func (p *Span) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
1362 if err := oprot.WriteFieldBegin(ctx, "traceIdLow", thrift.I64, 1); err != nil {
1363 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:traceIdLow: ", p), err) }
1364 if err := oprot.WriteI64(ctx, int64(p.TraceIdLow)); err != nil {
1365 return thrift.PrependError(fmt.Sprintf("%T.traceIdLow (1) field write error: ", p), err) }
1366 if err := oprot.WriteFieldEnd(ctx); err != nil {
1367 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:traceIdLow: ", p), err) }
1368 return err
1369}
1370
1371func (p *Span) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
1372 if err := oprot.WriteFieldBegin(ctx, "traceIdHigh", thrift.I64, 2); err != nil {
1373 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:traceIdHigh: ", p), err) }
1374 if err := oprot.WriteI64(ctx, int64(p.TraceIdHigh)); err != nil {
1375 return thrift.PrependError(fmt.Sprintf("%T.traceIdHigh (2) field write error: ", p), err) }
1376 if err := oprot.WriteFieldEnd(ctx); err != nil {
1377 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:traceIdHigh: ", p), err) }
1378 return err
1379}
1380
1381func (p *Span) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) {
1382 if err := oprot.WriteFieldBegin(ctx, "spanId", thrift.I64, 3); err != nil {
1383 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:spanId: ", p), err) }
1384 if err := oprot.WriteI64(ctx, int64(p.SpanId)); err != nil {
1385 return thrift.PrependError(fmt.Sprintf("%T.spanId (3) field write error: ", p), err) }
1386 if err := oprot.WriteFieldEnd(ctx); err != nil {
1387 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:spanId: ", p), err) }
1388 return err
1389}
1390
1391func (p *Span) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) {
1392 if err := oprot.WriteFieldBegin(ctx, "parentSpanId", thrift.I64, 4); err != nil {
1393 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:parentSpanId: ", p), err) }
1394 if err := oprot.WriteI64(ctx, int64(p.ParentSpanId)); err != nil {
1395 return thrift.PrependError(fmt.Sprintf("%T.parentSpanId (4) field write error: ", p), err) }
1396 if err := oprot.WriteFieldEnd(ctx); err != nil {
1397 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:parentSpanId: ", p), err) }
1398 return err
1399}
1400
1401func (p *Span) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) {
1402 if err := oprot.WriteFieldBegin(ctx, "operationName", thrift.STRING, 5); err != nil {
1403 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:operationName: ", p), err) }
1404 if err := oprot.WriteString(ctx, string(p.OperationName)); err != nil {
1405 return thrift.PrependError(fmt.Sprintf("%T.operationName (5) field write error: ", p), err) }
1406 if err := oprot.WriteFieldEnd(ctx); err != nil {
1407 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:operationName: ", p), err) }
1408 return err
1409}
1410
1411func (p *Span) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) {
1412 if p.IsSetReferences() {
1413 if err := oprot.WriteFieldBegin(ctx, "references", thrift.LIST, 6); err != nil {
1414 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:references: ", p), err) }
1415 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.References)); err != nil {
1416 return thrift.PrependError("error writing list begin: ", err)
1417 }
1418 for _, v := range p.References {
1419 if err := v.Write(ctx, oprot); err != nil {
1420 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
1421 }
1422 }
1423 if err := oprot.WriteListEnd(ctx); err != nil {
1424 return thrift.PrependError("error writing list end: ", err)
1425 }
1426 if err := oprot.WriteFieldEnd(ctx); err != nil {
1427 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:references: ", p), err) }
1428 }
1429 return err
1430}
1431
1432func (p *Span) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) {
1433 if err := oprot.WriteFieldBegin(ctx, "flags", thrift.I32, 7); err != nil {
1434 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:flags: ", p), err) }
1435 if err := oprot.WriteI32(ctx, int32(p.Flags)); err != nil {
1436 return thrift.PrependError(fmt.Sprintf("%T.flags (7) field write error: ", p), err) }
1437 if err := oprot.WriteFieldEnd(ctx); err != nil {
1438 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:flags: ", p), err) }
1439 return err
1440}
1441
1442func (p *Span) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) {
1443 if err := oprot.WriteFieldBegin(ctx, "startTime", thrift.I64, 8); err != nil {
1444 return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:startTime: ", p), err) }
1445 if err := oprot.WriteI64(ctx, int64(p.StartTime)); err != nil {
1446 return thrift.PrependError(fmt.Sprintf("%T.startTime (8) field write error: ", p), err) }
1447 if err := oprot.WriteFieldEnd(ctx); err != nil {
1448 return thrift.PrependError(fmt.Sprintf("%T write field end error 8:startTime: ", p), err) }
1449 return err
1450}
1451
1452func (p *Span) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) {
1453 if err := oprot.WriteFieldBegin(ctx, "duration", thrift.I64, 9); err != nil {
1454 return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:duration: ", p), err) }
1455 if err := oprot.WriteI64(ctx, int64(p.Duration)); err != nil {
1456 return thrift.PrependError(fmt.Sprintf("%T.duration (9) field write error: ", p), err) }
1457 if err := oprot.WriteFieldEnd(ctx); err != nil {
1458 return thrift.PrependError(fmt.Sprintf("%T write field end error 9:duration: ", p), err) }
1459 return err
1460}
1461
1462func (p *Span) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) {
1463 if p.IsSetTags() {
1464 if err := oprot.WriteFieldBegin(ctx, "tags", thrift.LIST, 10); err != nil {
1465 return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:tags: ", p), err) }
1466 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Tags)); err != nil {
1467 return thrift.PrependError("error writing list begin: ", err)
1468 }
1469 for _, v := range p.Tags {
1470 if err := v.Write(ctx, oprot); err != nil {
1471 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
1472 }
1473 }
1474 if err := oprot.WriteListEnd(ctx); err != nil {
1475 return thrift.PrependError("error writing list end: ", err)
1476 }
1477 if err := oprot.WriteFieldEnd(ctx); err != nil {
1478 return thrift.PrependError(fmt.Sprintf("%T write field end error 10:tags: ", p), err) }
1479 }
1480 return err
1481}
1482
1483func (p *Span) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) {
1484 if p.IsSetLogs() {
1485 if err := oprot.WriteFieldBegin(ctx, "logs", thrift.LIST, 11); err != nil {
1486 return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:logs: ", p), err) }
1487 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Logs)); err != nil {
1488 return thrift.PrependError("error writing list begin: ", err)
1489 }
1490 for _, v := range p.Logs {
1491 if err := v.Write(ctx, oprot); err != nil {
1492 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
1493 }
1494 }
1495 if err := oprot.WriteListEnd(ctx); err != nil {
1496 return thrift.PrependError("error writing list end: ", err)
1497 }
1498 if err := oprot.WriteFieldEnd(ctx); err != nil {
1499 return thrift.PrependError(fmt.Sprintf("%T write field end error 11:logs: ", p), err) }
1500 }
1501 return err
1502}
1503
1504func (p *Span) Equals(other *Span) bool {
1505 if p == other {
1506 return true
1507 } else if p == nil || other == nil {
1508 return false
1509 }
1510 if p.TraceIdLow != other.TraceIdLow { return false }
1511 if p.TraceIdHigh != other.TraceIdHigh { return false }
1512 if p.SpanId != other.SpanId { return false }
1513 if p.ParentSpanId != other.ParentSpanId { return false }
1514 if p.OperationName != other.OperationName { return false }
1515 if len(p.References) != len(other.References) { return false }
1516 for i, _tgt := range p.References {
1517 _src5 := other.References[i]
1518 if !_tgt.Equals(_src5) { return false }
1519 }
1520 if p.Flags != other.Flags { return false }
1521 if p.StartTime != other.StartTime { return false }
1522 if p.Duration != other.Duration { return false }
1523 if len(p.Tags) != len(other.Tags) { return false }
1524 for i, _tgt := range p.Tags {
1525 _src6 := other.Tags[i]
1526 if !_tgt.Equals(_src6) { return false }
1527 }
1528 if len(p.Logs) != len(other.Logs) { return false }
1529 for i, _tgt := range p.Logs {
1530 _src7 := other.Logs[i]
1531 if !_tgt.Equals(_src7) { return false }
1532 }
1533 return true
1534}
1535
1536func (p *Span) String() string {
1537 if p == nil {
1538 return "<nil>"
1539 }
1540 return fmt.Sprintf("Span(%+v)", *p)
1541}
1542
1543// Attributes:
1544// - ServiceName
1545// - Tags
1546type Process struct {
1547 ServiceName string `thrift:"serviceName,1,required" db:"serviceName" json:"serviceName"`
1548 Tags []*Tag `thrift:"tags,2" db:"tags" json:"tags,omitempty"`
1549}
1550
1551func NewProcess() *Process {
1552 return &Process{}
1553}
1554
1555
1556func (p *Process) GetServiceName() string {
1557 return p.ServiceName
1558}
1559var Process_Tags_DEFAULT []*Tag
1560
1561func (p *Process) GetTags() []*Tag {
1562 return p.Tags
1563}
1564func (p *Process) IsSetTags() bool {
1565 return p.Tags != nil
1566}
1567
1568func (p *Process) Read(ctx context.Context, iprot thrift.TProtocol) error {
1569 if _, err := iprot.ReadStructBegin(ctx); err != nil {
1570 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
1571 }
1572
1573 var issetServiceName bool = false;
1574
1575 for {
1576 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
1577 if err != nil {
1578 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
1579 }
1580 if fieldTypeId == thrift.STOP { break; }
1581 switch fieldId {
1582 case 1:
1583 if fieldTypeId == thrift.STRING {
1584 if err := p.ReadField1(ctx, iprot); err != nil {
1585 return err
1586 }
1587 issetServiceName = true
1588 } else {
1589 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1590 return err
1591 }
1592 }
1593 case 2:
1594 if fieldTypeId == thrift.LIST {
1595 if err := p.ReadField2(ctx, iprot); err != nil {
1596 return err
1597 }
1598 } else {
1599 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1600 return err
1601 }
1602 }
1603 default:
1604 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1605 return err
1606 }
1607 }
1608 if err := iprot.ReadFieldEnd(ctx); err != nil {
1609 return err
1610 }
1611 }
1612 if err := iprot.ReadStructEnd(ctx); err != nil {
1613 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
1614 }
1615 if !issetServiceName{
1616 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ServiceName is not set"));
1617 }
1618 return nil
1619}
1620
1621func (p *Process) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
1622 if v, err := iprot.ReadString(ctx); err != nil {
1623 return thrift.PrependError("error reading field 1: ", err)
1624} else {
1625 p.ServiceName = v
1626}
1627 return nil
1628}
1629
1630func (p *Process) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
1631 _, size, err := iprot.ReadListBegin(ctx)
1632 if err != nil {
1633 return thrift.PrependError("error reading list begin: ", err)
1634 }
1635 tSlice := make([]*Tag, 0, size)
1636 p.Tags = tSlice
1637 for i := 0; i < size; i ++ {
1638 _elem8 := &Tag{}
1639 if err := _elem8.Read(ctx, iprot); err != nil {
1640 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem8), err)
1641 }
1642 p.Tags = append(p.Tags, _elem8)
1643 }
1644 if err := iprot.ReadListEnd(ctx); err != nil {
1645 return thrift.PrependError("error reading list end: ", err)
1646 }
1647 return nil
1648}
1649
1650func (p *Process) Write(ctx context.Context, oprot thrift.TProtocol) error {
1651 if err := oprot.WriteStructBegin(ctx, "Process"); err != nil {
1652 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
1653 if p != nil {
1654 if err := p.writeField1(ctx, oprot); err != nil { return err }
1655 if err := p.writeField2(ctx, oprot); err != nil { return err }
1656 }
1657 if err := oprot.WriteFieldStop(ctx); err != nil {
1658 return thrift.PrependError("write field stop error: ", err) }
1659 if err := oprot.WriteStructEnd(ctx); err != nil {
1660 return thrift.PrependError("write struct stop error: ", err) }
1661 return nil
1662}
1663
1664func (p *Process) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
1665 if err := oprot.WriteFieldBegin(ctx, "serviceName", thrift.STRING, 1); err != nil {
1666 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:serviceName: ", p), err) }
1667 if err := oprot.WriteString(ctx, string(p.ServiceName)); err != nil {
1668 return thrift.PrependError(fmt.Sprintf("%T.serviceName (1) field write error: ", p), err) }
1669 if err := oprot.WriteFieldEnd(ctx); err != nil {
1670 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:serviceName: ", p), err) }
1671 return err
1672}
1673
1674func (p *Process) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
1675 if p.IsSetTags() {
1676 if err := oprot.WriteFieldBegin(ctx, "tags", thrift.LIST, 2); err != nil {
1677 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:tags: ", p), err) }
1678 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Tags)); err != nil {
1679 return thrift.PrependError("error writing list begin: ", err)
1680 }
1681 for _, v := range p.Tags {
1682 if err := v.Write(ctx, oprot); err != nil {
1683 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
1684 }
1685 }
1686 if err := oprot.WriteListEnd(ctx); err != nil {
1687 return thrift.PrependError("error writing list end: ", err)
1688 }
1689 if err := oprot.WriteFieldEnd(ctx); err != nil {
1690 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:tags: ", p), err) }
1691 }
1692 return err
1693}
1694
1695func (p *Process) Equals(other *Process) bool {
1696 if p == other {
1697 return true
1698 } else if p == nil || other == nil {
1699 return false
1700 }
1701 if p.ServiceName != other.ServiceName { return false }
1702 if len(p.Tags) != len(other.Tags) { return false }
1703 for i, _tgt := range p.Tags {
1704 _src9 := other.Tags[i]
1705 if !_tgt.Equals(_src9) { return false }
1706 }
1707 return true
1708}
1709
1710func (p *Process) String() string {
1711 if p == nil {
1712 return "<nil>"
1713 }
1714 return fmt.Sprintf("Process(%+v)", *p)
1715}
1716
1717// Attributes:
1718// - FullQueueDroppedSpans
1719// - TooLargeDroppedSpans
1720// - FailedToEmitSpans
1721type ClientStats struct {
1722 FullQueueDroppedSpans int64 `thrift:"fullQueueDroppedSpans,1,required" db:"fullQueueDroppedSpans" json:"fullQueueDroppedSpans"`
1723 TooLargeDroppedSpans int64 `thrift:"tooLargeDroppedSpans,2,required" db:"tooLargeDroppedSpans" json:"tooLargeDroppedSpans"`
1724 FailedToEmitSpans int64 `thrift:"failedToEmitSpans,3,required" db:"failedToEmitSpans" json:"failedToEmitSpans"`
1725}
1726
1727func NewClientStats() *ClientStats {
1728 return &ClientStats{}
1729}
1730
1731
1732func (p *ClientStats) GetFullQueueDroppedSpans() int64 {
1733 return p.FullQueueDroppedSpans
1734}
1735
1736func (p *ClientStats) GetTooLargeDroppedSpans() int64 {
1737 return p.TooLargeDroppedSpans
1738}
1739
1740func (p *ClientStats) GetFailedToEmitSpans() int64 {
1741 return p.FailedToEmitSpans
1742}
1743func (p *ClientStats) Read(ctx context.Context, iprot thrift.TProtocol) error {
1744 if _, err := iprot.ReadStructBegin(ctx); err != nil {
1745 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
1746 }
1747
1748 var issetFullQueueDroppedSpans bool = false;
1749 var issetTooLargeDroppedSpans bool = false;
1750 var issetFailedToEmitSpans bool = false;
1751
1752 for {
1753 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
1754 if err != nil {
1755 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
1756 }
1757 if fieldTypeId == thrift.STOP { break; }
1758 switch fieldId {
1759 case 1:
1760 if fieldTypeId == thrift.I64 {
1761 if err := p.ReadField1(ctx, iprot); err != nil {
1762 return err
1763 }
1764 issetFullQueueDroppedSpans = true
1765 } else {
1766 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1767 return err
1768 }
1769 }
1770 case 2:
1771 if fieldTypeId == thrift.I64 {
1772 if err := p.ReadField2(ctx, iprot); err != nil {
1773 return err
1774 }
1775 issetTooLargeDroppedSpans = true
1776 } else {
1777 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1778 return err
1779 }
1780 }
1781 case 3:
1782 if fieldTypeId == thrift.I64 {
1783 if err := p.ReadField3(ctx, iprot); err != nil {
1784 return err
1785 }
1786 issetFailedToEmitSpans = true
1787 } else {
1788 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1789 return err
1790 }
1791 }
1792 default:
1793 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1794 return err
1795 }
1796 }
1797 if err := iprot.ReadFieldEnd(ctx); err != nil {
1798 return err
1799 }
1800 }
1801 if err := iprot.ReadStructEnd(ctx); err != nil {
1802 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
1803 }
1804 if !issetFullQueueDroppedSpans{
1805 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field FullQueueDroppedSpans is not set"));
1806 }
1807 if !issetTooLargeDroppedSpans{
1808 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TooLargeDroppedSpans is not set"));
1809 }
1810 if !issetFailedToEmitSpans{
1811 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field FailedToEmitSpans is not set"));
1812 }
1813 return nil
1814}
1815
1816func (p *ClientStats) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
1817 if v, err := iprot.ReadI64(ctx); err != nil {
1818 return thrift.PrependError("error reading field 1: ", err)
1819} else {
1820 p.FullQueueDroppedSpans = v
1821}
1822 return nil
1823}
1824
1825func (p *ClientStats) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
1826 if v, err := iprot.ReadI64(ctx); err != nil {
1827 return thrift.PrependError("error reading field 2: ", err)
1828} else {
1829 p.TooLargeDroppedSpans = v
1830}
1831 return nil
1832}
1833
1834func (p *ClientStats) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
1835 if v, err := iprot.ReadI64(ctx); err != nil {
1836 return thrift.PrependError("error reading field 3: ", err)
1837} else {
1838 p.FailedToEmitSpans = v
1839}
1840 return nil
1841}
1842
1843func (p *ClientStats) Write(ctx context.Context, oprot thrift.TProtocol) error {
1844 if err := oprot.WriteStructBegin(ctx, "ClientStats"); err != nil {
1845 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
1846 if p != nil {
1847 if err := p.writeField1(ctx, oprot); err != nil { return err }
1848 if err := p.writeField2(ctx, oprot); err != nil { return err }
1849 if err := p.writeField3(ctx, oprot); err != nil { return err }
1850 }
1851 if err := oprot.WriteFieldStop(ctx); err != nil {
1852 return thrift.PrependError("write field stop error: ", err) }
1853 if err := oprot.WriteStructEnd(ctx); err != nil {
1854 return thrift.PrependError("write struct stop error: ", err) }
1855 return nil
1856}
1857
1858func (p *ClientStats) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
1859 if err := oprot.WriteFieldBegin(ctx, "fullQueueDroppedSpans", thrift.I64, 1); err != nil {
1860 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:fullQueueDroppedSpans: ", p), err) }
1861 if err := oprot.WriteI64(ctx, int64(p.FullQueueDroppedSpans)); err != nil {
1862 return thrift.PrependError(fmt.Sprintf("%T.fullQueueDroppedSpans (1) field write error: ", p), err) }
1863 if err := oprot.WriteFieldEnd(ctx); err != nil {
1864 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:fullQueueDroppedSpans: ", p), err) }
1865 return err
1866}
1867
1868func (p *ClientStats) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
1869 if err := oprot.WriteFieldBegin(ctx, "tooLargeDroppedSpans", thrift.I64, 2); err != nil {
1870 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:tooLargeDroppedSpans: ", p), err) }
1871 if err := oprot.WriteI64(ctx, int64(p.TooLargeDroppedSpans)); err != nil {
1872 return thrift.PrependError(fmt.Sprintf("%T.tooLargeDroppedSpans (2) field write error: ", p), err) }
1873 if err := oprot.WriteFieldEnd(ctx); err != nil {
1874 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:tooLargeDroppedSpans: ", p), err) }
1875 return err
1876}
1877
1878func (p *ClientStats) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) {
1879 if err := oprot.WriteFieldBegin(ctx, "failedToEmitSpans", thrift.I64, 3); err != nil {
1880 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:failedToEmitSpans: ", p), err) }
1881 if err := oprot.WriteI64(ctx, int64(p.FailedToEmitSpans)); err != nil {
1882 return thrift.PrependError(fmt.Sprintf("%T.failedToEmitSpans (3) field write error: ", p), err) }
1883 if err := oprot.WriteFieldEnd(ctx); err != nil {
1884 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:failedToEmitSpans: ", p), err) }
1885 return err
1886}
1887
1888func (p *ClientStats) Equals(other *ClientStats) bool {
1889 if p == other {
1890 return true
1891 } else if p == nil || other == nil {
1892 return false
1893 }
1894 if p.FullQueueDroppedSpans != other.FullQueueDroppedSpans { return false }
1895 if p.TooLargeDroppedSpans != other.TooLargeDroppedSpans { return false }
1896 if p.FailedToEmitSpans != other.FailedToEmitSpans { return false }
1897 return true
1898}
1899
1900func (p *ClientStats) String() string {
1901 if p == nil {
1902 return "<nil>"
1903 }
1904 return fmt.Sprintf("ClientStats(%+v)", *p)
1905}
1906
1907// Attributes:
1908// - Process
1909// - Spans
1910// - SeqNo
1911// - Stats
1912type Batch struct {
1913 Process *Process `thrift:"process,1,required" db:"process" json:"process"`
1914 Spans []*Span `thrift:"spans,2,required" db:"spans" json:"spans"`
1915 SeqNo *int64 `thrift:"seqNo,3" db:"seqNo" json:"seqNo,omitempty"`
1916 Stats *ClientStats `thrift:"stats,4" db:"stats" json:"stats,omitempty"`
1917}
1918
1919func NewBatch() *Batch {
1920 return &Batch{}
1921}
1922
1923var Batch_Process_DEFAULT *Process
1924func (p *Batch) GetProcess() *Process {
1925 if !p.IsSetProcess() {
1926 return Batch_Process_DEFAULT
1927 }
1928return p.Process
1929}
1930
1931func (p *Batch) GetSpans() []*Span {
1932 return p.Spans
1933}
1934var Batch_SeqNo_DEFAULT int64
1935func (p *Batch) GetSeqNo() int64 {
1936 if !p.IsSetSeqNo() {
1937 return Batch_SeqNo_DEFAULT
1938 }
1939return *p.SeqNo
1940}
1941var Batch_Stats_DEFAULT *ClientStats
1942func (p *Batch) GetStats() *ClientStats {
1943 if !p.IsSetStats() {
1944 return Batch_Stats_DEFAULT
1945 }
1946return p.Stats
1947}
1948func (p *Batch) IsSetProcess() bool {
1949 return p.Process != nil
1950}
1951
1952func (p *Batch) IsSetSeqNo() bool {
1953 return p.SeqNo != nil
1954}
1955
1956func (p *Batch) IsSetStats() bool {
1957 return p.Stats != nil
1958}
1959
1960func (p *Batch) Read(ctx context.Context, iprot thrift.TProtocol) error {
1961 if _, err := iprot.ReadStructBegin(ctx); err != nil {
1962 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
1963 }
1964
1965 var issetProcess bool = false;
1966 var issetSpans bool = false;
1967
1968 for {
1969 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
1970 if err != nil {
1971 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
1972 }
1973 if fieldTypeId == thrift.STOP { break; }
1974 switch fieldId {
1975 case 1:
1976 if fieldTypeId == thrift.STRUCT {
1977 if err := p.ReadField1(ctx, iprot); err != nil {
1978 return err
1979 }
1980 issetProcess = true
1981 } else {
1982 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1983 return err
1984 }
1985 }
1986 case 2:
1987 if fieldTypeId == thrift.LIST {
1988 if err := p.ReadField2(ctx, iprot); err != nil {
1989 return err
1990 }
1991 issetSpans = true
1992 } else {
1993 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
1994 return err
1995 }
1996 }
1997 case 3:
1998 if fieldTypeId == thrift.I64 {
1999 if err := p.ReadField3(ctx, iprot); err != nil {
2000 return err
2001 }
2002 } else {
2003 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
2004 return err
2005 }
2006 }
2007 case 4:
2008 if fieldTypeId == thrift.STRUCT {
2009 if err := p.ReadField4(ctx, iprot); err != nil {
2010 return err
2011 }
2012 } else {
2013 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
2014 return err
2015 }
2016 }
2017 default:
2018 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
2019 return err
2020 }
2021 }
2022 if err := iprot.ReadFieldEnd(ctx); err != nil {
2023 return err
2024 }
2025 }
2026 if err := iprot.ReadStructEnd(ctx); err != nil {
2027 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
2028 }
2029 if !issetProcess{
2030 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Process is not set"));
2031 }
2032 if !issetSpans{
2033 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Spans is not set"));
2034 }
2035 return nil
2036}
2037
2038func (p *Batch) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
2039 p.Process = &Process{}
2040 if err := p.Process.Read(ctx, iprot); err != nil {
2041 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Process), err)
2042 }
2043 return nil
2044}
2045
2046func (p *Batch) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
2047 _, size, err := iprot.ReadListBegin(ctx)
2048 if err != nil {
2049 return thrift.PrependError("error reading list begin: ", err)
2050 }
2051 tSlice := make([]*Span, 0, size)
2052 p.Spans = tSlice
2053 for i := 0; i < size; i ++ {
2054 _elem10 := &Span{}
2055 if err := _elem10.Read(ctx, iprot); err != nil {
2056 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem10), err)
2057 }
2058 p.Spans = append(p.Spans, _elem10)
2059 }
2060 if err := iprot.ReadListEnd(ctx); err != nil {
2061 return thrift.PrependError("error reading list end: ", err)
2062 }
2063 return nil
2064}
2065
2066func (p *Batch) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
2067 if v, err := iprot.ReadI64(ctx); err != nil {
2068 return thrift.PrependError("error reading field 3: ", err)
2069} else {
2070 p.SeqNo = &v
2071}
2072 return nil
2073}
2074
2075func (p *Batch) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
2076 p.Stats = &ClientStats{}
2077 if err := p.Stats.Read(ctx, iprot); err != nil {
2078 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Stats), err)
2079 }
2080 return nil
2081}
2082
2083func (p *Batch) Write(ctx context.Context, oprot thrift.TProtocol) error {
2084 if err := oprot.WriteStructBegin(ctx, "Batch"); err != nil {
2085 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
2086 if p != nil {
2087 if err := p.writeField1(ctx, oprot); err != nil { return err }
2088 if err := p.writeField2(ctx, oprot); err != nil { return err }
2089 if err := p.writeField3(ctx, oprot); err != nil { return err }
2090 if err := p.writeField4(ctx, oprot); err != nil { return err }
2091 }
2092 if err := oprot.WriteFieldStop(ctx); err != nil {
2093 return thrift.PrependError("write field stop error: ", err) }
2094 if err := oprot.WriteStructEnd(ctx); err != nil {
2095 return thrift.PrependError("write struct stop error: ", err) }
2096 return nil
2097}
2098
2099func (p *Batch) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
2100 if err := oprot.WriteFieldBegin(ctx, "process", thrift.STRUCT, 1); err != nil {
2101 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:process: ", p), err) }
2102 if err := p.Process.Write(ctx, oprot); err != nil {
2103 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Process), err)
2104 }
2105 if err := oprot.WriteFieldEnd(ctx); err != nil {
2106 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:process: ", p), err) }
2107 return err
2108}
2109
2110func (p *Batch) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
2111 if err := oprot.WriteFieldBegin(ctx, "spans", thrift.LIST, 2); err != nil {
2112 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:spans: ", p), err) }
2113 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Spans)); err != nil {
2114 return thrift.PrependError("error writing list begin: ", err)
2115 }
2116 for _, v := range p.Spans {
2117 if err := v.Write(ctx, oprot); err != nil {
2118 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
2119 }
2120 }
2121 if err := oprot.WriteListEnd(ctx); err != nil {
2122 return thrift.PrependError("error writing list end: ", err)
2123 }
2124 if err := oprot.WriteFieldEnd(ctx); err != nil {
2125 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:spans: ", p), err) }
2126 return err
2127}
2128
2129func (p *Batch) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) {
2130 if p.IsSetSeqNo() {
2131 if err := oprot.WriteFieldBegin(ctx, "seqNo", thrift.I64, 3); err != nil {
2132 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:seqNo: ", p), err) }
2133 if err := oprot.WriteI64(ctx, int64(*p.SeqNo)); err != nil {
2134 return thrift.PrependError(fmt.Sprintf("%T.seqNo (3) field write error: ", p), err) }
2135 if err := oprot.WriteFieldEnd(ctx); err != nil {
2136 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:seqNo: ", p), err) }
2137 }
2138 return err
2139}
2140
2141func (p *Batch) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) {
2142 if p.IsSetStats() {
2143 if err := oprot.WriteFieldBegin(ctx, "stats", thrift.STRUCT, 4); err != nil {
2144 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:stats: ", p), err) }
2145 if err := p.Stats.Write(ctx, oprot); err != nil {
2146 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Stats), err)
2147 }
2148 if err := oprot.WriteFieldEnd(ctx); err != nil {
2149 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:stats: ", p), err) }
2150 }
2151 return err
2152}
2153
2154func (p *Batch) Equals(other *Batch) bool {
2155 if p == other {
2156 return true
2157 } else if p == nil || other == nil {
2158 return false
2159 }
2160 if !p.Process.Equals(other.Process) { return false }
2161 if len(p.Spans) != len(other.Spans) { return false }
2162 for i, _tgt := range p.Spans {
2163 _src11 := other.Spans[i]
2164 if !_tgt.Equals(_src11) { return false }
2165 }
2166 if p.SeqNo != other.SeqNo {
2167 if p.SeqNo == nil || other.SeqNo == nil {
2168 return false
2169 }
2170 if (*p.SeqNo) != (*other.SeqNo) { return false }
2171 }
2172 if !p.Stats.Equals(other.Stats) { return false }
2173 return true
2174}
2175
2176func (p *Batch) String() string {
2177 if p == nil {
2178 return "<nil>"
2179 }
2180 return fmt.Sprintf("Batch(%+v)", *p)
2181}
2182
2183// Attributes:
2184// - Ok
2185type BatchSubmitResponse struct {
2186 Ok bool `thrift:"ok,1,required" db:"ok" json:"ok"`
2187}
2188
2189func NewBatchSubmitResponse() *BatchSubmitResponse {
2190 return &BatchSubmitResponse{}
2191}
2192
2193
2194func (p *BatchSubmitResponse) GetOk() bool {
2195 return p.Ok
2196}
2197func (p *BatchSubmitResponse) Read(ctx context.Context, iprot thrift.TProtocol) error {
2198 if _, err := iprot.ReadStructBegin(ctx); err != nil {
2199 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
2200 }
2201
2202 var issetOk bool = false;
2203
2204 for {
2205 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
2206 if err != nil {
2207 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
2208 }
2209 if fieldTypeId == thrift.STOP { break; }
2210 switch fieldId {
2211 case 1:
2212 if fieldTypeId == thrift.BOOL {
2213 if err := p.ReadField1(ctx, iprot); err != nil {
2214 return err
2215 }
2216 issetOk = true
2217 } else {
2218 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
2219 return err
2220 }
2221 }
2222 default:
2223 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
2224 return err
2225 }
2226 }
2227 if err := iprot.ReadFieldEnd(ctx); err != nil {
2228 return err
2229 }
2230 }
2231 if err := iprot.ReadStructEnd(ctx); err != nil {
2232 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
2233 }
2234 if !issetOk{
2235 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Ok is not set"));
2236 }
2237 return nil
2238}
2239
2240func (p *BatchSubmitResponse) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
2241 if v, err := iprot.ReadBool(ctx); err != nil {
2242 return thrift.PrependError("error reading field 1: ", err)
2243} else {
2244 p.Ok = v
2245}
2246 return nil
2247}
2248
2249func (p *BatchSubmitResponse) Write(ctx context.Context, oprot thrift.TProtocol) error {
2250 if err := oprot.WriteStructBegin(ctx, "BatchSubmitResponse"); err != nil {
2251 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
2252 if p != nil {
2253 if err := p.writeField1(ctx, oprot); err != nil { return err }
2254 }
2255 if err := oprot.WriteFieldStop(ctx); err != nil {
2256 return thrift.PrependError("write field stop error: ", err) }
2257 if err := oprot.WriteStructEnd(ctx); err != nil {
2258 return thrift.PrependError("write struct stop error: ", err) }
2259 return nil
2260}
2261
2262func (p *BatchSubmitResponse) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
2263 if err := oprot.WriteFieldBegin(ctx, "ok", thrift.BOOL, 1); err != nil {
2264 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ok: ", p), err) }
2265 if err := oprot.WriteBool(ctx, bool(p.Ok)); err != nil {
2266 return thrift.PrependError(fmt.Sprintf("%T.ok (1) field write error: ", p), err) }
2267 if err := oprot.WriteFieldEnd(ctx); err != nil {
2268 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ok: ", p), err) }
2269 return err
2270}
2271
2272func (p *BatchSubmitResponse) Equals(other *BatchSubmitResponse) bool {
2273 if p == other {
2274 return true
2275 } else if p == nil || other == nil {
2276 return false
2277 }
2278 if p.Ok != other.Ok { return false }
2279 return true
2280}
2281
2282func (p *BatchSubmitResponse) String() string {
2283 if p == nil {
2284 return "<nil>"
2285 }
2286 return fmt.Sprintf("BatchSubmitResponse(%+v)", *p)
2287}
2288
2289type Collector interface {
2290 // Parameters:
2291 // - Batches
2292 SubmitBatches(ctx context.Context, batches []*Batch) (_r []*BatchSubmitResponse, _err error)
2293}
2294
2295type CollectorClient struct {
2296 c thrift.TClient
2297 meta thrift.ResponseMeta
2298}
2299
2300func NewCollectorClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *CollectorClient {
2301 return &CollectorClient{
2302 c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
2303 }
2304}
2305
2306func NewCollectorClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *CollectorClient {
2307 return &CollectorClient{
2308 c: thrift.NewTStandardClient(iprot, oprot),
2309 }
2310}
2311
2312func NewCollectorClient(c thrift.TClient) *CollectorClient {
2313 return &CollectorClient{
2314 c: c,
2315 }
2316}
2317
2318func (p *CollectorClient) Client_() thrift.TClient {
2319 return p.c
2320}
2321
2322func (p *CollectorClient) LastResponseMeta_() thrift.ResponseMeta {
2323 return p.meta
2324}
2325
2326func (p *CollectorClient) SetLastResponseMeta_(meta thrift.ResponseMeta) {
2327 p.meta = meta
2328}
2329
2330// Parameters:
2331// - Batches
2332func (p *CollectorClient) SubmitBatches(ctx context.Context, batches []*Batch) (_r []*BatchSubmitResponse, _err error) {
2333 var _args12 CollectorSubmitBatchesArgs
2334 _args12.Batches = batches
2335 var _result14 CollectorSubmitBatchesResult
2336 var _meta13 thrift.ResponseMeta
2337 _meta13, _err = p.Client_().Call(ctx, "submitBatches", &_args12, &_result14)
2338 p.SetLastResponseMeta_(_meta13)
2339 if _err != nil {
2340 return
2341 }
2342 return _result14.GetSuccess(), nil
2343}
2344
2345type CollectorProcessor struct {
2346 processorMap map[string]thrift.TProcessorFunction
2347 handler Collector
2348}
2349
2350func (p *CollectorProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
2351 p.processorMap[key] = processor
2352}
2353
2354func (p *CollectorProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
2355 processor, ok = p.processorMap[key]
2356 return processor, ok
2357}
2358
2359func (p *CollectorProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
2360 return p.processorMap
2361}
2362
2363func NewCollectorProcessor(handler Collector) *CollectorProcessor {
2364
2365 self15 := &CollectorProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)}
2366 self15.processorMap["submitBatches"] = &collectorProcessorSubmitBatches{handler:handler}
2367return self15
2368}
2369
2370func (p *CollectorProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
2371 name, _, seqId, err2 := iprot.ReadMessageBegin(ctx)
2372 if err2 != nil { return false, thrift.WrapTException(err2) }
2373 if processor, ok := p.GetProcessorFunction(name); ok {
2374 return processor.Process(ctx, seqId, iprot, oprot)
2375 }
2376 iprot.Skip(ctx, thrift.STRUCT)
2377 iprot.ReadMessageEnd(ctx)
2378 x16 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name)
2379 oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId)
2380 x16.Write(ctx, oprot)
2381 oprot.WriteMessageEnd(ctx)
2382 oprot.Flush(ctx)
2383 return false, x16
2384
2385}
2386
2387type collectorProcessorSubmitBatches struct {
2388 handler Collector
2389}
2390
2391func (p *collectorProcessorSubmitBatches) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
2392 args := CollectorSubmitBatchesArgs{}
2393 var err2 error
2394 if err2 = args.Read(ctx, iprot); err2 != nil {
2395 iprot.ReadMessageEnd(ctx)
2396 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
2397 oprot.WriteMessageBegin(ctx, "submitBatches", thrift.EXCEPTION, seqId)
2398 x.Write(ctx, oprot)
2399 oprot.WriteMessageEnd(ctx)
2400 oprot.Flush(ctx)
2401 return false, thrift.WrapTException(err2)
2402 }
2403 iprot.ReadMessageEnd(ctx)
2404
2405 tickerCancel := func() {}
2406 // Start a goroutine to do server side connectivity check.
2407 if thrift.ServerConnectivityCheckInterval > 0 {
2408 var cancel context.CancelFunc
2409 ctx, cancel = context.WithCancel(ctx)
2410 defer cancel()
2411 var tickerCtx context.Context
2412 tickerCtx, tickerCancel = context.WithCancel(context.Background())
2413 defer tickerCancel()
2414 go func(ctx context.Context, cancel context.CancelFunc) {
2415 ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
2416 defer ticker.Stop()
2417 for {
2418 select {
2419 case <-ctx.Done():
2420 return
2421 case <-ticker.C:
2422 if !iprot.Transport().IsOpen() {
2423 cancel()
2424 return
2425 }
2426 }
2427 }
2428 }(tickerCtx, cancel)
2429 }
2430
2431 result := CollectorSubmitBatchesResult{}
2432 var retval []*BatchSubmitResponse
2433 if retval, err2 = p.handler.SubmitBatches(ctx, args.Batches); err2 != nil {
2434 tickerCancel()
2435 if err2 == thrift.ErrAbandonRequest {
2436 return false, thrift.WrapTException(err2)
2437 }
2438 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing submitBatches: " + err2.Error())
2439 oprot.WriteMessageBegin(ctx, "submitBatches", thrift.EXCEPTION, seqId)
2440 x.Write(ctx, oprot)
2441 oprot.WriteMessageEnd(ctx)
2442 oprot.Flush(ctx)
2443 return true, thrift.WrapTException(err2)
2444 } else {
2445 result.Success = retval
2446 }
2447 tickerCancel()
2448 if err2 = oprot.WriteMessageBegin(ctx, "submitBatches", thrift.REPLY, seqId); err2 != nil {
2449 err = thrift.WrapTException(err2)
2450 }
2451 if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
2452 err = thrift.WrapTException(err2)
2453 }
2454 if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
2455 err = thrift.WrapTException(err2)
2456 }
2457 if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
2458 err = thrift.WrapTException(err2)
2459 }
2460 if err != nil {
2461 return
2462 }
2463 return true, err
2464}
2465
2466
2467// HELPER FUNCTIONS AND STRUCTURES
2468
2469// Attributes:
2470// - Batches
2471type CollectorSubmitBatchesArgs struct {
2472 Batches []*Batch `thrift:"batches,1" db:"batches" json:"batches"`
2473}
2474
2475func NewCollectorSubmitBatchesArgs() *CollectorSubmitBatchesArgs {
2476 return &CollectorSubmitBatchesArgs{}
2477}
2478
2479
2480func (p *CollectorSubmitBatchesArgs) GetBatches() []*Batch {
2481 return p.Batches
2482}
2483func (p *CollectorSubmitBatchesArgs) Read(ctx context.Context, iprot thrift.TProtocol) error {
2484 if _, err := iprot.ReadStructBegin(ctx); err != nil {
2485 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
2486 }
2487
2488
2489 for {
2490 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
2491 if err != nil {
2492 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
2493 }
2494 if fieldTypeId == thrift.STOP { break; }
2495 switch fieldId {
2496 case 1:
2497 if fieldTypeId == thrift.LIST {
2498 if err := p.ReadField1(ctx, iprot); err != nil {
2499 return err
2500 }
2501 } else {
2502 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
2503 return err
2504 }
2505 }
2506 default:
2507 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
2508 return err
2509 }
2510 }
2511 if err := iprot.ReadFieldEnd(ctx); err != nil {
2512 return err
2513 }
2514 }
2515 if err := iprot.ReadStructEnd(ctx); err != nil {
2516 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
2517 }
2518 return nil
2519}
2520
2521func (p *CollectorSubmitBatchesArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
2522 _, size, err := iprot.ReadListBegin(ctx)
2523 if err != nil {
2524 return thrift.PrependError("error reading list begin: ", err)
2525 }
2526 tSlice := make([]*Batch, 0, size)
2527 p.Batches = tSlice
2528 for i := 0; i < size; i ++ {
2529 _elem17 := &Batch{}
2530 if err := _elem17.Read(ctx, iprot); err != nil {
2531 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem17), err)
2532 }
2533 p.Batches = append(p.Batches, _elem17)
2534 }
2535 if err := iprot.ReadListEnd(ctx); err != nil {
2536 return thrift.PrependError("error reading list end: ", err)
2537 }
2538 return nil
2539}
2540
2541func (p *CollectorSubmitBatchesArgs) Write(ctx context.Context, oprot thrift.TProtocol) error {
2542 if err := oprot.WriteStructBegin(ctx, "submitBatches_args"); err != nil {
2543 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
2544 if p != nil {
2545 if err := p.writeField1(ctx, oprot); err != nil { return err }
2546 }
2547 if err := oprot.WriteFieldStop(ctx); err != nil {
2548 return thrift.PrependError("write field stop error: ", err) }
2549 if err := oprot.WriteStructEnd(ctx); err != nil {
2550 return thrift.PrependError("write struct stop error: ", err) }
2551 return nil
2552}
2553
2554func (p *CollectorSubmitBatchesArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
2555 if err := oprot.WriteFieldBegin(ctx, "batches", thrift.LIST, 1); err != nil {
2556 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:batches: ", p), err) }
2557 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Batches)); err != nil {
2558 return thrift.PrependError("error writing list begin: ", err)
2559 }
2560 for _, v := range p.Batches {
2561 if err := v.Write(ctx, oprot); err != nil {
2562 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
2563 }
2564 }
2565 if err := oprot.WriteListEnd(ctx); err != nil {
2566 return thrift.PrependError("error writing list end: ", err)
2567 }
2568 if err := oprot.WriteFieldEnd(ctx); err != nil {
2569 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:batches: ", p), err) }
2570 return err
2571}
2572
2573func (p *CollectorSubmitBatchesArgs) String() string {
2574 if p == nil {
2575 return "<nil>"
2576 }
2577 return fmt.Sprintf("CollectorSubmitBatchesArgs(%+v)", *p)
2578}
2579
2580// Attributes:
2581// - Success
2582type CollectorSubmitBatchesResult struct {
2583 Success []*BatchSubmitResponse `thrift:"success,0" db:"success" json:"success,omitempty"`
2584}
2585
2586func NewCollectorSubmitBatchesResult() *CollectorSubmitBatchesResult {
2587 return &CollectorSubmitBatchesResult{}
2588}
2589
2590var CollectorSubmitBatchesResult_Success_DEFAULT []*BatchSubmitResponse
2591
2592func (p *CollectorSubmitBatchesResult) GetSuccess() []*BatchSubmitResponse {
2593 return p.Success
2594}
2595func (p *CollectorSubmitBatchesResult) IsSetSuccess() bool {
2596 return p.Success != nil
2597}
2598
2599func (p *CollectorSubmitBatchesResult) Read(ctx context.Context, iprot thrift.TProtocol) error {
2600 if _, err := iprot.ReadStructBegin(ctx); err != nil {
2601 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
2602 }
2603
2604
2605 for {
2606 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
2607 if err != nil {
2608 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
2609 }
2610 if fieldTypeId == thrift.STOP { break; }
2611 switch fieldId {
2612 case 0:
2613 if fieldTypeId == thrift.LIST {
2614 if err := p.ReadField0(ctx, iprot); err != nil {
2615 return err
2616 }
2617 } else {
2618 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
2619 return err
2620 }
2621 }
2622 default:
2623 if err := iprot.Skip(ctx, fieldTypeId); err != nil {
2624 return err
2625 }
2626 }
2627 if err := iprot.ReadFieldEnd(ctx); err != nil {
2628 return err
2629 }
2630 }
2631 if err := iprot.ReadStructEnd(ctx); err != nil {
2632 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
2633 }
2634 return nil
2635}
2636
2637func (p *CollectorSubmitBatchesResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
2638 _, size, err := iprot.ReadListBegin(ctx)
2639 if err != nil {
2640 return thrift.PrependError("error reading list begin: ", err)
2641 }
2642 tSlice := make([]*BatchSubmitResponse, 0, size)
2643 p.Success = tSlice
2644 for i := 0; i < size; i ++ {
2645 _elem18 := &BatchSubmitResponse{}
2646 if err := _elem18.Read(ctx, iprot); err != nil {
2647 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem18), err)
2648 }
2649 p.Success = append(p.Success, _elem18)
2650 }
2651 if err := iprot.ReadListEnd(ctx); err != nil {
2652 return thrift.PrependError("error reading list end: ", err)
2653 }
2654 return nil
2655}
2656
2657func (p *CollectorSubmitBatchesResult) Write(ctx context.Context, oprot thrift.TProtocol) error {
2658 if err := oprot.WriteStructBegin(ctx, "submitBatches_result"); err != nil {
2659 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
2660 if p != nil {
2661 if err := p.writeField0(ctx, oprot); err != nil { return err }
2662 }
2663 if err := oprot.WriteFieldStop(ctx); err != nil {
2664 return thrift.PrependError("write field stop error: ", err) }
2665 if err := oprot.WriteStructEnd(ctx); err != nil {
2666 return thrift.PrependError("write struct stop error: ", err) }
2667 return nil
2668}
2669
2670func (p *CollectorSubmitBatchesResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) {
2671 if p.IsSetSuccess() {
2672 if err := oprot.WriteFieldBegin(ctx, "success", thrift.LIST, 0); err != nil {
2673 return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
2674 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Success)); err != nil {
2675 return thrift.PrependError("error writing list begin: ", err)
2676 }
2677 for _, v := range p.Success {
2678 if err := v.Write(ctx, oprot); err != nil {
2679 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
2680 }
2681 }
2682 if err := oprot.WriteListEnd(ctx); err != nil {
2683 return thrift.PrependError("error writing list end: ", err)
2684 }
2685 if err := oprot.WriteFieldEnd(ctx); err != nil {
2686 return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
2687 }
2688 return err
2689}
2690
2691func (p *CollectorSubmitBatchesResult) String() string {
2692 if p == nil {
2693 return "<nil>"
2694 }
2695 return fmt.Sprintf("CollectorSubmitBatchesResult(%+v)", *p)
2696}
2697
2698