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