1// Autogenerated by Thrift Compiler (0.9.3) 2// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 3 4package jaeger 5 6import ( 7 "bytes" 8 "fmt" 9 "github.com/uber/jaeger-client-go/thrift" 10) 11 12// (needed to ensure safety because of naive import list construction.) 13var _ = thrift.ZERO 14var _ = fmt.Printf 15var _ = bytes.Equal 16 17var GoUnusedProtection__ int 18 19type TagType int64 20 21const ( 22 TagType_STRING TagType = 0 23 TagType_DOUBLE TagType = 1 24 TagType_BOOL TagType = 2 25 TagType_LONG TagType = 3 26 TagType_BINARY TagType = 4 27) 28 29func (p TagType) String() string { 30 switch p { 31 case TagType_STRING: 32 return "STRING" 33 case TagType_DOUBLE: 34 return "DOUBLE" 35 case TagType_BOOL: 36 return "BOOL" 37 case TagType_LONG: 38 return "LONG" 39 case TagType_BINARY: 40 return "BINARY" 41 } 42 return "<UNSET>" 43} 44 45func TagTypeFromString(s string) (TagType, error) { 46 switch s { 47 case "STRING": 48 return TagType_STRING, nil 49 case "DOUBLE": 50 return TagType_DOUBLE, nil 51 case "BOOL": 52 return TagType_BOOL, nil 53 case "LONG": 54 return TagType_LONG, nil 55 case "BINARY": 56 return TagType_BINARY, nil 57 } 58 return TagType(0), fmt.Errorf("not a valid TagType string") 59} 60 61func TagTypePtr(v TagType) *TagType { return &v } 62 63func (p TagType) MarshalText() ([]byte, error) { 64 return []byte(p.String()), nil 65} 66 67func (p *TagType) UnmarshalText(text []byte) error { 68 q, err := TagTypeFromString(string(text)) 69 if err != nil { 70 return err 71 } 72 *p = q 73 return nil 74} 75 76type SpanRefType int64 77 78const ( 79 SpanRefType_CHILD_OF SpanRefType = 0 80 SpanRefType_FOLLOWS_FROM SpanRefType = 1 81) 82 83func (p SpanRefType) String() string { 84 switch p { 85 case SpanRefType_CHILD_OF: 86 return "CHILD_OF" 87 case SpanRefType_FOLLOWS_FROM: 88 return "FOLLOWS_FROM" 89 } 90 return "<UNSET>" 91} 92 93func SpanRefTypeFromString(s string) (SpanRefType, error) { 94 switch s { 95 case "CHILD_OF": 96 return SpanRefType_CHILD_OF, nil 97 case "FOLLOWS_FROM": 98 return SpanRefType_FOLLOWS_FROM, nil 99 } 100 return SpanRefType(0), fmt.Errorf("not a valid SpanRefType string") 101} 102 103func SpanRefTypePtr(v SpanRefType) *SpanRefType { return &v } 104 105func (p SpanRefType) MarshalText() ([]byte, error) { 106 return []byte(p.String()), nil 107} 108 109func (p *SpanRefType) UnmarshalText(text []byte) error { 110 q, err := SpanRefTypeFromString(string(text)) 111 if err != nil { 112 return err 113 } 114 *p = q 115 return nil 116} 117 118// Attributes: 119// - Key 120// - VType 121// - VStr 122// - VDouble 123// - VBool 124// - VLong 125// - VBinary 126type Tag struct { 127 Key string `thrift:"key,1,required" json:"key"` 128 VType TagType `thrift:"vType,2,required" json:"vType"` 129 VStr *string `thrift:"vStr,3" json:"vStr,omitempty"` 130 VDouble *float64 `thrift:"vDouble,4" json:"vDouble,omitempty"` 131 VBool *bool `thrift:"vBool,5" json:"vBool,omitempty"` 132 VLong *int64 `thrift:"vLong,6" json:"vLong,omitempty"` 133 VBinary []byte `thrift:"vBinary,7" json:"vBinary,omitempty"` 134} 135 136func NewTag() *Tag { 137 return &Tag{} 138} 139 140func (p *Tag) GetKey() string { 141 return p.Key 142} 143 144func (p *Tag) GetVType() TagType { 145 return p.VType 146} 147 148var Tag_VStr_DEFAULT string 149 150func (p *Tag) GetVStr() string { 151 if !p.IsSetVStr() { 152 return Tag_VStr_DEFAULT 153 } 154 return *p.VStr 155} 156 157var Tag_VDouble_DEFAULT float64 158 159func (p *Tag) GetVDouble() float64 { 160 if !p.IsSetVDouble() { 161 return Tag_VDouble_DEFAULT 162 } 163 return *p.VDouble 164} 165 166var Tag_VBool_DEFAULT bool 167 168func (p *Tag) GetVBool() bool { 169 if !p.IsSetVBool() { 170 return Tag_VBool_DEFAULT 171 } 172 return *p.VBool 173} 174 175var Tag_VLong_DEFAULT int64 176 177func (p *Tag) GetVLong() int64 { 178 if !p.IsSetVLong() { 179 return Tag_VLong_DEFAULT 180 } 181 return *p.VLong 182} 183 184var Tag_VBinary_DEFAULT []byte 185 186func (p *Tag) GetVBinary() []byte { 187 return p.VBinary 188} 189func (p *Tag) IsSetVStr() bool { 190 return p.VStr != nil 191} 192 193func (p *Tag) IsSetVDouble() bool { 194 return p.VDouble != nil 195} 196 197func (p *Tag) IsSetVBool() bool { 198 return p.VBool != nil 199} 200 201func (p *Tag) IsSetVLong() bool { 202 return p.VLong != nil 203} 204 205func (p *Tag) IsSetVBinary() bool { 206 return p.VBinary != nil 207} 208 209func (p *Tag) Read(iprot thrift.TProtocol) error { 210 if _, err := iprot.ReadStructBegin(); err != nil { 211 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 212 } 213 214 var issetKey bool = false 215 var issetVType bool = false 216 217 for { 218 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() 219 if err != nil { 220 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 221 } 222 if fieldTypeId == thrift.STOP { 223 break 224 } 225 switch fieldId { 226 case 1: 227 if err := p.readField1(iprot); err != nil { 228 return err 229 } 230 issetKey = true 231 case 2: 232 if err := p.readField2(iprot); err != nil { 233 return err 234 } 235 issetVType = true 236 case 3: 237 if err := p.readField3(iprot); err != nil { 238 return err 239 } 240 case 4: 241 if err := p.readField4(iprot); err != nil { 242 return err 243 } 244 case 5: 245 if err := p.readField5(iprot); err != nil { 246 return err 247 } 248 case 6: 249 if err := p.readField6(iprot); err != nil { 250 return err 251 } 252 case 7: 253 if err := p.readField7(iprot); err != nil { 254 return err 255 } 256 default: 257 if err := iprot.Skip(fieldTypeId); err != nil { 258 return err 259 } 260 } 261 if err := iprot.ReadFieldEnd(); err != nil { 262 return err 263 } 264 } 265 if err := iprot.ReadStructEnd(); err != nil { 266 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 267 } 268 if !issetKey { 269 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Key is not set")) 270 } 271 if !issetVType { 272 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field VType is not set")) 273 } 274 return nil 275} 276 277func (p *Tag) readField1(iprot thrift.TProtocol) error { 278 if v, err := iprot.ReadString(); err != nil { 279 return thrift.PrependError("error reading field 1: ", err) 280 } else { 281 p.Key = v 282 } 283 return nil 284} 285 286func (p *Tag) readField2(iprot thrift.TProtocol) error { 287 if v, err := iprot.ReadI32(); err != nil { 288 return thrift.PrependError("error reading field 2: ", err) 289 } else { 290 temp := TagType(v) 291 p.VType = temp 292 } 293 return nil 294} 295 296func (p *Tag) readField3(iprot thrift.TProtocol) error { 297 if v, err := iprot.ReadString(); err != nil { 298 return thrift.PrependError("error reading field 3: ", err) 299 } else { 300 p.VStr = &v 301 } 302 return nil 303} 304 305func (p *Tag) readField4(iprot thrift.TProtocol) error { 306 if v, err := iprot.ReadDouble(); err != nil { 307 return thrift.PrependError("error reading field 4: ", err) 308 } else { 309 p.VDouble = &v 310 } 311 return nil 312} 313 314func (p *Tag) readField5(iprot thrift.TProtocol) error { 315 if v, err := iprot.ReadBool(); err != nil { 316 return thrift.PrependError("error reading field 5: ", err) 317 } else { 318 p.VBool = &v 319 } 320 return nil 321} 322 323func (p *Tag) readField6(iprot thrift.TProtocol) error { 324 if v, err := iprot.ReadI64(); err != nil { 325 return thrift.PrependError("error reading field 6: ", err) 326 } else { 327 p.VLong = &v 328 } 329 return nil 330} 331 332func (p *Tag) readField7(iprot thrift.TProtocol) error { 333 if v, err := iprot.ReadBinary(); err != nil { 334 return thrift.PrependError("error reading field 7: ", err) 335 } else { 336 p.VBinary = v 337 } 338 return nil 339} 340 341func (p *Tag) Write(oprot thrift.TProtocol) error { 342 if err := oprot.WriteStructBegin("Tag"); err != nil { 343 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 344 } 345 if err := p.writeField1(oprot); err != nil { 346 return err 347 } 348 if err := p.writeField2(oprot); err != nil { 349 return err 350 } 351 if err := p.writeField3(oprot); err != nil { 352 return err 353 } 354 if err := p.writeField4(oprot); err != nil { 355 return err 356 } 357 if err := p.writeField5(oprot); err != nil { 358 return err 359 } 360 if err := p.writeField6(oprot); err != nil { 361 return err 362 } 363 if err := p.writeField7(oprot); err != nil { 364 return err 365 } 366 if err := oprot.WriteFieldStop(); err != nil { 367 return thrift.PrependError("write field stop error: ", err) 368 } 369 if err := oprot.WriteStructEnd(); err != nil { 370 return thrift.PrependError("write struct stop error: ", err) 371 } 372 return nil 373} 374 375func (p *Tag) writeField1(oprot thrift.TProtocol) (err error) { 376 if err := oprot.WriteFieldBegin("key", thrift.STRING, 1); err != nil { 377 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) 378 } 379 if err := oprot.WriteString(string(p.Key)); err != nil { 380 return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err) 381 } 382 if err := oprot.WriteFieldEnd(); err != nil { 383 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) 384 } 385 return err 386} 387 388func (p *Tag) writeField2(oprot thrift.TProtocol) (err error) { 389 if err := oprot.WriteFieldBegin("vType", thrift.I32, 2); err != nil { 390 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:vType: ", p), err) 391 } 392 if err := oprot.WriteI32(int32(p.VType)); err != nil { 393 return thrift.PrependError(fmt.Sprintf("%T.vType (2) field write error: ", p), err) 394 } 395 if err := oprot.WriteFieldEnd(); err != nil { 396 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:vType: ", p), err) 397 } 398 return err 399} 400 401func (p *Tag) writeField3(oprot thrift.TProtocol) (err error) { 402 if p.IsSetVStr() { 403 if err := oprot.WriteFieldBegin("vStr", thrift.STRING, 3); err != nil { 404 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:vStr: ", p), err) 405 } 406 if err := oprot.WriteString(string(*p.VStr)); err != nil { 407 return thrift.PrependError(fmt.Sprintf("%T.vStr (3) field write error: ", p), err) 408 } 409 if err := oprot.WriteFieldEnd(); err != nil { 410 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:vStr: ", p), err) 411 } 412 } 413 return err 414} 415 416func (p *Tag) writeField4(oprot thrift.TProtocol) (err error) { 417 if p.IsSetVDouble() { 418 if err := oprot.WriteFieldBegin("vDouble", thrift.DOUBLE, 4); err != nil { 419 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:vDouble: ", p), err) 420 } 421 if err := oprot.WriteDouble(float64(*p.VDouble)); err != nil { 422 return thrift.PrependError(fmt.Sprintf("%T.vDouble (4) field write error: ", p), err) 423 } 424 if err := oprot.WriteFieldEnd(); err != nil { 425 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:vDouble: ", p), err) 426 } 427 } 428 return err 429} 430 431func (p *Tag) writeField5(oprot thrift.TProtocol) (err error) { 432 if p.IsSetVBool() { 433 if err := oprot.WriteFieldBegin("vBool", thrift.BOOL, 5); err != nil { 434 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:vBool: ", p), err) 435 } 436 if err := oprot.WriteBool(bool(*p.VBool)); err != nil { 437 return thrift.PrependError(fmt.Sprintf("%T.vBool (5) field write error: ", p), err) 438 } 439 if err := oprot.WriteFieldEnd(); err != nil { 440 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:vBool: ", p), err) 441 } 442 } 443 return err 444} 445 446func (p *Tag) writeField6(oprot thrift.TProtocol) (err error) { 447 if p.IsSetVLong() { 448 if err := oprot.WriteFieldBegin("vLong", thrift.I64, 6); err != nil { 449 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:vLong: ", p), err) 450 } 451 if err := oprot.WriteI64(int64(*p.VLong)); err != nil { 452 return thrift.PrependError(fmt.Sprintf("%T.vLong (6) field write error: ", p), err) 453 } 454 if err := oprot.WriteFieldEnd(); err != nil { 455 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:vLong: ", p), err) 456 } 457 } 458 return err 459} 460 461func (p *Tag) writeField7(oprot thrift.TProtocol) (err error) { 462 if p.IsSetVBinary() { 463 if err := oprot.WriteFieldBegin("vBinary", thrift.STRING, 7); err != nil { 464 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:vBinary: ", p), err) 465 } 466 if err := oprot.WriteBinary(p.VBinary); err != nil { 467 return thrift.PrependError(fmt.Sprintf("%T.vBinary (7) field write error: ", p), err) 468 } 469 if err := oprot.WriteFieldEnd(); err != nil { 470 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:vBinary: ", p), err) 471 } 472 } 473 return err 474} 475 476func (p *Tag) String() string { 477 if p == nil { 478 return "<nil>" 479 } 480 return fmt.Sprintf("Tag(%+v)", *p) 481} 482 483// Attributes: 484// - Timestamp 485// - Fields 486type Log struct { 487 Timestamp int64 `thrift:"timestamp,1,required" json:"timestamp"` 488 Fields []*Tag `thrift:"fields,2,required" json:"fields"` 489} 490 491func NewLog() *Log { 492 return &Log{} 493} 494 495func (p *Log) GetTimestamp() int64 { 496 return p.Timestamp 497} 498 499func (p *Log) GetFields() []*Tag { 500 return p.Fields 501} 502func (p *Log) Read(iprot thrift.TProtocol) error { 503 if _, err := iprot.ReadStructBegin(); err != nil { 504 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 505 } 506 507 var issetTimestamp bool = false 508 var issetFields bool = false 509 510 for { 511 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() 512 if err != nil { 513 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 514 } 515 if fieldTypeId == thrift.STOP { 516 break 517 } 518 switch fieldId { 519 case 1: 520 if err := p.readField1(iprot); err != nil { 521 return err 522 } 523 issetTimestamp = true 524 case 2: 525 if err := p.readField2(iprot); err != nil { 526 return err 527 } 528 issetFields = true 529 default: 530 if err := iprot.Skip(fieldTypeId); err != nil { 531 return err 532 } 533 } 534 if err := iprot.ReadFieldEnd(); err != nil { 535 return err 536 } 537 } 538 if err := iprot.ReadStructEnd(); err != nil { 539 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 540 } 541 if !issetTimestamp { 542 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Timestamp is not set")) 543 } 544 if !issetFields { 545 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Fields is not set")) 546 } 547 return nil 548} 549 550func (p *Log) readField1(iprot thrift.TProtocol) error { 551 if v, err := iprot.ReadI64(); err != nil { 552 return thrift.PrependError("error reading field 1: ", err) 553 } else { 554 p.Timestamp = v 555 } 556 return nil 557} 558 559func (p *Log) readField2(iprot thrift.TProtocol) error { 560 _, size, err := iprot.ReadListBegin() 561 if err != nil { 562 return thrift.PrependError("error reading list begin: ", err) 563 } 564 tSlice := make([]*Tag, 0, size) 565 p.Fields = tSlice 566 for i := 0; i < size; i++ { 567 _elem0 := &Tag{} 568 if err := _elem0.Read(iprot); err != nil { 569 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem0), err) 570 } 571 p.Fields = append(p.Fields, _elem0) 572 } 573 if err := iprot.ReadListEnd(); err != nil { 574 return thrift.PrependError("error reading list end: ", err) 575 } 576 return nil 577} 578 579func (p *Log) Write(oprot thrift.TProtocol) error { 580 if err := oprot.WriteStructBegin("Log"); err != nil { 581 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 582 } 583 if err := p.writeField1(oprot); err != nil { 584 return err 585 } 586 if err := p.writeField2(oprot); err != nil { 587 return err 588 } 589 if err := oprot.WriteFieldStop(); err != nil { 590 return thrift.PrependError("write field stop error: ", err) 591 } 592 if err := oprot.WriteStructEnd(); err != nil { 593 return thrift.PrependError("write struct stop error: ", err) 594 } 595 return nil 596} 597 598func (p *Log) writeField1(oprot thrift.TProtocol) (err error) { 599 if err := oprot.WriteFieldBegin("timestamp", thrift.I64, 1); err != nil { 600 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:timestamp: ", p), err) 601 } 602 if err := oprot.WriteI64(int64(p.Timestamp)); err != nil { 603 return thrift.PrependError(fmt.Sprintf("%T.timestamp (1) field write error: ", p), err) 604 } 605 if err := oprot.WriteFieldEnd(); err != nil { 606 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:timestamp: ", p), err) 607 } 608 return err 609} 610 611func (p *Log) writeField2(oprot thrift.TProtocol) (err error) { 612 if err := oprot.WriteFieldBegin("fields", thrift.LIST, 2); err != nil { 613 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:fields: ", p), err) 614 } 615 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Fields)); err != nil { 616 return thrift.PrependError("error writing list begin: ", err) 617 } 618 for _, v := range p.Fields { 619 if err := v.Write(oprot); err != nil { 620 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 621 } 622 } 623 if err := oprot.WriteListEnd(); err != nil { 624 return thrift.PrependError("error writing list end: ", err) 625 } 626 if err := oprot.WriteFieldEnd(); err != nil { 627 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:fields: ", p), err) 628 } 629 return err 630} 631 632func (p *Log) String() string { 633 if p == nil { 634 return "<nil>" 635 } 636 return fmt.Sprintf("Log(%+v)", *p) 637} 638 639// Attributes: 640// - RefType 641// - TraceIdLow 642// - TraceIdHigh 643// - SpanId 644type SpanRef struct { 645 RefType SpanRefType `thrift:"refType,1,required" json:"refType"` 646 TraceIdLow int64 `thrift:"traceIdLow,2,required" json:"traceIdLow"` 647 TraceIdHigh int64 `thrift:"traceIdHigh,3,required" json:"traceIdHigh"` 648 SpanId int64 `thrift:"spanId,4,required" json:"spanId"` 649} 650 651func NewSpanRef() *SpanRef { 652 return &SpanRef{} 653} 654 655func (p *SpanRef) GetRefType() SpanRefType { 656 return p.RefType 657} 658 659func (p *SpanRef) GetTraceIdLow() int64 { 660 return p.TraceIdLow 661} 662 663func (p *SpanRef) GetTraceIdHigh() int64 { 664 return p.TraceIdHigh 665} 666 667func (p *SpanRef) GetSpanId() int64 { 668 return p.SpanId 669} 670func (p *SpanRef) Read(iprot thrift.TProtocol) error { 671 if _, err := iprot.ReadStructBegin(); err != nil { 672 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 673 } 674 675 var issetRefType bool = false 676 var issetTraceIdLow bool = false 677 var issetTraceIdHigh bool = false 678 var issetSpanId bool = false 679 680 for { 681 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() 682 if err != nil { 683 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 684 } 685 if fieldTypeId == thrift.STOP { 686 break 687 } 688 switch fieldId { 689 case 1: 690 if err := p.readField1(iprot); err != nil { 691 return err 692 } 693 issetRefType = true 694 case 2: 695 if err := p.readField2(iprot); err != nil { 696 return err 697 } 698 issetTraceIdLow = true 699 case 3: 700 if err := p.readField3(iprot); err != nil { 701 return err 702 } 703 issetTraceIdHigh = true 704 case 4: 705 if err := p.readField4(iprot); err != nil { 706 return err 707 } 708 issetSpanId = true 709 default: 710 if err := iprot.Skip(fieldTypeId); err != nil { 711 return err 712 } 713 } 714 if err := iprot.ReadFieldEnd(); err != nil { 715 return err 716 } 717 } 718 if err := iprot.ReadStructEnd(); err != nil { 719 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 720 } 721 if !issetRefType { 722 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field RefType is not set")) 723 } 724 if !issetTraceIdLow { 725 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdLow is not set")) 726 } 727 if !issetTraceIdHigh { 728 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdHigh is not set")) 729 } 730 if !issetSpanId { 731 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SpanId is not set")) 732 } 733 return nil 734} 735 736func (p *SpanRef) readField1(iprot thrift.TProtocol) error { 737 if v, err := iprot.ReadI32(); err != nil { 738 return thrift.PrependError("error reading field 1: ", err) 739 } else { 740 temp := SpanRefType(v) 741 p.RefType = temp 742 } 743 return nil 744} 745 746func (p *SpanRef) readField2(iprot thrift.TProtocol) error { 747 if v, err := iprot.ReadI64(); err != nil { 748 return thrift.PrependError("error reading field 2: ", err) 749 } else { 750 p.TraceIdLow = v 751 } 752 return nil 753} 754 755func (p *SpanRef) readField3(iprot thrift.TProtocol) error { 756 if v, err := iprot.ReadI64(); err != nil { 757 return thrift.PrependError("error reading field 3: ", err) 758 } else { 759 p.TraceIdHigh = v 760 } 761 return nil 762} 763 764func (p *SpanRef) readField4(iprot thrift.TProtocol) error { 765 if v, err := iprot.ReadI64(); err != nil { 766 return thrift.PrependError("error reading field 4: ", err) 767 } else { 768 p.SpanId = v 769 } 770 return nil 771} 772 773func (p *SpanRef) Write(oprot thrift.TProtocol) error { 774 if err := oprot.WriteStructBegin("SpanRef"); err != nil { 775 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 776 } 777 if err := p.writeField1(oprot); err != nil { 778 return err 779 } 780 if err := p.writeField2(oprot); err != nil { 781 return err 782 } 783 if err := p.writeField3(oprot); err != nil { 784 return err 785 } 786 if err := p.writeField4(oprot); err != nil { 787 return err 788 } 789 if err := oprot.WriteFieldStop(); err != nil { 790 return thrift.PrependError("write field stop error: ", err) 791 } 792 if err := oprot.WriteStructEnd(); err != nil { 793 return thrift.PrependError("write struct stop error: ", err) 794 } 795 return nil 796} 797 798func (p *SpanRef) writeField1(oprot thrift.TProtocol) (err error) { 799 if err := oprot.WriteFieldBegin("refType", thrift.I32, 1); err != nil { 800 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:refType: ", p), err) 801 } 802 if err := oprot.WriteI32(int32(p.RefType)); err != nil { 803 return thrift.PrependError(fmt.Sprintf("%T.refType (1) field write error: ", p), err) 804 } 805 if err := oprot.WriteFieldEnd(); err != nil { 806 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:refType: ", p), err) 807 } 808 return err 809} 810 811func (p *SpanRef) writeField2(oprot thrift.TProtocol) (err error) { 812 if err := oprot.WriteFieldBegin("traceIdLow", thrift.I64, 2); err != nil { 813 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:traceIdLow: ", p), err) 814 } 815 if err := oprot.WriteI64(int64(p.TraceIdLow)); err != nil { 816 return thrift.PrependError(fmt.Sprintf("%T.traceIdLow (2) field write error: ", p), err) 817 } 818 if err := oprot.WriteFieldEnd(); err != nil { 819 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:traceIdLow: ", p), err) 820 } 821 return err 822} 823 824func (p *SpanRef) writeField3(oprot thrift.TProtocol) (err error) { 825 if err := oprot.WriteFieldBegin("traceIdHigh", thrift.I64, 3); err != nil { 826 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:traceIdHigh: ", p), err) 827 } 828 if err := oprot.WriteI64(int64(p.TraceIdHigh)); err != nil { 829 return thrift.PrependError(fmt.Sprintf("%T.traceIdHigh (3) field write error: ", p), err) 830 } 831 if err := oprot.WriteFieldEnd(); err != nil { 832 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:traceIdHigh: ", p), err) 833 } 834 return err 835} 836 837func (p *SpanRef) writeField4(oprot thrift.TProtocol) (err error) { 838 if err := oprot.WriteFieldBegin("spanId", thrift.I64, 4); err != nil { 839 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:spanId: ", p), err) 840 } 841 if err := oprot.WriteI64(int64(p.SpanId)); err != nil { 842 return thrift.PrependError(fmt.Sprintf("%T.spanId (4) field write error: ", p), err) 843 } 844 if err := oprot.WriteFieldEnd(); err != nil { 845 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:spanId: ", p), err) 846 } 847 return err 848} 849 850func (p *SpanRef) String() string { 851 if p == nil { 852 return "<nil>" 853 } 854 return fmt.Sprintf("SpanRef(%+v)", *p) 855} 856 857// Attributes: 858// - TraceIdLow 859// - TraceIdHigh 860// - SpanId 861// - ParentSpanId 862// - OperationName 863// - References 864// - Flags 865// - StartTime 866// - Duration 867// - Tags 868// - Logs 869type Span struct { 870 TraceIdLow int64 `thrift:"traceIdLow,1,required" json:"traceIdLow"` 871 TraceIdHigh int64 `thrift:"traceIdHigh,2,required" json:"traceIdHigh"` 872 SpanId int64 `thrift:"spanId,3,required" json:"spanId"` 873 ParentSpanId int64 `thrift:"parentSpanId,4,required" json:"parentSpanId"` 874 OperationName string `thrift:"operationName,5,required" json:"operationName"` 875 References []*SpanRef `thrift:"references,6" json:"references,omitempty"` 876 Flags int32 `thrift:"flags,7,required" json:"flags"` 877 StartTime int64 `thrift:"startTime,8,required" json:"startTime"` 878 Duration int64 `thrift:"duration,9,required" json:"duration"` 879 Tags []*Tag `thrift:"tags,10" json:"tags,omitempty"` 880 Logs []*Log `thrift:"logs,11" json:"logs,omitempty"` 881} 882 883func NewSpan() *Span { 884 return &Span{} 885} 886 887func (p *Span) GetTraceIdLow() int64 { 888 return p.TraceIdLow 889} 890 891func (p *Span) GetTraceIdHigh() int64 { 892 return p.TraceIdHigh 893} 894 895func (p *Span) GetSpanId() int64 { 896 return p.SpanId 897} 898 899func (p *Span) GetParentSpanId() int64 { 900 return p.ParentSpanId 901} 902 903func (p *Span) GetOperationName() string { 904 return p.OperationName 905} 906 907var Span_References_DEFAULT []*SpanRef 908 909func (p *Span) GetReferences() []*SpanRef { 910 return p.References 911} 912 913func (p *Span) GetFlags() int32 { 914 return p.Flags 915} 916 917func (p *Span) GetStartTime() int64 { 918 return p.StartTime 919} 920 921func (p *Span) GetDuration() int64 { 922 return p.Duration 923} 924 925var Span_Tags_DEFAULT []*Tag 926 927func (p *Span) GetTags() []*Tag { 928 return p.Tags 929} 930 931var Span_Logs_DEFAULT []*Log 932 933func (p *Span) GetLogs() []*Log { 934 return p.Logs 935} 936func (p *Span) IsSetReferences() bool { 937 return p.References != nil 938} 939 940func (p *Span) IsSetTags() bool { 941 return p.Tags != nil 942} 943 944func (p *Span) IsSetLogs() bool { 945 return p.Logs != nil 946} 947 948func (p *Span) Read(iprot thrift.TProtocol) error { 949 if _, err := iprot.ReadStructBegin(); err != nil { 950 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 951 } 952 953 var issetTraceIdLow bool = false 954 var issetTraceIdHigh bool = false 955 var issetSpanId bool = false 956 var issetParentSpanId bool = false 957 var issetOperationName bool = false 958 var issetFlags bool = false 959 var issetStartTime bool = false 960 var issetDuration bool = false 961 962 for { 963 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() 964 if err != nil { 965 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 966 } 967 if fieldTypeId == thrift.STOP { 968 break 969 } 970 switch fieldId { 971 case 1: 972 if err := p.readField1(iprot); err != nil { 973 return err 974 } 975 issetTraceIdLow = true 976 case 2: 977 if err := p.readField2(iprot); err != nil { 978 return err 979 } 980 issetTraceIdHigh = true 981 case 3: 982 if err := p.readField3(iprot); err != nil { 983 return err 984 } 985 issetSpanId = true 986 case 4: 987 if err := p.readField4(iprot); err != nil { 988 return err 989 } 990 issetParentSpanId = true 991 case 5: 992 if err := p.readField5(iprot); err != nil { 993 return err 994 } 995 issetOperationName = true 996 case 6: 997 if err := p.readField6(iprot); err != nil { 998 return err 999 } 1000 case 7: 1001 if err := p.readField7(iprot); err != nil { 1002 return err 1003 } 1004 issetFlags = true 1005 case 8: 1006 if err := p.readField8(iprot); err != nil { 1007 return err 1008 } 1009 issetStartTime = true 1010 case 9: 1011 if err := p.readField9(iprot); err != nil { 1012 return err 1013 } 1014 issetDuration = true 1015 case 10: 1016 if err := p.readField10(iprot); err != nil { 1017 return err 1018 } 1019 case 11: 1020 if err := p.readField11(iprot); err != nil { 1021 return err 1022 } 1023 default: 1024 if err := iprot.Skip(fieldTypeId); err != nil { 1025 return err 1026 } 1027 } 1028 if err := iprot.ReadFieldEnd(); err != nil { 1029 return err 1030 } 1031 } 1032 if err := iprot.ReadStructEnd(); err != nil { 1033 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1034 } 1035 if !issetTraceIdLow { 1036 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdLow is not set")) 1037 } 1038 if !issetTraceIdHigh { 1039 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdHigh is not set")) 1040 } 1041 if !issetSpanId { 1042 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SpanId is not set")) 1043 } 1044 if !issetParentSpanId { 1045 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ParentSpanId is not set")) 1046 } 1047 if !issetOperationName { 1048 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field OperationName is not set")) 1049 } 1050 if !issetFlags { 1051 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Flags is not set")) 1052 } 1053 if !issetStartTime { 1054 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StartTime is not set")) 1055 } 1056 if !issetDuration { 1057 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Duration is not set")) 1058 } 1059 return nil 1060} 1061 1062func (p *Span) readField1(iprot thrift.TProtocol) error { 1063 if v, err := iprot.ReadI64(); err != nil { 1064 return thrift.PrependError("error reading field 1: ", err) 1065 } else { 1066 p.TraceIdLow = v 1067 } 1068 return nil 1069} 1070 1071func (p *Span) readField2(iprot thrift.TProtocol) error { 1072 if v, err := iprot.ReadI64(); err != nil { 1073 return thrift.PrependError("error reading field 2: ", err) 1074 } else { 1075 p.TraceIdHigh = v 1076 } 1077 return nil 1078} 1079 1080func (p *Span) readField3(iprot thrift.TProtocol) error { 1081 if v, err := iprot.ReadI64(); err != nil { 1082 return thrift.PrependError("error reading field 3: ", err) 1083 } else { 1084 p.SpanId = v 1085 } 1086 return nil 1087} 1088 1089func (p *Span) readField4(iprot thrift.TProtocol) error { 1090 if v, err := iprot.ReadI64(); err != nil { 1091 return thrift.PrependError("error reading field 4: ", err) 1092 } else { 1093 p.ParentSpanId = v 1094 } 1095 return nil 1096} 1097 1098func (p *Span) readField5(iprot thrift.TProtocol) error { 1099 if v, err := iprot.ReadString(); err != nil { 1100 return thrift.PrependError("error reading field 5: ", err) 1101 } else { 1102 p.OperationName = v 1103 } 1104 return nil 1105} 1106 1107func (p *Span) readField6(iprot thrift.TProtocol) error { 1108 _, size, err := iprot.ReadListBegin() 1109 if err != nil { 1110 return thrift.PrependError("error reading list begin: ", err) 1111 } 1112 tSlice := make([]*SpanRef, 0, size) 1113 p.References = tSlice 1114 for i := 0; i < size; i++ { 1115 _elem1 := &SpanRef{} 1116 if err := _elem1.Read(iprot); err != nil { 1117 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem1), err) 1118 } 1119 p.References = append(p.References, _elem1) 1120 } 1121 if err := iprot.ReadListEnd(); err != nil { 1122 return thrift.PrependError("error reading list end: ", err) 1123 } 1124 return nil 1125} 1126 1127func (p *Span) readField7(iprot thrift.TProtocol) error { 1128 if v, err := iprot.ReadI32(); err != nil { 1129 return thrift.PrependError("error reading field 7: ", err) 1130 } else { 1131 p.Flags = v 1132 } 1133 return nil 1134} 1135 1136func (p *Span) readField8(iprot thrift.TProtocol) error { 1137 if v, err := iprot.ReadI64(); err != nil { 1138 return thrift.PrependError("error reading field 8: ", err) 1139 } else { 1140 p.StartTime = v 1141 } 1142 return nil 1143} 1144 1145func (p *Span) readField9(iprot thrift.TProtocol) error { 1146 if v, err := iprot.ReadI64(); err != nil { 1147 return thrift.PrependError("error reading field 9: ", err) 1148 } else { 1149 p.Duration = v 1150 } 1151 return nil 1152} 1153 1154func (p *Span) readField10(iprot thrift.TProtocol) error { 1155 _, size, err := iprot.ReadListBegin() 1156 if err != nil { 1157 return thrift.PrependError("error reading list begin: ", err) 1158 } 1159 tSlice := make([]*Tag, 0, size) 1160 p.Tags = tSlice 1161 for i := 0; i < size; i++ { 1162 _elem2 := &Tag{} 1163 if err := _elem2.Read(iprot); err != nil { 1164 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem2), err) 1165 } 1166 p.Tags = append(p.Tags, _elem2) 1167 } 1168 if err := iprot.ReadListEnd(); err != nil { 1169 return thrift.PrependError("error reading list end: ", err) 1170 } 1171 return nil 1172} 1173 1174func (p *Span) readField11(iprot thrift.TProtocol) error { 1175 _, size, err := iprot.ReadListBegin() 1176 if err != nil { 1177 return thrift.PrependError("error reading list begin: ", err) 1178 } 1179 tSlice := make([]*Log, 0, size) 1180 p.Logs = tSlice 1181 for i := 0; i < size; i++ { 1182 _elem3 := &Log{} 1183 if err := _elem3.Read(iprot); err != nil { 1184 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem3), err) 1185 } 1186 p.Logs = append(p.Logs, _elem3) 1187 } 1188 if err := iprot.ReadListEnd(); err != nil { 1189 return thrift.PrependError("error reading list end: ", err) 1190 } 1191 return nil 1192} 1193 1194func (p *Span) Write(oprot thrift.TProtocol) error { 1195 if err := oprot.WriteStructBegin("Span"); err != nil { 1196 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1197 } 1198 if err := p.writeField1(oprot); err != nil { 1199 return err 1200 } 1201 if err := p.writeField2(oprot); err != nil { 1202 return err 1203 } 1204 if err := p.writeField3(oprot); err != nil { 1205 return err 1206 } 1207 if err := p.writeField4(oprot); err != nil { 1208 return err 1209 } 1210 if err := p.writeField5(oprot); err != nil { 1211 return err 1212 } 1213 if err := p.writeField6(oprot); err != nil { 1214 return err 1215 } 1216 if err := p.writeField7(oprot); err != nil { 1217 return err 1218 } 1219 if err := p.writeField8(oprot); err != nil { 1220 return err 1221 } 1222 if err := p.writeField9(oprot); err != nil { 1223 return err 1224 } 1225 if err := p.writeField10(oprot); err != nil { 1226 return err 1227 } 1228 if err := p.writeField11(oprot); err != nil { 1229 return err 1230 } 1231 if err := oprot.WriteFieldStop(); err != nil { 1232 return thrift.PrependError("write field stop error: ", err) 1233 } 1234 if err := oprot.WriteStructEnd(); err != nil { 1235 return thrift.PrependError("write struct stop error: ", err) 1236 } 1237 return nil 1238} 1239 1240func (p *Span) writeField1(oprot thrift.TProtocol) (err error) { 1241 if err := oprot.WriteFieldBegin("traceIdLow", thrift.I64, 1); err != nil { 1242 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:traceIdLow: ", p), err) 1243 } 1244 if err := oprot.WriteI64(int64(p.TraceIdLow)); err != nil { 1245 return thrift.PrependError(fmt.Sprintf("%T.traceIdLow (1) field write error: ", p), err) 1246 } 1247 if err := oprot.WriteFieldEnd(); err != nil { 1248 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:traceIdLow: ", p), err) 1249 } 1250 return err 1251} 1252 1253func (p *Span) writeField2(oprot thrift.TProtocol) (err error) { 1254 if err := oprot.WriteFieldBegin("traceIdHigh", thrift.I64, 2); err != nil { 1255 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:traceIdHigh: ", p), err) 1256 } 1257 if err := oprot.WriteI64(int64(p.TraceIdHigh)); err != nil { 1258 return thrift.PrependError(fmt.Sprintf("%T.traceIdHigh (2) field write error: ", p), err) 1259 } 1260 if err := oprot.WriteFieldEnd(); err != nil { 1261 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:traceIdHigh: ", p), err) 1262 } 1263 return err 1264} 1265 1266func (p *Span) writeField3(oprot thrift.TProtocol) (err error) { 1267 if err := oprot.WriteFieldBegin("spanId", thrift.I64, 3); err != nil { 1268 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:spanId: ", p), err) 1269 } 1270 if err := oprot.WriteI64(int64(p.SpanId)); err != nil { 1271 return thrift.PrependError(fmt.Sprintf("%T.spanId (3) field write error: ", p), err) 1272 } 1273 if err := oprot.WriteFieldEnd(); err != nil { 1274 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:spanId: ", p), err) 1275 } 1276 return err 1277} 1278 1279func (p *Span) writeField4(oprot thrift.TProtocol) (err error) { 1280 if err := oprot.WriteFieldBegin("parentSpanId", thrift.I64, 4); err != nil { 1281 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:parentSpanId: ", p), err) 1282 } 1283 if err := oprot.WriteI64(int64(p.ParentSpanId)); err != nil { 1284 return thrift.PrependError(fmt.Sprintf("%T.parentSpanId (4) field write error: ", p), err) 1285 } 1286 if err := oprot.WriteFieldEnd(); err != nil { 1287 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:parentSpanId: ", p), err) 1288 } 1289 return err 1290} 1291 1292func (p *Span) writeField5(oprot thrift.TProtocol) (err error) { 1293 if err := oprot.WriteFieldBegin("operationName", thrift.STRING, 5); err != nil { 1294 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:operationName: ", p), err) 1295 } 1296 if err := oprot.WriteString(string(p.OperationName)); err != nil { 1297 return thrift.PrependError(fmt.Sprintf("%T.operationName (5) field write error: ", p), err) 1298 } 1299 if err := oprot.WriteFieldEnd(); err != nil { 1300 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:operationName: ", p), err) 1301 } 1302 return err 1303} 1304 1305func (p *Span) writeField6(oprot thrift.TProtocol) (err error) { 1306 if p.IsSetReferences() { 1307 if err := oprot.WriteFieldBegin("references", thrift.LIST, 6); err != nil { 1308 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:references: ", p), err) 1309 } 1310 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.References)); err != nil { 1311 return thrift.PrependError("error writing list begin: ", err) 1312 } 1313 for _, v := range p.References { 1314 if err := v.Write(oprot); err != nil { 1315 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 1316 } 1317 } 1318 if err := oprot.WriteListEnd(); err != nil { 1319 return thrift.PrependError("error writing list end: ", err) 1320 } 1321 if err := oprot.WriteFieldEnd(); err != nil { 1322 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:references: ", p), err) 1323 } 1324 } 1325 return err 1326} 1327 1328func (p *Span) writeField7(oprot thrift.TProtocol) (err error) { 1329 if err := oprot.WriteFieldBegin("flags", thrift.I32, 7); err != nil { 1330 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:flags: ", p), err) 1331 } 1332 if err := oprot.WriteI32(int32(p.Flags)); err != nil { 1333 return thrift.PrependError(fmt.Sprintf("%T.flags (7) field write error: ", p), err) 1334 } 1335 if err := oprot.WriteFieldEnd(); err != nil { 1336 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:flags: ", p), err) 1337 } 1338 return err 1339} 1340 1341func (p *Span) writeField8(oprot thrift.TProtocol) (err error) { 1342 if err := oprot.WriteFieldBegin("startTime", thrift.I64, 8); err != nil { 1343 return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:startTime: ", p), err) 1344 } 1345 if err := oprot.WriteI64(int64(p.StartTime)); err != nil { 1346 return thrift.PrependError(fmt.Sprintf("%T.startTime (8) field write error: ", p), err) 1347 } 1348 if err := oprot.WriteFieldEnd(); err != nil { 1349 return thrift.PrependError(fmt.Sprintf("%T write field end error 8:startTime: ", p), err) 1350 } 1351 return err 1352} 1353 1354func (p *Span) writeField9(oprot thrift.TProtocol) (err error) { 1355 if err := oprot.WriteFieldBegin("duration", thrift.I64, 9); err != nil { 1356 return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:duration: ", p), err) 1357 } 1358 if err := oprot.WriteI64(int64(p.Duration)); err != nil { 1359 return thrift.PrependError(fmt.Sprintf("%T.duration (9) field write error: ", p), err) 1360 } 1361 if err := oprot.WriteFieldEnd(); err != nil { 1362 return thrift.PrependError(fmt.Sprintf("%T write field end error 9:duration: ", p), err) 1363 } 1364 return err 1365} 1366 1367func (p *Span) writeField10(oprot thrift.TProtocol) (err error) { 1368 if p.IsSetTags() { 1369 if err := oprot.WriteFieldBegin("tags", thrift.LIST, 10); err != nil { 1370 return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:tags: ", p), err) 1371 } 1372 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Tags)); err != nil { 1373 return thrift.PrependError("error writing list begin: ", err) 1374 } 1375 for _, v := range p.Tags { 1376 if err := v.Write(oprot); err != nil { 1377 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 1378 } 1379 } 1380 if err := oprot.WriteListEnd(); err != nil { 1381 return thrift.PrependError("error writing list end: ", err) 1382 } 1383 if err := oprot.WriteFieldEnd(); err != nil { 1384 return thrift.PrependError(fmt.Sprintf("%T write field end error 10:tags: ", p), err) 1385 } 1386 } 1387 return err 1388} 1389 1390func (p *Span) writeField11(oprot thrift.TProtocol) (err error) { 1391 if p.IsSetLogs() { 1392 if err := oprot.WriteFieldBegin("logs", thrift.LIST, 11); err != nil { 1393 return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:logs: ", p), err) 1394 } 1395 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Logs)); err != nil { 1396 return thrift.PrependError("error writing list begin: ", err) 1397 } 1398 for _, v := range p.Logs { 1399 if err := v.Write(oprot); err != nil { 1400 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 1401 } 1402 } 1403 if err := oprot.WriteListEnd(); err != nil { 1404 return thrift.PrependError("error writing list end: ", err) 1405 } 1406 if err := oprot.WriteFieldEnd(); err != nil { 1407 return thrift.PrependError(fmt.Sprintf("%T write field end error 11:logs: ", p), err) 1408 } 1409 } 1410 return err 1411} 1412 1413func (p *Span) String() string { 1414 if p == nil { 1415 return "<nil>" 1416 } 1417 return fmt.Sprintf("Span(%+v)", *p) 1418} 1419 1420// Attributes: 1421// - ServiceName 1422// - Tags 1423type Process struct { 1424 ServiceName string `thrift:"serviceName,1,required" json:"serviceName"` 1425 Tags []*Tag `thrift:"tags,2" json:"tags,omitempty"` 1426} 1427 1428func NewProcess() *Process { 1429 return &Process{} 1430} 1431 1432func (p *Process) GetServiceName() string { 1433 return p.ServiceName 1434} 1435 1436var Process_Tags_DEFAULT []*Tag 1437 1438func (p *Process) GetTags() []*Tag { 1439 return p.Tags 1440} 1441func (p *Process) IsSetTags() bool { 1442 return p.Tags != nil 1443} 1444 1445func (p *Process) Read(iprot thrift.TProtocol) error { 1446 if _, err := iprot.ReadStructBegin(); err != nil { 1447 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1448 } 1449 1450 var issetServiceName bool = false 1451 1452 for { 1453 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() 1454 if err != nil { 1455 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1456 } 1457 if fieldTypeId == thrift.STOP { 1458 break 1459 } 1460 switch fieldId { 1461 case 1: 1462 if err := p.readField1(iprot); err != nil { 1463 return err 1464 } 1465 issetServiceName = true 1466 case 2: 1467 if err := p.readField2(iprot); err != nil { 1468 return err 1469 } 1470 default: 1471 if err := iprot.Skip(fieldTypeId); err != nil { 1472 return err 1473 } 1474 } 1475 if err := iprot.ReadFieldEnd(); err != nil { 1476 return err 1477 } 1478 } 1479 if err := iprot.ReadStructEnd(); err != nil { 1480 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1481 } 1482 if !issetServiceName { 1483 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ServiceName is not set")) 1484 } 1485 return nil 1486} 1487 1488func (p *Process) readField1(iprot thrift.TProtocol) error { 1489 if v, err := iprot.ReadString(); err != nil { 1490 return thrift.PrependError("error reading field 1: ", err) 1491 } else { 1492 p.ServiceName = v 1493 } 1494 return nil 1495} 1496 1497func (p *Process) readField2(iprot thrift.TProtocol) error { 1498 _, size, err := iprot.ReadListBegin() 1499 if err != nil { 1500 return thrift.PrependError("error reading list begin: ", err) 1501 } 1502 tSlice := make([]*Tag, 0, size) 1503 p.Tags = tSlice 1504 for i := 0; i < size; i++ { 1505 _elem4 := &Tag{} 1506 if err := _elem4.Read(iprot); err != nil { 1507 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err) 1508 } 1509 p.Tags = append(p.Tags, _elem4) 1510 } 1511 if err := iprot.ReadListEnd(); err != nil { 1512 return thrift.PrependError("error reading list end: ", err) 1513 } 1514 return nil 1515} 1516 1517func (p *Process) Write(oprot thrift.TProtocol) error { 1518 if err := oprot.WriteStructBegin("Process"); err != nil { 1519 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1520 } 1521 if err := p.writeField1(oprot); err != nil { 1522 return err 1523 } 1524 if err := p.writeField2(oprot); err != nil { 1525 return err 1526 } 1527 if err := oprot.WriteFieldStop(); err != nil { 1528 return thrift.PrependError("write field stop error: ", err) 1529 } 1530 if err := oprot.WriteStructEnd(); err != nil { 1531 return thrift.PrependError("write struct stop error: ", err) 1532 } 1533 return nil 1534} 1535 1536func (p *Process) writeField1(oprot thrift.TProtocol) (err error) { 1537 if err := oprot.WriteFieldBegin("serviceName", thrift.STRING, 1); err != nil { 1538 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:serviceName: ", p), err) 1539 } 1540 if err := oprot.WriteString(string(p.ServiceName)); err != nil { 1541 return thrift.PrependError(fmt.Sprintf("%T.serviceName (1) field write error: ", p), err) 1542 } 1543 if err := oprot.WriteFieldEnd(); err != nil { 1544 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:serviceName: ", p), err) 1545 } 1546 return err 1547} 1548 1549func (p *Process) writeField2(oprot thrift.TProtocol) (err error) { 1550 if p.IsSetTags() { 1551 if err := oprot.WriteFieldBegin("tags", thrift.LIST, 2); err != nil { 1552 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:tags: ", p), err) 1553 } 1554 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Tags)); err != nil { 1555 return thrift.PrependError("error writing list begin: ", err) 1556 } 1557 for _, v := range p.Tags { 1558 if err := v.Write(oprot); err != nil { 1559 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 1560 } 1561 } 1562 if err := oprot.WriteListEnd(); err != nil { 1563 return thrift.PrependError("error writing list end: ", err) 1564 } 1565 if err := oprot.WriteFieldEnd(); err != nil { 1566 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:tags: ", p), err) 1567 } 1568 } 1569 return err 1570} 1571 1572func (p *Process) String() string { 1573 if p == nil { 1574 return "<nil>" 1575 } 1576 return fmt.Sprintf("Process(%+v)", *p) 1577} 1578 1579// Attributes: 1580// - Process 1581// - Spans 1582type Batch struct { 1583 Process *Process `thrift:"process,1,required" json:"process"` 1584 Spans []*Span `thrift:"spans,2,required" json:"spans"` 1585} 1586 1587func NewBatch() *Batch { 1588 return &Batch{} 1589} 1590 1591var Batch_Process_DEFAULT *Process 1592 1593func (p *Batch) GetProcess() *Process { 1594 if !p.IsSetProcess() { 1595 return Batch_Process_DEFAULT 1596 } 1597 return p.Process 1598} 1599 1600func (p *Batch) GetSpans() []*Span { 1601 return p.Spans 1602} 1603func (p *Batch) IsSetProcess() bool { 1604 return p.Process != nil 1605} 1606 1607func (p *Batch) Read(iprot thrift.TProtocol) error { 1608 if _, err := iprot.ReadStructBegin(); err != nil { 1609 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1610 } 1611 1612 var issetProcess bool = false 1613 var issetSpans bool = false 1614 1615 for { 1616 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() 1617 if err != nil { 1618 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1619 } 1620 if fieldTypeId == thrift.STOP { 1621 break 1622 } 1623 switch fieldId { 1624 case 1: 1625 if err := p.readField1(iprot); err != nil { 1626 return err 1627 } 1628 issetProcess = true 1629 case 2: 1630 if err := p.readField2(iprot); err != nil { 1631 return err 1632 } 1633 issetSpans = true 1634 default: 1635 if err := iprot.Skip(fieldTypeId); err != nil { 1636 return err 1637 } 1638 } 1639 if err := iprot.ReadFieldEnd(); err != nil { 1640 return err 1641 } 1642 } 1643 if err := iprot.ReadStructEnd(); err != nil { 1644 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1645 } 1646 if !issetProcess { 1647 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Process is not set")) 1648 } 1649 if !issetSpans { 1650 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Spans is not set")) 1651 } 1652 return nil 1653} 1654 1655func (p *Batch) readField1(iprot thrift.TProtocol) error { 1656 p.Process = &Process{} 1657 if err := p.Process.Read(iprot); err != nil { 1658 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Process), err) 1659 } 1660 return nil 1661} 1662 1663func (p *Batch) readField2(iprot thrift.TProtocol) error { 1664 _, size, err := iprot.ReadListBegin() 1665 if err != nil { 1666 return thrift.PrependError("error reading list begin: ", err) 1667 } 1668 tSlice := make([]*Span, 0, size) 1669 p.Spans = tSlice 1670 for i := 0; i < size; i++ { 1671 _elem5 := &Span{} 1672 if err := _elem5.Read(iprot); err != nil { 1673 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem5), err) 1674 } 1675 p.Spans = append(p.Spans, _elem5) 1676 } 1677 if err := iprot.ReadListEnd(); err != nil { 1678 return thrift.PrependError("error reading list end: ", err) 1679 } 1680 return nil 1681} 1682 1683func (p *Batch) Write(oprot thrift.TProtocol) error { 1684 if err := oprot.WriteStructBegin("Batch"); err != nil { 1685 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1686 } 1687 if err := p.writeField1(oprot); err != nil { 1688 return err 1689 } 1690 if err := p.writeField2(oprot); err != nil { 1691 return err 1692 } 1693 if err := oprot.WriteFieldStop(); err != nil { 1694 return thrift.PrependError("write field stop error: ", err) 1695 } 1696 if err := oprot.WriteStructEnd(); err != nil { 1697 return thrift.PrependError("write struct stop error: ", err) 1698 } 1699 return nil 1700} 1701 1702func (p *Batch) writeField1(oprot thrift.TProtocol) (err error) { 1703 if err := oprot.WriteFieldBegin("process", thrift.STRUCT, 1); err != nil { 1704 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:process: ", p), err) 1705 } 1706 if err := p.Process.Write(oprot); err != nil { 1707 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Process), err) 1708 } 1709 if err := oprot.WriteFieldEnd(); err != nil { 1710 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:process: ", p), err) 1711 } 1712 return err 1713} 1714 1715func (p *Batch) writeField2(oprot thrift.TProtocol) (err error) { 1716 if err := oprot.WriteFieldBegin("spans", thrift.LIST, 2); err != nil { 1717 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:spans: ", p), err) 1718 } 1719 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Spans)); err != nil { 1720 return thrift.PrependError("error writing list begin: ", err) 1721 } 1722 for _, v := range p.Spans { 1723 if err := v.Write(oprot); err != nil { 1724 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 1725 } 1726 } 1727 if err := oprot.WriteListEnd(); err != nil { 1728 return thrift.PrependError("error writing list end: ", err) 1729 } 1730 if err := oprot.WriteFieldEnd(); err != nil { 1731 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:spans: ", p), err) 1732 } 1733 return err 1734} 1735 1736func (p *Batch) String() string { 1737 if p == nil { 1738 return "<nil>" 1739 } 1740 return fmt.Sprintf("Batch(%+v)", *p) 1741} 1742 1743// Attributes: 1744// - Ok 1745type BatchSubmitResponse struct { 1746 Ok bool `thrift:"ok,1,required" json:"ok"` 1747} 1748 1749func NewBatchSubmitResponse() *BatchSubmitResponse { 1750 return &BatchSubmitResponse{} 1751} 1752 1753func (p *BatchSubmitResponse) GetOk() bool { 1754 return p.Ok 1755} 1756func (p *BatchSubmitResponse) Read(iprot thrift.TProtocol) error { 1757 if _, err := iprot.ReadStructBegin(); err != nil { 1758 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1759 } 1760 1761 var issetOk bool = false 1762 1763 for { 1764 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin() 1765 if err != nil { 1766 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1767 } 1768 if fieldTypeId == thrift.STOP { 1769 break 1770 } 1771 switch fieldId { 1772 case 1: 1773 if err := p.readField1(iprot); err != nil { 1774 return err 1775 } 1776 issetOk = true 1777 default: 1778 if err := iprot.Skip(fieldTypeId); err != nil { 1779 return err 1780 } 1781 } 1782 if err := iprot.ReadFieldEnd(); err != nil { 1783 return err 1784 } 1785 } 1786 if err := iprot.ReadStructEnd(); err != nil { 1787 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1788 } 1789 if !issetOk { 1790 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Ok is not set")) 1791 } 1792 return nil 1793} 1794 1795func (p *BatchSubmitResponse) readField1(iprot thrift.TProtocol) error { 1796 if v, err := iprot.ReadBool(); err != nil { 1797 return thrift.PrependError("error reading field 1: ", err) 1798 } else { 1799 p.Ok = v 1800 } 1801 return nil 1802} 1803 1804func (p *BatchSubmitResponse) Write(oprot thrift.TProtocol) error { 1805 if err := oprot.WriteStructBegin("BatchSubmitResponse"); err != nil { 1806 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1807 } 1808 if err := p.writeField1(oprot); err != nil { 1809 return err 1810 } 1811 if err := oprot.WriteFieldStop(); err != nil { 1812 return thrift.PrependError("write field stop error: ", err) 1813 } 1814 if err := oprot.WriteStructEnd(); err != nil { 1815 return thrift.PrependError("write struct stop error: ", err) 1816 } 1817 return nil 1818} 1819 1820func (p *BatchSubmitResponse) writeField1(oprot thrift.TProtocol) (err error) { 1821 if err := oprot.WriteFieldBegin("ok", thrift.BOOL, 1); err != nil { 1822 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ok: ", p), err) 1823 } 1824 if err := oprot.WriteBool(bool(p.Ok)); err != nil { 1825 return thrift.PrependError(fmt.Sprintf("%T.ok (1) field write error: ", p), err) 1826 } 1827 if err := oprot.WriteFieldEnd(); err != nil { 1828 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ok: ", p), err) 1829 } 1830 return err 1831} 1832 1833func (p *BatchSubmitResponse) String() string { 1834 if p == nil { 1835 return "<nil>" 1836 } 1837 return fmt.Sprintf("BatchSubmitResponse(%+v)", *p) 1838} 1839