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