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