mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 18:53:43 -04:00
Update zipkin to the newer version (#1205)
* Update zipkin to the newer version Also update thrift to use head commit Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Update vendor directory. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
2
vendor/github.com/openzipkin/zipkin-go-opentracing/.travis.yml
generated
vendored
2
vendor/github.com/openzipkin/zipkin-go-opentracing/.travis.yml
generated
vendored
@@ -1,8 +1,8 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.7
|
||||
- 1.8
|
||||
- 1.9
|
||||
- tip
|
||||
|
||||
install:
|
||||
|
||||
7
vendor/github.com/openzipkin/zipkin-go-opentracing/Makefile
generated
vendored
7
vendor/github.com/openzipkin/zipkin-go-opentracing/Makefile
generated
vendored
@@ -12,12 +12,15 @@ bench:
|
||||
.PHONY: lint
|
||||
lint:
|
||||
# Ignore grep's exit code since no match returns 1.
|
||||
-golint ./... | grep --invert-match -E '^.*\.pb\.go'
|
||||
-golint ./... | grep --invert-match -E '^.*\.pb\.go|^thrift'
|
||||
@
|
||||
@! (golint ./... |grep --invert-match -E '^.*\.pb\.go' | read dummy)
|
||||
@! (golint ./... | grep --invert-match -E '^.*\.pb\.go|^thrift' | read dummy)
|
||||
|
||||
.PHONY: vet
|
||||
vet:
|
||||
go vet ./...
|
||||
|
||||
.PHONY: all
|
||||
all: vet lint test bench
|
||||
|
||||
.PHONY: example
|
||||
|
||||
431
vendor/github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/scribe/scribe.go
generated
vendored
431
vendor/github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/scribe/scribe.go
generated
vendored
@@ -1,431 +0,0 @@
|
||||
// Autogenerated by Thrift Compiler (0.9.3)
|
||||
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
|
||||
package scribe
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
)
|
||||
|
||||
// (needed to ensure safety because of naive import list construction.)
|
||||
var _ = thrift.ZERO
|
||||
var _ = fmt.Printf
|
||||
var _ = bytes.Equal
|
||||
|
||||
type Scribe interface {
|
||||
// Parameters:
|
||||
// - Messages
|
||||
Log(messages []*LogEntry) (r ResultCode, err error)
|
||||
}
|
||||
|
||||
type ScribeClient struct {
|
||||
Transport thrift.TTransport
|
||||
ProtocolFactory thrift.TProtocolFactory
|
||||
InputProtocol thrift.TProtocol
|
||||
OutputProtocol thrift.TProtocol
|
||||
SeqId int32
|
||||
}
|
||||
|
||||
func NewScribeClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ScribeClient {
|
||||
return &ScribeClient{Transport: t,
|
||||
ProtocolFactory: f,
|
||||
InputProtocol: f.GetProtocol(t),
|
||||
OutputProtocol: f.GetProtocol(t),
|
||||
SeqId: 0,
|
||||
}
|
||||
}
|
||||
|
||||
func NewScribeClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ScribeClient {
|
||||
return &ScribeClient{Transport: t,
|
||||
ProtocolFactory: nil,
|
||||
InputProtocol: iprot,
|
||||
OutputProtocol: oprot,
|
||||
SeqId: 0,
|
||||
}
|
||||
}
|
||||
|
||||
// Parameters:
|
||||
// - Messages
|
||||
func (p *ScribeClient) Log(messages []*LogEntry) (r ResultCode, err error) {
|
||||
if err = p.sendLog(messages); err != nil {
|
||||
return
|
||||
}
|
||||
return p.recvLog()
|
||||
}
|
||||
|
||||
func (p *ScribeClient) sendLog(messages []*LogEntry) (err error) {
|
||||
oprot := p.OutputProtocol
|
||||
if oprot == nil {
|
||||
oprot = p.ProtocolFactory.GetProtocol(p.Transport)
|
||||
p.OutputProtocol = oprot
|
||||
}
|
||||
p.SeqId++
|
||||
if err = oprot.WriteMessageBegin("Log", thrift.CALL, p.SeqId); err != nil {
|
||||
return
|
||||
}
|
||||
args := ScribeLogArgs{
|
||||
Messages: messages,
|
||||
}
|
||||
if err = args.Write(oprot); err != nil {
|
||||
return
|
||||
}
|
||||
if err = oprot.WriteMessageEnd(); err != nil {
|
||||
return
|
||||
}
|
||||
return oprot.Flush()
|
||||
}
|
||||
|
||||
func (p *ScribeClient) recvLog() (value ResultCode, err error) {
|
||||
iprot := p.InputProtocol
|
||||
if iprot == nil {
|
||||
iprot = p.ProtocolFactory.GetProtocol(p.Transport)
|
||||
p.InputProtocol = iprot
|
||||
}
|
||||
method, mTypeId, seqId, err := iprot.ReadMessageBegin()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if method != "Log" {
|
||||
err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "Log failed: wrong method name")
|
||||
return
|
||||
}
|
||||
if p.SeqId != seqId {
|
||||
err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "Log failed: out of sequence response")
|
||||
return
|
||||
}
|
||||
if mTypeId == thrift.EXCEPTION {
|
||||
error0 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
|
||||
var error1 error
|
||||
error1, err = error0.Read(iprot)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if err = iprot.ReadMessageEnd(); err != nil {
|
||||
return
|
||||
}
|
||||
err = error1
|
||||
return
|
||||
}
|
||||
if mTypeId != thrift.REPLY {
|
||||
err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "Log failed: invalid message type")
|
||||
return
|
||||
}
|
||||
result := ScribeLogResult{}
|
||||
if err = result.Read(iprot); err != nil {
|
||||
return
|
||||
}
|
||||
if err = iprot.ReadMessageEnd(); err != nil {
|
||||
return
|
||||
}
|
||||
value = result.GetSuccess()
|
||||
return
|
||||
}
|
||||
|
||||
type ScribeProcessor struct {
|
||||
processorMap map[string]thrift.TProcessorFunction
|
||||
handler Scribe
|
||||
}
|
||||
|
||||
func (p *ScribeProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
|
||||
p.processorMap[key] = processor
|
||||
}
|
||||
|
||||
func (p *ScribeProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
|
||||
processor, ok = p.processorMap[key]
|
||||
return processor, ok
|
||||
}
|
||||
|
||||
func (p *ScribeProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
|
||||
return p.processorMap
|
||||
}
|
||||
|
||||
func NewScribeProcessor(handler Scribe) *ScribeProcessor {
|
||||
|
||||
self2 := &ScribeProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
|
||||
self2.processorMap["Log"] = &scribeProcessorLog{handler: handler}
|
||||
return self2
|
||||
}
|
||||
|
||||
func (p *ScribeProcessor) Process(iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
|
||||
name, _, seqId, err := iprot.ReadMessageBegin()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if processor, ok := p.GetProcessorFunction(name); ok {
|
||||
return processor.Process(seqId, iprot, oprot)
|
||||
}
|
||||
iprot.Skip(thrift.STRUCT)
|
||||
iprot.ReadMessageEnd()
|
||||
x3 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
|
||||
oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
|
||||
x3.Write(oprot)
|
||||
oprot.WriteMessageEnd()
|
||||
oprot.Flush()
|
||||
return false, x3
|
||||
|
||||
}
|
||||
|
||||
type scribeProcessorLog struct {
|
||||
handler Scribe
|
||||
}
|
||||
|
||||
func (p *scribeProcessorLog) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
|
||||
args := ScribeLogArgs{}
|
||||
if err = args.Read(iprot); err != nil {
|
||||
iprot.ReadMessageEnd()
|
||||
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
|
||||
oprot.WriteMessageBegin("Log", thrift.EXCEPTION, seqId)
|
||||
x.Write(oprot)
|
||||
oprot.WriteMessageEnd()
|
||||
oprot.Flush()
|
||||
return false, err
|
||||
}
|
||||
|
||||
iprot.ReadMessageEnd()
|
||||
result := ScribeLogResult{}
|
||||
var retval ResultCode
|
||||
var err2 error
|
||||
if retval, err2 = p.handler.Log(args.Messages); err2 != nil {
|
||||
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing Log: "+err2.Error())
|
||||
oprot.WriteMessageBegin("Log", thrift.EXCEPTION, seqId)
|
||||
x.Write(oprot)
|
||||
oprot.WriteMessageEnd()
|
||||
oprot.Flush()
|
||||
return true, err2
|
||||
} else {
|
||||
result.Success = &retval
|
||||
}
|
||||
if err2 = oprot.WriteMessageBegin("Log", thrift.REPLY, seqId); err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = result.Write(oprot); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = oprot.Flush(); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return true, err
|
||||
}
|
||||
|
||||
// HELPER FUNCTIONS AND STRUCTURES
|
||||
|
||||
// Attributes:
|
||||
// - Messages
|
||||
type ScribeLogArgs struct {
|
||||
Messages []*LogEntry `thrift:"messages,1" json:"messages"`
|
||||
}
|
||||
|
||||
func NewScribeLogArgs() *ScribeLogArgs {
|
||||
return &ScribeLogArgs{}
|
||||
}
|
||||
|
||||
func (p *ScribeLogArgs) GetMessages() []*LogEntry {
|
||||
return p.Messages
|
||||
}
|
||||
func (p *ScribeLogArgs) Read(iprot thrift.TProtocol) error {
|
||||
if _, err := iprot.ReadStructBegin(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
switch fieldId {
|
||||
case 1:
|
||||
if err := p.readField1(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
default:
|
||||
if err := iprot.Skip(fieldTypeId); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := iprot.ReadFieldEnd(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := iprot.ReadStructEnd(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *ScribeLogArgs) readField1(iprot thrift.TProtocol) error {
|
||||
_, size, err := iprot.ReadListBegin()
|
||||
if err != nil {
|
||||
return thrift.PrependError("error reading list begin: ", err)
|
||||
}
|
||||
tSlice := make([]*LogEntry, 0, size)
|
||||
p.Messages = tSlice
|
||||
for i := 0; i < size; i++ {
|
||||
_elem4 := &LogEntry{}
|
||||
if err := _elem4.Read(iprot); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err)
|
||||
}
|
||||
p.Messages = append(p.Messages, _elem4)
|
||||
}
|
||||
if err := iprot.ReadListEnd(); err != nil {
|
||||
return thrift.PrependError("error reading list end: ", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *ScribeLogArgs) Write(oprot thrift.TProtocol) error {
|
||||
if err := oprot.WriteStructBegin("Log_args"); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
}
|
||||
if err := p.writeField1(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := oprot.WriteFieldStop(); err != nil {
|
||||
return thrift.PrependError("write field stop error: ", err)
|
||||
}
|
||||
if err := oprot.WriteStructEnd(); err != nil {
|
||||
return thrift.PrependError("write struct stop error: ", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *ScribeLogArgs) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if err := oprot.WriteFieldBegin("messages", thrift.LIST, 1); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:messages: ", p), err)
|
||||
}
|
||||
if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Messages)); err != nil {
|
||||
return thrift.PrependError("error writing list begin: ", err)
|
||||
}
|
||||
for _, v := range p.Messages {
|
||||
if err := v.Write(oprot); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
|
||||
}
|
||||
}
|
||||
if err := oprot.WriteListEnd(); err != nil {
|
||||
return thrift.PrependError("error writing list end: ", err)
|
||||
}
|
||||
if err := oprot.WriteFieldEnd(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:messages: ", p), err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *ScribeLogArgs) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("ScribeLogArgs(%+v)", *p)
|
||||
}
|
||||
|
||||
// Attributes:
|
||||
// - Success
|
||||
type ScribeLogResult struct {
|
||||
Success *ResultCode `thrift:"success,0" json:"success,omitempty"`
|
||||
}
|
||||
|
||||
func NewScribeLogResult() *ScribeLogResult {
|
||||
return &ScribeLogResult{}
|
||||
}
|
||||
|
||||
var ScribeLogResult_Success_DEFAULT ResultCode
|
||||
|
||||
func (p *ScribeLogResult) GetSuccess() ResultCode {
|
||||
if !p.IsSetSuccess() {
|
||||
return ScribeLogResult_Success_DEFAULT
|
||||
}
|
||||
return *p.Success
|
||||
}
|
||||
func (p *ScribeLogResult) IsSetSuccess() bool {
|
||||
return p.Success != nil
|
||||
}
|
||||
|
||||
func (p *ScribeLogResult) Read(iprot thrift.TProtocol) error {
|
||||
if _, err := iprot.ReadStructBegin(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
switch fieldId {
|
||||
case 0:
|
||||
if err := p.readField0(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
default:
|
||||
if err := iprot.Skip(fieldTypeId); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := iprot.ReadFieldEnd(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := iprot.ReadStructEnd(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *ScribeLogResult) readField0(iprot thrift.TProtocol) error {
|
||||
if v, err := iprot.ReadI32(); err != nil {
|
||||
return thrift.PrependError("error reading field 0: ", err)
|
||||
} else {
|
||||
temp := ResultCode(v)
|
||||
p.Success = &temp
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *ScribeLogResult) Write(oprot thrift.TProtocol) error {
|
||||
if err := oprot.WriteStructBegin("Log_result"); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
}
|
||||
if err := p.writeField0(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := oprot.WriteFieldStop(); err != nil {
|
||||
return thrift.PrependError("write field stop error: ", err)
|
||||
}
|
||||
if err := oprot.WriteStructEnd(); err != nil {
|
||||
return thrift.PrependError("write struct stop error: ", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *ScribeLogResult) writeField0(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetSuccess() {
|
||||
if err := oprot.WriteFieldBegin("success", thrift.I32, 0); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
|
||||
}
|
||||
if err := oprot.WriteI32(int32(*p.Success)); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T.success (0) field write error: ", p), err)
|
||||
}
|
||||
if err := oprot.WriteFieldEnd(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *ScribeLogResult) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("ScribeLogResult(%+v)", *p)
|
||||
}
|
||||
185
vendor/github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/scribe/ttypes.go
generated
vendored
185
vendor/github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/scribe/ttypes.go
generated
vendored
@@ -1,185 +0,0 @@
|
||||
// Autogenerated by Thrift Compiler (0.9.3)
|
||||
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
|
||||
package scribe
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
)
|
||||
|
||||
// (needed to ensure safety because of naive import list construction.)
|
||||
var _ = thrift.ZERO
|
||||
var _ = fmt.Printf
|
||||
var _ = bytes.Equal
|
||||
|
||||
var GoUnusedProtection__ int
|
||||
|
||||
type ResultCode int64
|
||||
|
||||
const (
|
||||
ResultCode_OK ResultCode = 0
|
||||
ResultCode_TRY_LATER ResultCode = 1
|
||||
)
|
||||
|
||||
func (p ResultCode) String() string {
|
||||
switch p {
|
||||
case ResultCode_OK:
|
||||
return "OK"
|
||||
case ResultCode_TRY_LATER:
|
||||
return "TRY_LATER"
|
||||
}
|
||||
return "<UNSET>"
|
||||
}
|
||||
|
||||
func ResultCodeFromString(s string) (ResultCode, error) {
|
||||
switch s {
|
||||
case "OK":
|
||||
return ResultCode_OK, nil
|
||||
case "TRY_LATER":
|
||||
return ResultCode_TRY_LATER, nil
|
||||
}
|
||||
return ResultCode(0), fmt.Errorf("not a valid ResultCode string")
|
||||
}
|
||||
|
||||
func ResultCodePtr(v ResultCode) *ResultCode { return &v }
|
||||
|
||||
func (p ResultCode) MarshalText() ([]byte, error) {
|
||||
return []byte(p.String()), nil
|
||||
}
|
||||
|
||||
func (p *ResultCode) UnmarshalText(text []byte) error {
|
||||
q, err := ResultCodeFromString(string(text))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*p = q
|
||||
return nil
|
||||
}
|
||||
|
||||
// Attributes:
|
||||
// - Category
|
||||
// - Message
|
||||
type LogEntry struct {
|
||||
Category string `thrift:"category,1" json:"category"`
|
||||
Message string `thrift:"message,2" json:"message"`
|
||||
}
|
||||
|
||||
func NewLogEntry() *LogEntry {
|
||||
return &LogEntry{}
|
||||
}
|
||||
|
||||
func (p *LogEntry) GetCategory() string {
|
||||
return p.Category
|
||||
}
|
||||
|
||||
func (p *LogEntry) GetMessage() string {
|
||||
return p.Message
|
||||
}
|
||||
func (p *LogEntry) Read(iprot thrift.TProtocol) error {
|
||||
if _, err := iprot.ReadStructBegin(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
switch fieldId {
|
||||
case 1:
|
||||
if err := p.readField1(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
case 2:
|
||||
if err := p.readField2(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
default:
|
||||
if err := iprot.Skip(fieldTypeId); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := iprot.ReadFieldEnd(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := iprot.ReadStructEnd(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *LogEntry) readField1(iprot thrift.TProtocol) error {
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return thrift.PrependError("error reading field 1: ", err)
|
||||
} else {
|
||||
p.Category = v
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *LogEntry) readField2(iprot thrift.TProtocol) error {
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return thrift.PrependError("error reading field 2: ", err)
|
||||
} else {
|
||||
p.Message = v
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *LogEntry) Write(oprot thrift.TProtocol) error {
|
||||
if err := oprot.WriteStructBegin("LogEntry"); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
}
|
||||
if err := p.writeField1(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.writeField2(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := oprot.WriteFieldStop(); err != nil {
|
||||
return thrift.PrependError("write field stop error: ", err)
|
||||
}
|
||||
if err := oprot.WriteStructEnd(); err != nil {
|
||||
return thrift.PrependError("write struct stop error: ", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *LogEntry) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if err := oprot.WriteFieldBegin("category", thrift.STRING, 1); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:category: ", p), err)
|
||||
}
|
||||
if err := oprot.WriteString(string(p.Category)); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T.category (1) field write error: ", p), err)
|
||||
}
|
||||
if err := oprot.WriteFieldEnd(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:category: ", p), err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *LogEntry) writeField2(oprot thrift.TProtocol) (err error) {
|
||||
if err := oprot.WriteFieldBegin("message", thrift.STRING, 2); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:message: ", p), err)
|
||||
}
|
||||
if err := oprot.WriteString(string(p.Message)); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T.message (2) field write error: ", p), err)
|
||||
}
|
||||
if err := oprot.WriteFieldEnd(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:message: ", p), err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *LogEntry) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("LogEntry(%+v)", *p)
|
||||
}
|
||||
1272
vendor/github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/zipkincore/ttypes.go
generated
vendored
1272
vendor/github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/zipkincore/ttypes.go
generated
vendored
File diff suppressed because it is too large
Load Diff
10
vendor/github.com/openzipkin/zipkin-go-opentracing/circle.yml
generated
vendored
Normal file
10
vendor/github.com/openzipkin/zipkin-go-opentracing/circle.yml
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
dependencies:
|
||||
override:
|
||||
- sudo rm -rf /home/ubuntu/.go_workspace/src/github.com/openzipkin
|
||||
- mkdir -p /home/ubuntu/.go_workspace/src/github.com/openzipkin
|
||||
- mv /home/ubuntu/zipkin-go-opentracing /home/ubuntu/.go_workspace/src/github.com/openzipkin
|
||||
- ln -s /home/ubuntu/.go_workspace/src/github.com/openzipkin/zipkin-go-opentracing /home/ubuntu/zipkin-go-opentracing
|
||||
- go get -u -t -v github.com/openzipkin/zipkin-go-opentracing/...
|
||||
test:
|
||||
override:
|
||||
- make test bench
|
||||
12
vendor/github.com/openzipkin/zipkin-go-opentracing/collector-http.go
generated
vendored
12
vendor/github.com/openzipkin/zipkin-go-opentracing/collector-http.go
generated
vendored
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
|
||||
"github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/zipkincore"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
|
||||
)
|
||||
|
||||
// Default timeout for http request in seconds
|
||||
@@ -180,7 +180,7 @@ func (c *HTTPCollector) append(span *zipkincore.Span) (newBatchSize int) {
|
||||
c.batch = append(c.batch, span)
|
||||
if len(c.batch) > c.maxBacklog {
|
||||
dispose := len(c.batch) - c.maxBacklog
|
||||
c.logger.Log("Backlog too long, disposing spans.", "count", dispose)
|
||||
c.logger.Log("msg", "backlog too long, disposing spans.", "count", dispose)
|
||||
c.batch = c.batch[dispose:]
|
||||
}
|
||||
newBatchSize = len(c.batch)
|
||||
@@ -214,10 +214,16 @@ func (c *HTTPCollector) send() error {
|
||||
if c.reqCallback != nil {
|
||||
c.reqCallback(req)
|
||||
}
|
||||
if _, err = c.client.Do(req); err != nil {
|
||||
resp, err := c.client.Do(req)
|
||||
if err != nil {
|
||||
c.logger.Log("err", err.Error())
|
||||
return err
|
||||
}
|
||||
resp.Body.Close()
|
||||
// non 2xx code
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
c.logger.Log("err", "HTTP POST span failed", "code", resp.Status)
|
||||
}
|
||||
|
||||
// Remove sent spans from the batch
|
||||
c.batchMutex.Lock()
|
||||
|
||||
2
vendor/github.com/openzipkin/zipkin-go-opentracing/collector-http_test.go
generated
vendored
2
vendor/github.com/openzipkin/zipkin-go-opentracing/collector-http_test.go
generated
vendored
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
|
||||
"github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/zipkincore"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
2
vendor/github.com/openzipkin/zipkin-go-opentracing/collector-kafka.go
generated
vendored
2
vendor/github.com/openzipkin/zipkin-go-opentracing/collector-kafka.go
generated
vendored
@@ -4,7 +4,7 @@ import (
|
||||
"github.com/Shopify/sarama"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
|
||||
"github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/zipkincore"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
|
||||
)
|
||||
|
||||
// defaultKafkaTopic sets the standard Kafka topic our Collector will publish
|
||||
|
||||
2
vendor/github.com/openzipkin/zipkin-go-opentracing/collector-kafka_test.go
generated
vendored
2
vendor/github.com/openzipkin/zipkin-go-opentracing/collector-kafka_test.go
generated
vendored
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/Shopify/sarama"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
|
||||
"github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/zipkincore"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
|
||||
)
|
||||
|
||||
type stubProducer struct {
|
||||
|
||||
7
vendor/github.com/openzipkin/zipkin-go-opentracing/collector-scribe.go
generated
vendored
7
vendor/github.com/openzipkin/zipkin-go-opentracing/collector-scribe.go
generated
vendored
@@ -1,6 +1,7 @@
|
||||
package zipkintracer
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net"
|
||||
@@ -9,8 +10,8 @@ import (
|
||||
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
|
||||
"github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/scribe"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/zipkincore"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/scribe"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
|
||||
)
|
||||
|
||||
const defaultScribeCategory = "zipkin"
|
||||
@@ -198,7 +199,7 @@ func (c *ScribeCollector) send() error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if rc, err := c.client.Log(sendBatch); err != nil {
|
||||
if rc, err := c.client.Log(context.Background(), sendBatch); err != nil {
|
||||
c.client = nil
|
||||
_ = c.logger.Log("err", fmt.Sprintf("during Log: %v", err))
|
||||
return err
|
||||
|
||||
7
vendor/github.com/openzipkin/zipkin-go-opentracing/collector-scribe_test.go
generated
vendored
7
vendor/github.com/openzipkin/zipkin-go-opentracing/collector-scribe_test.go
generated
vendored
@@ -1,6 +1,7 @@
|
||||
package zipkintracer
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
@@ -11,8 +12,8 @@ import (
|
||||
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
|
||||
"github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/scribe"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/zipkincore"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/scribe"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
|
||||
)
|
||||
|
||||
func TestScribeCollector(t *testing.T) {
|
||||
@@ -143,7 +144,7 @@ func newScribeHandler(t *testing.T) *scribeHandler {
|
||||
return &scribeHandler{t: t}
|
||||
}
|
||||
|
||||
func (h *scribeHandler) Log(messages []*scribe.LogEntry) (scribe.ResultCode, error) {
|
||||
func (h *scribeHandler) Log(ctx context.Context, messages []*scribe.LogEntry) (scribe.ResultCode, error) {
|
||||
h.Lock()
|
||||
defer h.Unlock()
|
||||
for _, m := range messages {
|
||||
|
||||
2
vendor/github.com/openzipkin/zipkin-go-opentracing/collector.go
generated
vendored
2
vendor/github.com/openzipkin/zipkin-go-opentracing/collector.go
generated
vendored
@@ -3,7 +3,7 @@ package zipkintracer
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/zipkincore"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
|
||||
)
|
||||
|
||||
// Collector represents a Zipkin trace collector, which is probably a set of
|
||||
|
||||
2
vendor/github.com/openzipkin/zipkin-go-opentracing/collector_test.go
generated
vendored
2
vendor/github.com/openzipkin/zipkin-go-opentracing/collector_test.go
generated
vendored
@@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/zipkincore"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
|
||||
)
|
||||
|
||||
var s = makeNewSpan("203.0.113.10:1234", "service1", "avg", 123, 456, 0, true)
|
||||
|
||||
5
vendor/github.com/openzipkin/zipkin-go-opentracing/logger.go
generated
vendored
5
vendor/github.com/openzipkin/zipkin-go-opentracing/logger.go
generated
vendored
@@ -11,8 +11,9 @@ import (
|
||||
// not even in number
|
||||
var ErrMissingValue = errors.New("(MISSING)")
|
||||
|
||||
// Logger interface used by this package.
|
||||
// This means that we accept Go kit Log compatible loggers
|
||||
// Logger is the fundamental interface for all log operations. Log creates a
|
||||
// log event from keyvals, a variadic sequence of alternating keys and values.
|
||||
// The signature is compatible with the Go kit log package.
|
||||
type Logger interface {
|
||||
Log(keyvals ...interface{}) error
|
||||
}
|
||||
|
||||
52
vendor/github.com/openzipkin/zipkin-go-opentracing/observer.go
generated
vendored
Normal file
52
vendor/github.com/openzipkin/zipkin-go-opentracing/observer.go
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
package zipkintracer
|
||||
|
||||
import (
|
||||
otobserver "github.com/opentracing-contrib/go-observer"
|
||||
opentracing "github.com/opentracing/opentracing-go"
|
||||
)
|
||||
|
||||
// observer is a dispatcher to other observers
|
||||
type observer struct {
|
||||
observers []otobserver.Observer
|
||||
}
|
||||
|
||||
// spanObserver is a dispatcher to other span observers
|
||||
type spanObserver struct {
|
||||
observers []otobserver.SpanObserver
|
||||
}
|
||||
|
||||
func (o observer) OnStartSpan(sp opentracing.Span, operationName string, options opentracing.StartSpanOptions) (otobserver.SpanObserver, bool) {
|
||||
var spanObservers []otobserver.SpanObserver
|
||||
for _, obs := range o.observers {
|
||||
spanObs, ok := obs.OnStartSpan(sp, operationName, options)
|
||||
if ok {
|
||||
if spanObservers == nil {
|
||||
spanObservers = make([]otobserver.SpanObserver, 0, len(o.observers))
|
||||
}
|
||||
spanObservers = append(spanObservers, spanObs)
|
||||
}
|
||||
}
|
||||
if len(spanObservers) == 0 {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
return spanObserver{observers: spanObservers}, true
|
||||
}
|
||||
|
||||
func (o spanObserver) OnSetOperationName(operationName string) {
|
||||
for _, obs := range o.observers {
|
||||
obs.OnSetOperationName(operationName)
|
||||
}
|
||||
}
|
||||
|
||||
func (o spanObserver) OnSetTag(key string, value interface{}) {
|
||||
for _, obs := range o.observers {
|
||||
obs.OnSetTag(key, value)
|
||||
}
|
||||
}
|
||||
|
||||
func (o spanObserver) OnFinish(options opentracing.FinishOptions) {
|
||||
for _, obs := range o.observers {
|
||||
obs.OnFinish(options)
|
||||
}
|
||||
}
|
||||
30
vendor/github.com/openzipkin/zipkin-go-opentracing/sample_test.go
generated
vendored
30
vendor/github.com/openzipkin/zipkin-go-opentracing/sample_test.go
generated
vendored
@@ -13,21 +13,21 @@ func TestBoundarySampler(t *testing.T) {
|
||||
rate float64
|
||||
}
|
||||
for input, want := range map[triple]bool{
|
||||
triple{123, 456, 1.0}: true,
|
||||
triple{123, 456, 999}: true,
|
||||
triple{123, 456, 0.0}: false,
|
||||
triple{123, 456, -42}: false,
|
||||
triple{1229998, 0, 0.01}: false,
|
||||
triple{1229999, 0, 0.01}: false,
|
||||
triple{1230000, 0, 0.01}: true,
|
||||
triple{1230001, 0, 0.01}: true,
|
||||
triple{1230098, 0, 0.01}: true,
|
||||
triple{1230099, 0, 0.01}: true,
|
||||
triple{1230100, 0, 0.01}: false,
|
||||
triple{1230101, 0, 0.01}: false,
|
||||
triple{1, 9999999, 0.01}: false,
|
||||
triple{999, 0, 0.99}: true,
|
||||
triple{9999, 0, 0.99}: false,
|
||||
{123, 456, 1.0}: true,
|
||||
{123, 456, 999}: true,
|
||||
{123, 456, 0.0}: false,
|
||||
{123, 456, -42}: false,
|
||||
{1229998, 0, 0.01}: false,
|
||||
{1229999, 0, 0.01}: false,
|
||||
{1230000, 0, 0.01}: true,
|
||||
{1230001, 0, 0.01}: true,
|
||||
{1230098, 0, 0.01}: true,
|
||||
{1230099, 0, 0.01}: true,
|
||||
{1230100, 0, 0.01}: false,
|
||||
{1230101, 0, 0.01}: false,
|
||||
{1, 9999999, 0.01}: false,
|
||||
{999, 0, 0.99}: true,
|
||||
{9999, 0, 0.99}: false,
|
||||
} {
|
||||
sampler := zipkin.NewBoundarySampler(input.rate, input.salt)
|
||||
if have := sampler(input.id); want != have {
|
||||
|
||||
15
vendor/github.com/openzipkin/zipkin-go-opentracing/span.go
generated
vendored
15
vendor/github.com/openzipkin/zipkin-go-opentracing/span.go
generated
vendored
@@ -8,7 +8,8 @@ import (
|
||||
"github.com/opentracing/opentracing-go/ext"
|
||||
"github.com/opentracing/opentracing-go/log"
|
||||
|
||||
"github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/zipkincore"
|
||||
otobserver "github.com/opentracing-contrib/go-observer"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
|
||||
)
|
||||
|
||||
// Span provides access to the essential details of the span, for use
|
||||
@@ -29,6 +30,7 @@ type Span interface {
|
||||
type spanImpl struct {
|
||||
tracer *tracerImpl
|
||||
event func(SpanEvent)
|
||||
observer otobserver.SpanObserver
|
||||
sync.Mutex // protects the fields below
|
||||
raw RawSpan
|
||||
// The number of logs dropped because of MaxLogsPerSpan.
|
||||
@@ -63,6 +65,9 @@ func (s *spanImpl) reset() {
|
||||
}
|
||||
|
||||
func (s *spanImpl) SetOperationName(operationName string) opentracing.Span {
|
||||
if s.observer != nil {
|
||||
s.observer.OnSetOperationName(operationName)
|
||||
}
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
s.raw.Operation = operationName
|
||||
@@ -75,6 +80,10 @@ func (s *spanImpl) trim() bool {
|
||||
|
||||
func (s *spanImpl) SetTag(key string, value interface{}) opentracing.Span {
|
||||
defer s.onTag(key, value)
|
||||
if s.observer != nil {
|
||||
s.observer.OnSetTag(key, value)
|
||||
}
|
||||
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
if key == string(ext.SamplingPriority) {
|
||||
@@ -190,6 +199,10 @@ func (s *spanImpl) FinishWithOptions(opts opentracing.FinishOptions) {
|
||||
}
|
||||
duration := finishTime.Sub(s.raw.Start)
|
||||
|
||||
if s.observer != nil {
|
||||
s.observer.OnFinish(opts)
|
||||
}
|
||||
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
for f in *.thrift ; do
|
||||
thrift -r --gen go:thrift_import=github.com/apache/thrift/lib/go/thrift $f
|
||||
thrift -r --gen go:thrift_import=github.com/apache/thrift/lib/go/thrift,package_prefix=github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/ $f
|
||||
done
|
||||
7
vendor/github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/scribe/GoUnusedProtection__.go
generated
vendored
Normal file
7
vendor/github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/scribe/GoUnusedProtection__.go
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
|
||||
package scribe
|
||||
|
||||
var GoUnusedProtection__ int;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
// Autogenerated by Thrift Compiler (0.9.3)
|
||||
// Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
|
||||
package scribe
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"reflect"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
)
|
||||
@@ -12,7 +14,11 @@ import (
|
||||
// (needed to ensure safety because of naive import list construction.)
|
||||
var _ = thrift.ZERO
|
||||
var _ = fmt.Printf
|
||||
var _ = context.Background
|
||||
var _ = reflect.DeepEqual
|
||||
var _ = bytes.Equal
|
||||
|
||||
|
||||
func init() {
|
||||
}
|
||||
|
||||
550
vendor/github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/scribe/scribe.go
generated
vendored
Normal file
550
vendor/github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/scribe/scribe.go
generated
vendored
Normal file
@@ -0,0 +1,550 @@
|
||||
// Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
|
||||
package scribe
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"reflect"
|
||||
"database/sql/driver"
|
||||
"errors"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
)
|
||||
|
||||
// (needed to ensure safety because of naive import list construction.)
|
||||
var _ = thrift.ZERO
|
||||
var _ = fmt.Printf
|
||||
var _ = context.Background
|
||||
var _ = reflect.DeepEqual
|
||||
var _ = bytes.Equal
|
||||
|
||||
type ResultCode int64
|
||||
const (
|
||||
ResultCode_OK ResultCode = 0
|
||||
ResultCode_TRY_LATER ResultCode = 1
|
||||
)
|
||||
|
||||
func (p ResultCode) String() string {
|
||||
switch p {
|
||||
case ResultCode_OK: return "OK"
|
||||
case ResultCode_TRY_LATER: return "TRY_LATER"
|
||||
}
|
||||
return "<UNSET>"
|
||||
}
|
||||
|
||||
func ResultCodeFromString(s string) (ResultCode, error) {
|
||||
switch s {
|
||||
case "OK": return ResultCode_OK, nil
|
||||
case "TRY_LATER": return ResultCode_TRY_LATER, nil
|
||||
}
|
||||
return ResultCode(0), fmt.Errorf("not a valid ResultCode string")
|
||||
}
|
||||
|
||||
|
||||
func ResultCodePtr(v ResultCode) *ResultCode { return &v }
|
||||
|
||||
func (p ResultCode) MarshalText() ([]byte, error) {
|
||||
return []byte(p.String()), nil
|
||||
}
|
||||
|
||||
func (p *ResultCode) UnmarshalText(text []byte) error {
|
||||
q, err := ResultCodeFromString(string(text))
|
||||
if (err != nil) {
|
||||
return err
|
||||
}
|
||||
*p = q
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *ResultCode) Scan(value interface{}) error {
|
||||
v, ok := value.(int64)
|
||||
if !ok {
|
||||
return errors.New("Scan value is not int64")
|
||||
}
|
||||
*p = ResultCode(v)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p * ResultCode) Value() (driver.Value, error) {
|
||||
if p == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return int64(*p), nil
|
||||
}
|
||||
// Attributes:
|
||||
// - Category
|
||||
// - Message
|
||||
type LogEntry struct {
|
||||
Category string `thrift:"category,1" db:"category" json:"category"`
|
||||
Message string `thrift:"message,2" db:"message" json:"message"`
|
||||
}
|
||||
|
||||
func NewLogEntry() *LogEntry {
|
||||
return &LogEntry{}
|
||||
}
|
||||
|
||||
|
||||
func (p *LogEntry) GetCategory() string {
|
||||
return p.Category
|
||||
}
|
||||
|
||||
func (p *LogEntry) GetMessage() string {
|
||||
return p.Message
|
||||
}
|
||||
func (p *LogEntry) Read(iprot thrift.TProtocol) error {
|
||||
if _, err := iprot.ReadStructBegin(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
|
||||
}
|
||||
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
|
||||
}
|
||||
if fieldTypeId == thrift.STOP { break; }
|
||||
switch fieldId {
|
||||
case 1:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err := p.ReadField1(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if err := iprot.Skip(fieldTypeId); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
case 2:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err := p.ReadField2(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if err := iprot.Skip(fieldTypeId); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
default:
|
||||
if err := iprot.Skip(fieldTypeId); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := iprot.ReadFieldEnd(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := iprot.ReadStructEnd(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *LogEntry) ReadField1(iprot thrift.TProtocol) error {
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return thrift.PrependError("error reading field 1: ", err)
|
||||
} else {
|
||||
p.Category = v
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *LogEntry) ReadField2(iprot thrift.TProtocol) error {
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return thrift.PrependError("error reading field 2: ", err)
|
||||
} else {
|
||||
p.Message = v
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *LogEntry) Write(oprot thrift.TProtocol) error {
|
||||
if err := oprot.WriteStructBegin("LogEntry"); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
|
||||
if p != nil {
|
||||
if err := p.writeField1(oprot); err != nil { return err }
|
||||
if err := p.writeField2(oprot); err != nil { return err }
|
||||
}
|
||||
if err := oprot.WriteFieldStop(); err != nil {
|
||||
return thrift.PrependError("write field stop error: ", err) }
|
||||
if err := oprot.WriteStructEnd(); err != nil {
|
||||
return thrift.PrependError("write struct stop error: ", err) }
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *LogEntry) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if err := oprot.WriteFieldBegin("category", thrift.STRING, 1); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:category: ", p), err) }
|
||||
if err := oprot.WriteString(string(p.Category)); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T.category (1) field write error: ", p), err) }
|
||||
if err := oprot.WriteFieldEnd(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:category: ", p), err) }
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *LogEntry) writeField2(oprot thrift.TProtocol) (err error) {
|
||||
if err := oprot.WriteFieldBegin("message", thrift.STRING, 2); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:message: ", p), err) }
|
||||
if err := oprot.WriteString(string(p.Message)); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T.message (2) field write error: ", p), err) }
|
||||
if err := oprot.WriteFieldEnd(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:message: ", p), err) }
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *LogEntry) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("LogEntry(%+v)", *p)
|
||||
}
|
||||
|
||||
type Scribe interface {
|
||||
// Parameters:
|
||||
// - Messages
|
||||
Log(ctx context.Context, messages []*LogEntry) (r ResultCode, err error)
|
||||
}
|
||||
|
||||
type ScribeClient struct {
|
||||
c thrift.TClient
|
||||
}
|
||||
|
||||
// Deprecated: Use NewScribe instead
|
||||
func NewScribeClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ScribeClient {
|
||||
return &ScribeClient{
|
||||
c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
|
||||
}
|
||||
}
|
||||
|
||||
// Deprecated: Use NewScribe instead
|
||||
func NewScribeClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ScribeClient {
|
||||
return &ScribeClient{
|
||||
c: thrift.NewTStandardClient(iprot, oprot),
|
||||
}
|
||||
}
|
||||
|
||||
func NewScribeClient(c thrift.TClient) *ScribeClient {
|
||||
return &ScribeClient{
|
||||
c: c,
|
||||
}
|
||||
}
|
||||
|
||||
// Parameters:
|
||||
// - Messages
|
||||
func (p *ScribeClient) Log(ctx context.Context, messages []*LogEntry) (r ResultCode, err error) {
|
||||
var _args0 ScribeLogArgs
|
||||
_args0.Messages = messages
|
||||
var _result1 ScribeLogResult
|
||||
if err = p.c.Call(ctx, "Log", &_args0, &_result1); err != nil {
|
||||
return
|
||||
}
|
||||
return _result1.GetSuccess(), nil
|
||||
}
|
||||
|
||||
type ScribeProcessor struct {
|
||||
processorMap map[string]thrift.TProcessorFunction
|
||||
handler Scribe
|
||||
}
|
||||
|
||||
func (p *ScribeProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
|
||||
p.processorMap[key] = processor
|
||||
}
|
||||
|
||||
func (p *ScribeProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
|
||||
processor, ok = p.processorMap[key]
|
||||
return processor, ok
|
||||
}
|
||||
|
||||
func (p *ScribeProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
|
||||
return p.processorMap
|
||||
}
|
||||
|
||||
func NewScribeProcessor(handler Scribe) *ScribeProcessor {
|
||||
|
||||
self2 := &ScribeProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)}
|
||||
self2.processorMap["Log"] = &scribeProcessorLog{handler:handler}
|
||||
return self2
|
||||
}
|
||||
|
||||
func (p *ScribeProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
|
||||
name, _, seqId, err := iprot.ReadMessageBegin()
|
||||
if err != nil { return false, err }
|
||||
if processor, ok := p.GetProcessorFunction(name); ok {
|
||||
return processor.Process(ctx, seqId, iprot, oprot)
|
||||
}
|
||||
iprot.Skip(thrift.STRUCT)
|
||||
iprot.ReadMessageEnd()
|
||||
x3 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name)
|
||||
oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
|
||||
x3.Write(oprot)
|
||||
oprot.WriteMessageEnd()
|
||||
oprot.Flush()
|
||||
return false, x3
|
||||
|
||||
}
|
||||
|
||||
type scribeProcessorLog struct {
|
||||
handler Scribe
|
||||
}
|
||||
|
||||
func (p *scribeProcessorLog) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
|
||||
args := ScribeLogArgs{}
|
||||
if err = args.Read(iprot); err != nil {
|
||||
iprot.ReadMessageEnd()
|
||||
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
|
||||
oprot.WriteMessageBegin("Log", thrift.EXCEPTION, seqId)
|
||||
x.Write(oprot)
|
||||
oprot.WriteMessageEnd()
|
||||
oprot.Flush()
|
||||
return false, err
|
||||
}
|
||||
|
||||
iprot.ReadMessageEnd()
|
||||
result := ScribeLogResult{}
|
||||
var retval ResultCode
|
||||
var err2 error
|
||||
if retval, err2 = p.handler.Log(ctx, args.Messages); err2 != nil {
|
||||
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing Log: " + err2.Error())
|
||||
oprot.WriteMessageBegin("Log", thrift.EXCEPTION, seqId)
|
||||
x.Write(oprot)
|
||||
oprot.WriteMessageEnd()
|
||||
oprot.Flush()
|
||||
return true, err2
|
||||
} else {
|
||||
result.Success = &retval
|
||||
}
|
||||
if err2 = oprot.WriteMessageBegin("Log", thrift.REPLY, seqId); err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = result.Write(oprot); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = oprot.Flush(); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return true, err
|
||||
}
|
||||
|
||||
|
||||
// HELPER FUNCTIONS AND STRUCTURES
|
||||
|
||||
// Attributes:
|
||||
// - Messages
|
||||
type ScribeLogArgs struct {
|
||||
Messages []*LogEntry `thrift:"messages,1" db:"messages" json:"messages"`
|
||||
}
|
||||
|
||||
func NewScribeLogArgs() *ScribeLogArgs {
|
||||
return &ScribeLogArgs{}
|
||||
}
|
||||
|
||||
|
||||
func (p *ScribeLogArgs) GetMessages() []*LogEntry {
|
||||
return p.Messages
|
||||
}
|
||||
func (p *ScribeLogArgs) Read(iprot thrift.TProtocol) error {
|
||||
if _, err := iprot.ReadStructBegin(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
|
||||
}
|
||||
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
|
||||
}
|
||||
if fieldTypeId == thrift.STOP { break; }
|
||||
switch fieldId {
|
||||
case 1:
|
||||
if fieldTypeId == thrift.LIST {
|
||||
if err := p.ReadField1(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if err := iprot.Skip(fieldTypeId); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
default:
|
||||
if err := iprot.Skip(fieldTypeId); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := iprot.ReadFieldEnd(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := iprot.ReadStructEnd(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *ScribeLogArgs) ReadField1(iprot thrift.TProtocol) error {
|
||||
_, size, err := iprot.ReadListBegin()
|
||||
if err != nil {
|
||||
return thrift.PrependError("error reading list begin: ", err)
|
||||
}
|
||||
tSlice := make([]*LogEntry, 0, size)
|
||||
p.Messages = tSlice
|
||||
for i := 0; i < size; i ++ {
|
||||
_elem4 := &LogEntry{}
|
||||
if err := _elem4.Read(iprot); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err)
|
||||
}
|
||||
p.Messages = append(p.Messages, _elem4)
|
||||
}
|
||||
if err := iprot.ReadListEnd(); err != nil {
|
||||
return thrift.PrependError("error reading list end: ", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *ScribeLogArgs) Write(oprot thrift.TProtocol) error {
|
||||
if err := oprot.WriteStructBegin("Log_args"); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
|
||||
if p != nil {
|
||||
if err := p.writeField1(oprot); err != nil { return err }
|
||||
}
|
||||
if err := oprot.WriteFieldStop(); err != nil {
|
||||
return thrift.PrependError("write field stop error: ", err) }
|
||||
if err := oprot.WriteStructEnd(); err != nil {
|
||||
return thrift.PrependError("write struct stop error: ", err) }
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *ScribeLogArgs) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if err := oprot.WriteFieldBegin("messages", thrift.LIST, 1); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:messages: ", p), err) }
|
||||
if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Messages)); err != nil {
|
||||
return thrift.PrependError("error writing list begin: ", err)
|
||||
}
|
||||
for _, v := range p.Messages {
|
||||
if err := v.Write(oprot); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
|
||||
}
|
||||
}
|
||||
if err := oprot.WriteListEnd(); err != nil {
|
||||
return thrift.PrependError("error writing list end: ", err)
|
||||
}
|
||||
if err := oprot.WriteFieldEnd(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:messages: ", p), err) }
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *ScribeLogArgs) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("ScribeLogArgs(%+v)", *p)
|
||||
}
|
||||
|
||||
// Attributes:
|
||||
// - Success
|
||||
type ScribeLogResult struct {
|
||||
Success *ResultCode `thrift:"success,0" db:"success" json:"success,omitempty"`
|
||||
}
|
||||
|
||||
func NewScribeLogResult() *ScribeLogResult {
|
||||
return &ScribeLogResult{}
|
||||
}
|
||||
|
||||
var ScribeLogResult_Success_DEFAULT ResultCode
|
||||
func (p *ScribeLogResult) GetSuccess() ResultCode {
|
||||
if !p.IsSetSuccess() {
|
||||
return ScribeLogResult_Success_DEFAULT
|
||||
}
|
||||
return *p.Success
|
||||
}
|
||||
func (p *ScribeLogResult) IsSetSuccess() bool {
|
||||
return p.Success != nil
|
||||
}
|
||||
|
||||
func (p *ScribeLogResult) Read(iprot thrift.TProtocol) error {
|
||||
if _, err := iprot.ReadStructBegin(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
|
||||
}
|
||||
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
|
||||
}
|
||||
if fieldTypeId == thrift.STOP { break; }
|
||||
switch fieldId {
|
||||
case 0:
|
||||
if fieldTypeId == thrift.I32 {
|
||||
if err := p.ReadField0(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if err := iprot.Skip(fieldTypeId); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
default:
|
||||
if err := iprot.Skip(fieldTypeId); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := iprot.ReadFieldEnd(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := iprot.ReadStructEnd(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *ScribeLogResult) ReadField0(iprot thrift.TProtocol) error {
|
||||
if v, err := iprot.ReadI32(); err != nil {
|
||||
return thrift.PrependError("error reading field 0: ", err)
|
||||
} else {
|
||||
temp := ResultCode(v)
|
||||
p.Success = &temp
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *ScribeLogResult) Write(oprot thrift.TProtocol) error {
|
||||
if err := oprot.WriteStructBegin("Log_result"); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
|
||||
if p != nil {
|
||||
if err := p.writeField0(oprot); err != nil { return err }
|
||||
}
|
||||
if err := oprot.WriteFieldStop(); err != nil {
|
||||
return thrift.PrependError("write field stop error: ", err) }
|
||||
if err := oprot.WriteStructEnd(); err != nil {
|
||||
return thrift.PrependError("write struct stop error: ", err) }
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *ScribeLogResult) writeField0(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetSuccess() {
|
||||
if err := oprot.WriteFieldBegin("success", thrift.I32, 0); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
|
||||
if err := oprot.WriteI32(int32(*p.Success)); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T.success (0) field write error: ", p), err) }
|
||||
if err := oprot.WriteFieldEnd(); err != nil {
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *ScribeLogResult) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("ScribeLogResult(%+v)", *p)
|
||||
}
|
||||
|
||||
|
||||
7
vendor/github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore/GoUnusedProtection__.go
generated
vendored
Normal file
7
vendor/github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore/GoUnusedProtection__.go
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
|
||||
package zipkincore
|
||||
|
||||
var GoUnusedProtection__ int;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
// Autogenerated by Thrift Compiler (0.9.3)
|
||||
// Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
|
||||
package zipkincore
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"reflect"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
)
|
||||
@@ -12,6 +14,8 @@ import (
|
||||
// (needed to ensure safety because of naive import list construction.)
|
||||
var _ = thrift.ZERO
|
||||
var _ = fmt.Printf
|
||||
var _ = context.Background
|
||||
var _ = reflect.DeepEqual
|
||||
var _ = bytes.Equal
|
||||
|
||||
const CLIENT_SEND = "cs"
|
||||
@@ -38,3 +42,4 @@ const SERVER_ADDR = "sa"
|
||||
|
||||
func init() {
|
||||
}
|
||||
|
||||
1285
vendor/github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore/zipkinCore.go
generated
vendored
Normal file
1285
vendor/github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore/zipkinCore.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
18
vendor/github.com/openzipkin/zipkin-go-opentracing/tracer.go
generated
vendored
18
vendor/github.com/openzipkin/zipkin-go-opentracing/tracer.go
generated
vendored
@@ -7,6 +7,7 @@ import (
|
||||
opentracing "github.com/opentracing/opentracing-go"
|
||||
"github.com/opentracing/opentracing-go/ext"
|
||||
|
||||
otobserver "github.com/opentracing-contrib/go-observer"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/flag"
|
||||
)
|
||||
|
||||
@@ -107,6 +108,8 @@ type TracerOptions struct {
|
||||
// Regardless of this setting, the library will propagate and support both
|
||||
// 64 and 128 bit incoming traces from upstream sources.
|
||||
traceID128Bit bool
|
||||
|
||||
observer otobserver.Observer
|
||||
}
|
||||
|
||||
// TracerOption allows for functional options.
|
||||
@@ -231,6 +234,7 @@ func NewTracer(recorder SpanRecorder, options ...TracerOption) (opentracing.Trac
|
||||
debugMode: false,
|
||||
traceID128Bit: false,
|
||||
maxLogsPerSpan: 10000,
|
||||
observer: nil,
|
||||
}
|
||||
for _, o := range options {
|
||||
err := o(opts)
|
||||
@@ -289,6 +293,11 @@ func (t *tracerImpl) startSpanWithOptions(
|
||||
// Build the new span. This is the only allocation: We'll return this as
|
||||
// an opentracing.Span.
|
||||
sp := t.getSpan()
|
||||
|
||||
if t.options.observer != nil {
|
||||
sp.observer, _ = t.options.observer.OnStartSpan(sp, operationName, opts)
|
||||
}
|
||||
|
||||
// Look for a parent in the list of References.
|
||||
//
|
||||
// TODO: would be nice if basictracer did something with all
|
||||
@@ -379,6 +388,7 @@ func (t *tracerImpl) startSpanInternal(
|
||||
sp.raw.Start = startTime
|
||||
sp.raw.Duration = -1
|
||||
sp.raw.Tags = tags
|
||||
|
||||
if t.options.debugAssertSingleGoroutine {
|
||||
sp.SetTag(debugGoroutineIDTag, curGoroutineID())
|
||||
}
|
||||
@@ -420,3 +430,11 @@ func (t *tracerImpl) Extract(format interface{}, carrier interface{}) (opentraci
|
||||
func (t *tracerImpl) Options() TracerOptions {
|
||||
return t.options
|
||||
}
|
||||
|
||||
// WithObserver assigns an initialized observer to opts.observer
|
||||
func WithObserver(observer otobserver.Observer) TracerOption {
|
||||
return func(opts *TracerOptions) error {
|
||||
opts.observer = observer
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
2
vendor/github.com/openzipkin/zipkin-go-opentracing/wire/gen.go
generated
vendored
2
vendor/github.com/openzipkin/zipkin-go-opentracing/wire/gen.go
generated
vendored
@@ -1,6 +1,6 @@
|
||||
package wire
|
||||
|
||||
//go:generate protoc --gogofaster_out=$GOPATH/src/github.com/openzipkin/zipkin-go-opentracing/wire wire.proto
|
||||
//go:generate protoc --gogofaster_out=$GOPATH/src wire.proto
|
||||
|
||||
// Run `go get github.com/gogo/protobuf/protoc-gen-gogofaster` to install the
|
||||
// gogofaster generator binary.
|
||||
|
||||
42
vendor/github.com/openzipkin/zipkin-go-opentracing/wire/wire.pb.go
generated
vendored
42
vendor/github.com/openzipkin/zipkin-go-opentracing/wire/wire.pb.go
generated
vendored
@@ -624,24 +624,26 @@ var (
|
||||
func init() { proto.RegisterFile("wire.proto", fileDescriptorWire) }
|
||||
|
||||
var fileDescriptorWire = []byte{
|
||||
// 300 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0xcf, 0x2c, 0x4a,
|
||||
0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xa9, 0xca, 0x2c, 0xc8, 0xce, 0xcc, 0x2b, 0x29,
|
||||
0x4a, 0x4c, 0x4e, 0x2d, 0x8a, 0x4f, 0xcf, 0xd7, 0x03, 0xc9, 0x29, 0x5d, 0x63, 0xe2, 0xe2, 0x0e,
|
||||
0x01, 0x0b, 0x05, 0x97, 0x24, 0x96, 0xa4, 0x0a, 0x49, 0x72, 0x71, 0x80, 0x55, 0xc4, 0x67, 0xa6,
|
||||
0x48, 0x30, 0x2a, 0x30, 0x6a, 0xb0, 0x05, 0xb1, 0x83, 0xf9, 0x9e, 0x29, 0x42, 0xe2, 0x5c, 0xec,
|
||||
0xc5, 0x05, 0x89, 0x79, 0x20, 0x19, 0x26, 0xb0, 0x0c, 0x1b, 0x88, 0xeb, 0x99, 0x22, 0x24, 0xc1,
|
||||
0xc5, 0x5e, 0x9c, 0x98, 0x5b, 0x90, 0x93, 0x9a, 0x22, 0xc1, 0xac, 0xc0, 0xa8, 0xc1, 0x11, 0x04,
|
||||
0xe3, 0x0a, 0x45, 0x70, 0xf1, 0x26, 0x25, 0xa6, 0xa7, 0x27, 0xa6, 0xa7, 0xc6, 0x67, 0x96, 0xa4,
|
||||
0xe6, 0x16, 0x4b, 0xb0, 0x28, 0x30, 0x6b, 0x70, 0x1b, 0x19, 0xeb, 0x61, 0x73, 0x8b, 0x1e, 0x92,
|
||||
0x3b, 0xf4, 0x9c, 0x20, 0xda, 0x3c, 0x41, 0xba, 0x5c, 0xf3, 0x4a, 0x8a, 0x2a, 0x83, 0x78, 0x92,
|
||||
0x90, 0x84, 0x84, 0x94, 0xb8, 0x78, 0x61, 0xee, 0x8c, 0xcf, 0xc8, 0x4c, 0xcf, 0x90, 0x10, 0x01,
|
||||
0x3b, 0x89, 0x1b, 0xea, 0x58, 0x8f, 0xcc, 0xf4, 0x0c, 0x21, 0x15, 0x2e, 0xbe, 0x82, 0xc4, 0xa2,
|
||||
0xd4, 0xbc, 0x92, 0x78, 0x98, 0xbb, 0x45, 0xc1, 0x8a, 0x78, 0x20, 0xa2, 0xc1, 0x10, 0xd7, 0x8b,
|
||||
0x70, 0xb1, 0xa6, 0xe5, 0x24, 0xa6, 0x17, 0x4b, 0x88, 0x81, 0x25, 0x21, 0x1c, 0x29, 0x7b, 0x2e,
|
||||
0x41, 0x0c, 0x27, 0x08, 0x09, 0x70, 0x31, 0x67, 0xa7, 0x56, 0x82, 0xc3, 0x85, 0x33, 0x08, 0xc4,
|
||||
0x04, 0x69, 0x2e, 0x4b, 0xcc, 0x29, 0x4d, 0x05, 0x87, 0x08, 0x67, 0x10, 0x84, 0x63, 0xc5, 0x64,
|
||||
0xc1, 0xe8, 0x24, 0x76, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31,
|
||||
0x4e, 0x78, 0x2c, 0xc7, 0x10, 0xc5, 0x02, 0xf2, 0x64, 0x12, 0x1b, 0x38, 0x36, 0x8c, 0x01, 0x01,
|
||||
0x00, 0x00, 0xff, 0xff, 0xb5, 0x5e, 0x0d, 0x33, 0x9b, 0x01, 0x00, 0x00,
|
||||
// 325 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x91, 0xcf, 0x4a, 0x03, 0x31,
|
||||
0x18, 0xc4, 0x4d, 0xab, 0xfd, 0xf3, 0xb5, 0x15, 0x0d, 0x55, 0x57, 0x0f, 0x4b, 0x29, 0x1e, 0x7a,
|
||||
0xe9, 0x56, 0xec, 0x45, 0xbc, 0x08, 0x05, 0xc1, 0x5e, 0xb7, 0x1e, 0xc4, 0xcb, 0x92, 0xed, 0xc6,
|
||||
0x6c, 0x68, 0x9b, 0x84, 0x6c, 0xaa, 0xd4, 0xa7, 0xf0, 0xb1, 0x3c, 0x7a, 0xf2, 0x2c, 0xf5, 0x45,
|
||||
0x24, 0x89, 0x85, 0x82, 0x9e, 0x76, 0x67, 0xe6, 0x1b, 0xf8, 0x31, 0x01, 0x78, 0xe1, 0x9a, 0x46,
|
||||
0x4a, 0x4b, 0x23, 0x71, 0xfb, 0x95, 0xab, 0x19, 0x17, 0x46, 0x93, 0x29, 0xd5, 0x09, 0x93, 0x91,
|
||||
0xcd, 0xba, 0x9f, 0x25, 0x68, 0xdc, 0x3b, 0x6b, 0x62, 0x88, 0xa1, 0xf8, 0x14, 0x6a, 0xee, 0x22,
|
||||
0xe1, 0x59, 0x80, 0x3a, 0xa8, 0x57, 0x89, 0xab, 0x4e, 0x8f, 0x33, 0x7c, 0x02, 0xd5, 0x42, 0x11,
|
||||
0x61, 0x93, 0x92, 0x4b, 0x2a, 0x56, 0x8e, 0x33, 0x1c, 0x40, 0xb5, 0x20, 0x0b, 0x35, 0xa7, 0x59,
|
||||
0x50, 0xee, 0xa0, 0x5e, 0x2d, 0xde, 0x48, 0xfc, 0x00, 0xad, 0x94, 0x30, 0x46, 0x18, 0x4d, 0xb8,
|
||||
0xa1, 0x8b, 0x22, 0xd8, 0xed, 0x94, 0x7b, 0x8d, 0xcb, 0x61, 0xf4, 0x1f, 0x4b, 0xb4, 0xc5, 0x11,
|
||||
0x8d, 0x7c, 0x6d, 0x6c, 0x5b, 0xb7, 0xc2, 0xe8, 0x55, 0xdc, 0x4c, 0xb7, 0x2c, 0xdc, 0x85, 0xd6,
|
||||
0x86, 0x33, 0xc9, 0x39, 0xcb, 0x83, 0xb6, 0x43, 0x6a, 0xfc, 0xc2, 0xde, 0x71, 0x96, 0xe3, 0x73,
|
||||
0xd8, 0x57, 0x44, 0x53, 0x61, 0x92, 0x0d, 0xf7, 0x91, 0x3b, 0x6a, 0x7a, 0x77, 0xe2, 0xe9, 0xdb,
|
||||
0xb0, 0xf7, 0x34, 0x27, 0xac, 0x08, 0x8e, 0x5d, 0xe8, 0xc5, 0xd9, 0x0d, 0x1c, 0xfe, 0x41, 0xc0,
|
||||
0x07, 0x50, 0x9e, 0xd1, 0x95, 0xdb, 0xa5, 0x1e, 0xdb, 0x5f, 0x5b, 0x7e, 0x26, 0xf3, 0x25, 0x75,
|
||||
0x8b, 0xd4, 0x63, 0x2f, 0xae, 0x4b, 0x57, 0x68, 0x34, 0x7a, 0x5f, 0x87, 0xe8, 0x63, 0x1d, 0xa2,
|
||||
0xaf, 0x75, 0x88, 0xde, 0xbe, 0xc3, 0x9d, 0xc7, 0x0b, 0xc6, 0x4d, 0xbe, 0x4c, 0xa3, 0xa9, 0x5c,
|
||||
0x0c, 0xa4, 0xa2, 0xc2, 0x6f, 0x30, 0xf0, 0x9f, 0x3e, 0x93, 0x7d, 0x6b, 0x5a, 0x7e, 0x2e, 0xd8,
|
||||
0xc0, 0x0e, 0x92, 0x56, 0xdc, 0xcb, 0x0d, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x3a, 0xab, 0xcc,
|
||||
0x6b, 0xc7, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
||||
2
vendor/github.com/openzipkin/zipkin-go-opentracing/wire/wire.proto
generated
vendored
2
vendor/github.com/openzipkin/zipkin-go-opentracing/wire/wire.proto
generated
vendored
@@ -1,6 +1,6 @@
|
||||
syntax = "proto3";
|
||||
package zipkintracer_go.wire;
|
||||
option go_package = "wire";
|
||||
option go_package = "github.com/openzipkin/zipkin-go-opentracing/wire";
|
||||
|
||||
message TracerState {
|
||||
fixed64 trace_id = 1;
|
||||
|
||||
2
vendor/github.com/openzipkin/zipkin-go-opentracing/zipkin-endpoint.go
generated
vendored
2
vendor/github.com/openzipkin/zipkin-go-opentracing/zipkin-endpoint.go
generated
vendored
@@ -6,7 +6,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/zipkincore"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
|
||||
)
|
||||
|
||||
// makeEndpoint takes the hostport and service name that represent this Zipkin
|
||||
|
||||
86
vendor/github.com/openzipkin/zipkin-go-opentracing/zipkin-recorder.go
generated
vendored
86
vendor/github.com/openzipkin/zipkin-go-opentracing/zipkin-recorder.go
generated
vendored
@@ -3,7 +3,6 @@ package zipkintracer
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"math"
|
||||
"net"
|
||||
"strconv"
|
||||
"time"
|
||||
@@ -11,8 +10,8 @@ import (
|
||||
otext "github.com/opentracing/opentracing-go/ext"
|
||||
"github.com/opentracing/opentracing-go/log"
|
||||
|
||||
"github.com/openzipkin/zipkin-go-opentracing/_thrift/gen-go/zipkincore"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/flag"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -202,86 +201,17 @@ func annotate(span *zipkincore.Span, timestamp time.Time, value string, host *zi
|
||||
// annotateBinary annotates the span with a key and a value that will be []byte
|
||||
// encoded.
|
||||
func annotateBinary(span *zipkincore.Span, key string, value interface{}, host *zipkincore.Endpoint) {
|
||||
var a zipkincore.AnnotationType
|
||||
var b []byte
|
||||
// We are not using zipkincore.AnnotationType_I16 for types that could fit
|
||||
// as reporting on it seems to be broken on the zipkin web interface
|
||||
// (however, we can properly extract the number from zipkin storage
|
||||
// directly). int64 has issues with negative numbers but seems ok for
|
||||
// positive numbers needing more than 32 bit.
|
||||
switch v := value.(type) {
|
||||
case bool:
|
||||
a = zipkincore.AnnotationType_BOOL
|
||||
b = []byte("\x00")
|
||||
if v {
|
||||
b = []byte("\x01")
|
||||
if b, ok := value.(bool); ok {
|
||||
if b {
|
||||
value = "true"
|
||||
} else {
|
||||
value = "false"
|
||||
}
|
||||
case []byte:
|
||||
a = zipkincore.AnnotationType_BYTES
|
||||
b = v
|
||||
case byte:
|
||||
a = zipkincore.AnnotationType_I32
|
||||
b = make([]byte, 4)
|
||||
binary.BigEndian.PutUint32(b, uint32(v))
|
||||
case int8:
|
||||
a = zipkincore.AnnotationType_I32
|
||||
b = make([]byte, 4)
|
||||
binary.BigEndian.PutUint32(b, uint32(v))
|
||||
case int16:
|
||||
a = zipkincore.AnnotationType_I32
|
||||
b = make([]byte, 4)
|
||||
binary.BigEndian.PutUint32(b, uint32(v))
|
||||
case uint16:
|
||||
a = zipkincore.AnnotationType_I32
|
||||
b = make([]byte, 4)
|
||||
binary.BigEndian.PutUint32(b, uint32(v))
|
||||
case int32:
|
||||
a = zipkincore.AnnotationType_I32
|
||||
b = make([]byte, 4)
|
||||
binary.BigEndian.PutUint32(b, uint32(v))
|
||||
case uint32:
|
||||
a = zipkincore.AnnotationType_I32
|
||||
b = make([]byte, 4)
|
||||
binary.BigEndian.PutUint32(b, v)
|
||||
case int64:
|
||||
a = zipkincore.AnnotationType_I64
|
||||
b = make([]byte, 8)
|
||||
binary.BigEndian.PutUint64(b, uint64(v))
|
||||
case int:
|
||||
a = zipkincore.AnnotationType_I32
|
||||
b = make([]byte, 8)
|
||||
binary.BigEndian.PutUint32(b, uint32(v))
|
||||
case uint:
|
||||
a = zipkincore.AnnotationType_I32
|
||||
b = make([]byte, 8)
|
||||
binary.BigEndian.PutUint32(b, uint32(v))
|
||||
case uint64:
|
||||
a = zipkincore.AnnotationType_I64
|
||||
b = make([]byte, 8)
|
||||
binary.BigEndian.PutUint64(b, v)
|
||||
case float32:
|
||||
a = zipkincore.AnnotationType_DOUBLE
|
||||
b = make([]byte, 8)
|
||||
bits := math.Float64bits(float64(v))
|
||||
binary.BigEndian.PutUint64(b, bits)
|
||||
case float64:
|
||||
a = zipkincore.AnnotationType_DOUBLE
|
||||
b = make([]byte, 8)
|
||||
bits := math.Float64bits(v)
|
||||
binary.BigEndian.PutUint64(b, bits)
|
||||
case string:
|
||||
a = zipkincore.AnnotationType_STRING
|
||||
b = []byte(v)
|
||||
default:
|
||||
// we have no handler for type's value, but let's get a string
|
||||
// representation of it.
|
||||
a = zipkincore.AnnotationType_STRING
|
||||
b = []byte(fmt.Sprintf("%+v", value))
|
||||
}
|
||||
span.BinaryAnnotations = append(span.BinaryAnnotations, &zipkincore.BinaryAnnotation{
|
||||
Key: key,
|
||||
Value: b,
|
||||
AnnotationType: a,
|
||||
Value: []byte(fmt.Sprintf("%+v", value)),
|
||||
AnnotationType: zipkincore.AnnotationType_STRING,
|
||||
Host: host,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user