./scripts/build-all-in-one-image.sh`.
GOARCH=${GOARCH:-$(go env GOARCH)}
-expected_version="v10"
+expected_version="v16"
version=$(node --version)
major_version=${version%.*.*}
if [ "$major_version" = "$expected_version" ] ; then
diff --git a/scripts/build-upload-docker-images.sh b/scripts/build-upload-docker-images.sh
index 7e004fc48bd..3f3c9254a1e 100755
--- a/scripts/build-upload-docker-images.sh
+++ b/scripts/build-upload-docker-images.sh
@@ -13,30 +13,19 @@ make build-binaries-arm64
# build multi-arch docker images
platforms="linux/amd64,linux/s390x,linux/ppc64le,linux/arm64"
-# build/upload images for release version of Jaeger backend components
-for component in agent collector query ingester
+# build/upload raw and debug images of Jaeger backend components
+for component in agent collector query ingester remote-storage
do
bash scripts/build-upload-a-docker-image.sh -b -c "jaeger-${component}" -d "cmd/${component}" -p "${platforms}" -t release
+ bash scripts/build-upload-a-docker-image.sh -b -c "jaeger-${component}-debug" -d "cmd/${component}" -t debug
done
-# build/upload images for jaeger-es-index-cleaner and jaeger-es-rollover
bash scripts/build-upload-a-docker-image.sh -b -c jaeger-es-index-cleaner -d cmd/es-index-cleaner -p "${platforms}" -t release
bash scripts/build-upload-a-docker-image.sh -b -c jaeger-es-rollover -d cmd/es-rollover -p "${platforms}" -t release
+bash scripts/build-upload-a-docker-image.sh -c jaeger-cassandra-schema -d plugin/storage/cassandra/
# build/upload images for jaeger-tracegen and jaeger-anonymizer
for component in tracegen anonymizer
do
bash scripts/build-upload-a-docker-image.sh -c "jaeger-${component}" -d "cmd/${component}" -p "${platforms}"
-done
-
-
-# build amd64 docker images
-
-# build/upload images for debug version of Jaeger backend components
-for component in agent collector query ingester
-do
- bash scripts/build-upload-a-docker-image.sh -b -c "jaeger-${component}-debug" -d "cmd/${component}" -t debug
done
-
-# build/upload images for jaeger-cassandra-schema
-bash scripts/build-upload-a-docker-image.sh -c jaeger-cassandra-schema -d plugin/storage/cassandra/
diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh
index 5857fd035a2..4d0caac4f7f 100755
--- a/scripts/es-integration-test.sh
+++ b/scripts/es-integration-test.sh
@@ -71,7 +71,7 @@ wait_for_it() {
local counter=0
local max_counter=60
while [[ "$(curl ${params[@]} ${url})" != "200" && ${counter} -le ${max_counter} ]]; do
- sleep 2
+ sleep 5
counter=$((counter+1))
echo "waiting for ${url} to be up..."
if [ ${counter} -eq ${max_counter} ]; then
diff --git a/scripts/package-deploy.sh b/scripts/package-deploy.sh
index 122122067df..599bcd75e46 100755
--- a/scripts/package-deploy.sh
+++ b/scripts/package-deploy.sh
@@ -1,66 +1,76 @@
#!/bin/bash
-
-# stage-file copies the file $1 with the specified path $2
-# if no file exists it will silently continue
-function stage-file {
- if [ -f $1 ]; then
- echo "Copying $1 to $2"
- cp $1 $2
- else
- echo "$1 does not exist. Aborting."
- exit 1
- fi
-}
+set -euxf -o pipefail
# stage-platform-files stages the different the platform ($1) into the package
# staging dir ($2). If you pass in a file extension ($3) it will be used when
# copying on the source
function stage-platform-files {
- local PLATFORM=$1
- local PACKAGE_STAGING_DIR=$2
- local FILE_EXTENSION=$3
+ local -r PLATFORM=$1
+ local -r PACKAGE_STAGING_DIR=$2
+ local -r FILE_EXTENSION=${3:-}
- stage-file ./cmd/all-in-one/all-in-one-$PLATFORM $PACKAGE_STAGING_DIR/jaeger-all-in-one$FILE_EXTENSION
- stage-file ./cmd/agent/agent-$PLATFORM $PACKAGE_STAGING_DIR/jaeger-agent$FILE_EXTENSION
- stage-file ./cmd/query/query-$PLATFORM $PACKAGE_STAGING_DIR/jaeger-query$FILE_EXTENSION
- stage-file ./cmd/collector/collector-$PLATFORM $PACKAGE_STAGING_DIR/jaeger-collector$FILE_EXTENSION
- stage-file ./cmd/ingester/ingester-$PLATFORM $PACKAGE_STAGING_DIR/jaeger-ingester$FILE_EXTENSION
- stage-file ./examples/hotrod/hotrod-$PLATFORM $PACKAGE_STAGING_DIR/example-hotrod$FILE_EXTENSION
+ cp ./cmd/all-in-one/all-in-one-$PLATFORM $PACKAGE_STAGING_DIR/jaeger-all-in-one$FILE_EXTENSION
+ cp ./cmd/agent/agent-$PLATFORM $PACKAGE_STAGING_DIR/jaeger-agent$FILE_EXTENSION
+ cp ./cmd/query/query-$PLATFORM $PACKAGE_STAGING_DIR/jaeger-query$FILE_EXTENSION
+ cp ./cmd/collector/collector-$PLATFORM $PACKAGE_STAGING_DIR/jaeger-collector$FILE_EXTENSION
+ cp ./cmd/ingester/ingester-$PLATFORM $PACKAGE_STAGING_DIR/jaeger-ingester$FILE_EXTENSION
+ cp ./examples/hotrod/hotrod-$PLATFORM $PACKAGE_STAGING_DIR/example-hotrod$FILE_EXTENSION
}
-# package pulls built files for the platform ($1). If you pass in a file
-# extension ($2) it will be used on the binaries
+# package pulls built files for the platform ($2) and compresses it using the compression ($1).
+# If you pass in a file extension ($3) it will be look for binaries with that extension.
function package {
- local PLATFORM=$1
- local FILE_EXTENSION=$2
- # script start
- local PACKAGE_STAGING_DIR=jaeger-$VERSION-$PLATFORM
+ local -r COMPRESSION=$1
+ local -r PLATFORM=$2
+ local -r FILE_EXTENSION=${3:-}
+ local -r PACKAGE_NAME=jaeger-$VERSION-$PLATFORM
+ local -r PACKAGE_STAGING_DIR=$PACKAGE_NAME
+ if [ -d $PACKAGE_STAGING_DIR ]
+ then
+ rm -vrf "$PACKAGE_STAGING_DIR"
+ fi
mkdir $PACKAGE_STAGING_DIR
-
stage-platform-files $PLATFORM $PACKAGE_STAGING_DIR $FILE_EXTENSION
+ # Create a checksum file for all the files being packaged in the archive. Sorted by filename.
+ find $PACKAGE_STAGING_DIR -type f -exec shasum -b -a 256 {} \; | sort -k2 | tee ./deploy/$PACKAGE_NAME.sha256sum.txt
+
+ if [ "$COMPRESSION" == "zip" ]
+ then
+ local -r ARCHIVE_NAME="$PACKAGE_NAME.zip"
+ echo "Packaging into $ARCHIVE_NAME:"
+ zip -r ./deploy/$ARCHIVE_NAME $PACKAGE_STAGING_DIR
+ else
+ local -r ARCHIVE_NAME="$PACKAGE_NAME.tar.gz"
+ echo "Packaging into $ARCHIVE_NAME:"
+ tar --sort=name -czvf ./deploy/$ARCHIVE_NAME $PACKAGE_STAGING_DIR
+ fi
- local ARCHIVE_NAME="$PACKAGE_STAGING_DIR.tar.gz"
- echo "Packaging into $ARCHIVE_NAME:"
- tar -czvf ./deploy/$ARCHIVE_NAME $PACKAGE_STAGING_DIR
rm -rf $PACKAGE_STAGING_DIR
}
set -e
-DEPLOY_STAGING_DIR=./deploy-staging
-VERSION="$(make echo-version | awk 'match($0, /([0-9]*\.[0-9]*\.[0-9]*)$/) { print substr($0, RSTART, RLENGTH) }')"
+readonly VERSION="$(make echo-version | awk 'match($0, /([0-9]*\.[0-9]*\.[0-9]*)$/) { print substr($0, RSTART, RLENGTH) }')"
echo "Working on version: $VERSION"
+if [ -z "$VERSION" ]
+then
+ # We want to halt if for some reason the version string is empty as this is an obvious error case
+ >&2 echo 'Failed to detect a version string'
+ exit 1
+fi
# make needed directories
-rm -rf deploy $DEPLOY_STAGING_DIR
+rm -rf deploy
mkdir deploy
-mkdir $DEPLOY_STAGING_DIR
-package linux-amd64
-package darwin-amd64
-package darwin-arm64
-package windows-amd64 .exe
-package linux-s390x
-package linux-arm64
-package linux-ppc64le
+package tar linux-amd64
+package tar darwin-amd64
+package tar darwin-arm64
+package tar windows-amd64 .exe
+package zip windows-amd64 .exe
+package tar linux-s390x
+package tar linux-arm64
+package tar linux-ppc64le
+# Create a checksum file for all non-checksum files in the deploy directory. Strips the leading 'deploy/' directory from filepaths. Sort by filename.
+find deploy \( ! -name '*sha256sum.txt' \) -type f -exec shasum -b -a 256 {} \; | sed -r 's#(\w+\s+\*?)deploy/(.*)#\1\2#' | sort -k2 | tee ./deploy/jaeger-$VERSION.sha256sum.txt
diff --git a/storage/doc.go b/storage/doc.go
index 241fbcfc482..4b3b595ca6a 100644
--- a/storage/doc.go
+++ b/storage/doc.go
@@ -16,6 +16,4 @@
// Package storage is the collection of different storage interfaces that are shared by two or more components.
//
// If a storage is used by only one component, its interface should be defined in the component package, and implementations under ./plugin/storage/{db_name}/{store_type}/....
-//
-//
package storage
diff --git a/storage/factory.go b/storage/factory.go
index 50c99dc390e..f6d3394840b 100644
--- a/storage/factory.go
+++ b/storage/factory.go
@@ -31,7 +31,7 @@ import (
// Factory defines an interface for a factory that can create implementations of different storage components.
// Implementations are also encouraged to implement plugin.Configurable interface.
//
-// See also
+// # See also
//
// plugin.Configurable
type Factory interface {
@@ -78,7 +78,7 @@ type ArchiveFactory interface {
// MetricsFactory defines an interface for a factory that can create implementations of different metrics storage components.
// Implementations are also encouraged to implement plugin.Configurable interface.
//
-// See also
+// # See also
//
// plugin.Configurable
type MetricsFactory interface {
diff --git a/swagger-gen/models/annotation.go b/swagger-gen/models/annotation.go
index a1d1ac0f44f..53fb4fe26d3 100644
--- a/swagger-gen/models/annotation.go
+++ b/swagger-gen/models/annotation.go
@@ -20,7 +20,6 @@ import (
// Zipkin v1 core annotations such as "cs" and "sr" have been replaced with
// Span.Kind, which interprets timestamp and duration.
//
-//
// swagger:model Annotation
type Annotation struct {
diff --git a/swagger-gen/models/endpoint.go b/swagger-gen/models/endpoint.go
index 06ae40ae303..0d18cbff40d 100644
--- a/swagger-gen/models/endpoint.go
+++ b/swagger-gen/models/endpoint.go
@@ -16,7 +16,7 @@ import (
// Endpoint Endpoint
//
-// The network context of a node in the service graph
+// # The network context of a node in the service graph
//
// swagger:model Endpoint
type Endpoint struct {
diff --git a/swagger-gen/models/list_of_spans.go b/swagger-gen/models/list_of_spans.go
index 1d407d4bf0c..d3ff6e29c0d 100644
--- a/swagger-gen/models/list_of_spans.go
+++ b/swagger-gen/models/list_of_spans.go
@@ -16,7 +16,7 @@ import (
// ListOfSpans ListOfSpans
//
-// A list of spans with possibly different trace ids, in no particular order
+// # A list of spans with possibly different trace ids, in no particular order
//
// swagger:model ListOfSpans
type ListOfSpans []*Span
diff --git a/swagger-gen/models/tags.go b/swagger-gen/models/tags.go
index 2b4f300b2a2..89fd94db026 100644
--- a/swagger-gen/models/tags.go
+++ b/swagger-gen/models/tags.go
@@ -19,7 +19,6 @@ import (
// A tag "sql.query" isn't searchable, but it can help in debugging when viewing
// a trace.
//
-//
// swagger:model Tags
type Tags map[string]string
diff --git a/swagger-gen/restapi/doc.go b/swagger-gen/restapi/doc.go
index 1a88cb632dd..ce19adf0144 100644
--- a/swagger-gen/restapi/doc.go
+++ b/swagger-gen/restapi/doc.go
@@ -2,20 +2,20 @@
// Package restapi Zipkin API
//
-// Zipkin's v2 api currently includes a POST endpoint that can receive spans.
+// Zipkin's v2 api currently includes a POST endpoint that can receive spans.
//
-// Schemes:
-// http
-// https
-// Host: localhost:9411
-// BasePath: /api/v2
-// Version: 1.0.0
+// Schemes:
+// http
+// https
+// Host: localhost:9411
+// BasePath: /api/v2
+// Version: 1.0.0
//
-// Consumes:
-// - application/json
+// Consumes:
+// - application/json
//
-// Produces:
-// - application/json
+// Produces:
+// - application/json
//
// swagger:meta
package restapi
diff --git a/swagger-gen/restapi/operations/post_spans.go b/swagger-gen/restapi/operations/post_spans.go
index 2ac22f4cb2f..e6d1fc02913 100644
--- a/swagger-gen/restapi/operations/post_spans.go
+++ b/swagger-gen/restapi/operations/post_spans.go
@@ -29,11 +29,10 @@ func NewPostSpans(ctx *middleware.Context, handler PostSpansHandler) *PostSpans
return &PostSpans{Context: ctx, Handler: handler}
}
-/* PostSpans swagger:route POST /spans postSpans
+/*
+ PostSpans swagger:route POST /spans postSpans
Uploads a list of spans encoded per content-type, for example json.
-
-
*/
type PostSpans struct {
Context *middleware.Context
diff --git a/swagger-gen/restapi/operations/post_spans_responses.go b/swagger-gen/restapi/operations/post_spans_responses.go
index 71aa8ff4178..c3aaba70943 100644
--- a/swagger-gen/restapi/operations/post_spans_responses.go
+++ b/swagger-gen/restapi/operations/post_spans_responses.go
@@ -14,7 +14,8 @@ import (
// PostSpansAcceptedCode is the HTTP code returned for type PostSpansAccepted
const PostSpansAcceptedCode int = 202
-/*PostSpansAccepted Accepted
+/*
+PostSpansAccepted Accepted
swagger:response postSpansAccepted
*/
diff --git a/thrift-gen/agent/GoUnusedProtection__.go b/thrift-gen/agent/GoUnusedProtection__.go
index 54cd3b0867a..18f429790b1 100644
--- a/thrift-gen/agent/GoUnusedProtection__.go
+++ b/thrift-gen/agent/GoUnusedProtection__.go
@@ -2,5 +2,4 @@
package agent
-var GoUnusedProtection__ int;
-
+var GoUnusedProtection__ int
diff --git a/thrift-gen/agent/agent-consts.go b/thrift-gen/agent/agent-consts.go
index af972ea8b60..d413d24e526 100644
--- a/thrift-gen/agent/agent-consts.go
+++ b/thrift-gen/agent/agent-consts.go
@@ -2,15 +2,14 @@
package agent
-import(
+import (
"bytes"
"context"
"fmt"
- "time"
"github.com/apache/thrift/lib/go/thrift"
"github.com/jaegertracing/jaeger/thrift-gen/jaeger"
"github.com/jaegertracing/jaeger/thrift-gen/zipkincore"
-
+ "time"
)
// (needed to ensure safety because of naive import list construction.)
@@ -25,4 +24,3 @@ var _ = zipkincore.GoUnusedProtection__
func init() {
}
-
diff --git a/thrift-gen/agent/agent.go b/thrift-gen/agent/agent.go
index cc68b54f92d..d092f157abb 100644
--- a/thrift-gen/agent/agent.go
+++ b/thrift-gen/agent/agent.go
@@ -2,15 +2,14 @@
package agent
-import(
+import (
"bytes"
"context"
"fmt"
- "time"
"github.com/apache/thrift/lib/go/thrift"
"github.com/jaegertracing/jaeger/thrift-gen/jaeger"
"github.com/jaegertracing/jaeger/thrift-gen/zipkincore"
-
+ "time"
)
// (needed to ensure safety because of naive import list construction.)
@@ -22,375 +21,391 @@ var _ = bytes.Equal
var _ = jaeger.GoUnusedProtection__
var _ = zipkincore.GoUnusedProtection__
+
type Agent interface {
- // Parameters:
- // - Spans
- EmitZipkinBatch(ctx context.Context, spans []*zipkincore.Span) (_err error)
- // Parameters:
- // - Batch
- EmitBatch(ctx context.Context, batch *jaeger.Batch) (_err error)
+ // Parameters:
+ // - Spans
+ EmitZipkinBatch(ctx context.Context, spans []*zipkincore.Span) (_err error)
+ // Parameters:
+ // - Batch
+ EmitBatch(ctx context.Context, batch *jaeger.Batch) (_err error)
}
type AgentClient struct {
- c thrift.TClient
- meta thrift.ResponseMeta
+ c thrift.TClient
+ meta thrift.ResponseMeta
}
func NewAgentClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *AgentClient {
- return &AgentClient{
- c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
- }
+ return &AgentClient{
+ c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
+ }
}
func NewAgentClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *AgentClient {
- return &AgentClient{
- c: thrift.NewTStandardClient(iprot, oprot),
- }
+ return &AgentClient{
+ c: thrift.NewTStandardClient(iprot, oprot),
+ }
}
func NewAgentClient(c thrift.TClient) *AgentClient {
- return &AgentClient{
- c: c,
- }
+ return &AgentClient{
+ c: c,
+ }
}
func (p *AgentClient) Client_() thrift.TClient {
- return p.c
+ return p.c
}
func (p *AgentClient) LastResponseMeta_() thrift.ResponseMeta {
- return p.meta
+ return p.meta
}
func (p *AgentClient) SetLastResponseMeta_(meta thrift.ResponseMeta) {
- p.meta = meta
+ p.meta = meta
}
// Parameters:
-// - Spans
+// - Spans
func (p *AgentClient) EmitZipkinBatch(ctx context.Context, spans []*zipkincore.Span) (_err error) {
- var _args0 AgentEmitZipkinBatchArgs
- _args0.Spans = spans
- p.SetLastResponseMeta_(thrift.ResponseMeta{})
- if _, err := p.Client_().Call(ctx, "emitZipkinBatch", &_args0, nil); err != nil {
- return err
- }
- return nil
+ var _args0 AgentEmitZipkinBatchArgs
+ _args0.Spans = spans
+ p.SetLastResponseMeta_(thrift.ResponseMeta{})
+ if _, err := p.Client_().Call(ctx, "emitZipkinBatch", &_args0, nil); err != nil {
+ return err
+ }
+ return nil
}
// Parameters:
-// - Batch
+// - Batch
func (p *AgentClient) EmitBatch(ctx context.Context, batch *jaeger.Batch) (_err error) {
- var _args1 AgentEmitBatchArgs
- _args1.Batch = batch
- p.SetLastResponseMeta_(thrift.ResponseMeta{})
- if _, err := p.Client_().Call(ctx, "emitBatch", &_args1, nil); err != nil {
- return err
- }
- return nil
+ var _args1 AgentEmitBatchArgs
+ _args1.Batch = batch
+ p.SetLastResponseMeta_(thrift.ResponseMeta{})
+ if _, err := p.Client_().Call(ctx, "emitBatch", &_args1, nil); err != nil {
+ return err
+ }
+ return nil
}
type AgentProcessor struct {
- processorMap map[string]thrift.TProcessorFunction
- handler Agent
+ processorMap map[string]thrift.TProcessorFunction
+ handler Agent
}
func (p *AgentProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
- p.processorMap[key] = processor
+ p.processorMap[key] = processor
}
func (p *AgentProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
- processor, ok = p.processorMap[key]
- return processor, ok
+ processor, ok = p.processorMap[key]
+ return processor, ok
}
func (p *AgentProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
- return p.processorMap
+ return p.processorMap
}
func NewAgentProcessor(handler Agent) *AgentProcessor {
- self2 := &AgentProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)}
- self2.processorMap["emitZipkinBatch"] = &agentProcessorEmitZipkinBatch{handler:handler}
- self2.processorMap["emitBatch"] = &agentProcessorEmitBatch{handler:handler}
-return self2
+ self2 := &AgentProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
+ self2.processorMap["emitZipkinBatch"] = &agentProcessorEmitZipkinBatch{handler: handler}
+ self2.processorMap["emitBatch"] = &agentProcessorEmitBatch{handler: handler}
+ return self2
}
func (p *AgentProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
- name, _, seqId, err2 := iprot.ReadMessageBegin(ctx)
- if err2 != nil { return false, thrift.WrapTException(err2) }
- if processor, ok := p.GetProcessorFunction(name); ok {
- return processor.Process(ctx, seqId, iprot, oprot)
- }
- iprot.Skip(ctx, thrift.STRUCT)
- iprot.ReadMessageEnd(ctx)
- x3 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name)
- oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId)
- x3.Write(ctx, oprot)
- oprot.WriteMessageEnd(ctx)
- oprot.Flush(ctx)
- return false, x3
+ name, _, seqId, err2 := iprot.ReadMessageBegin(ctx)
+ if err2 != nil {
+ return false, thrift.WrapTException(err2)
+ }
+ if processor, ok := p.GetProcessorFunction(name); ok {
+ return processor.Process(ctx, seqId, iprot, oprot)
+ }
+ iprot.Skip(ctx, thrift.STRUCT)
+ iprot.ReadMessageEnd(ctx)
+ x3 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
+ oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId)
+ x3.Write(ctx, oprot)
+ oprot.WriteMessageEnd(ctx)
+ oprot.Flush(ctx)
+ return false, x3
}
type agentProcessorEmitZipkinBatch struct {
- handler Agent
+ handler Agent
}
func (p *agentProcessorEmitZipkinBatch) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
- args := AgentEmitZipkinBatchArgs{}
- var err2 error
- if err2 = args.Read(ctx, iprot); err2 != nil {
- iprot.ReadMessageEnd(ctx)
- return false, thrift.WrapTException(err2)
- }
- iprot.ReadMessageEnd(ctx)
+ args := AgentEmitZipkinBatchArgs{}
+ var err2 error
+ if err2 = args.Read(ctx, iprot); err2 != nil {
+ iprot.ReadMessageEnd(ctx)
+ return false, thrift.WrapTException(err2)
+ }
+ iprot.ReadMessageEnd(ctx)
- tickerCancel := func() {}
- _ = tickerCancel
+ tickerCancel := func() {}
+ _ = tickerCancel
- if err2 = p.handler.EmitZipkinBatch(ctx, args.Spans); err2 != nil {
- tickerCancel()
- return true, thrift.WrapTException(err2)
- }
- tickerCancel()
- return true, nil
+ if err2 = p.handler.EmitZipkinBatch(ctx, args.Spans); err2 != nil {
+ tickerCancel()
+ return true, thrift.WrapTException(err2)
+ }
+ tickerCancel()
+ return true, nil
}
type agentProcessorEmitBatch struct {
- handler Agent
+ handler Agent
}
func (p *agentProcessorEmitBatch) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
- args := AgentEmitBatchArgs{}
- var err2 error
- if err2 = args.Read(ctx, iprot); err2 != nil {
- iprot.ReadMessageEnd(ctx)
- return false, thrift.WrapTException(err2)
- }
- iprot.ReadMessageEnd(ctx)
+ args := AgentEmitBatchArgs{}
+ var err2 error
+ if err2 = args.Read(ctx, iprot); err2 != nil {
+ iprot.ReadMessageEnd(ctx)
+ return false, thrift.WrapTException(err2)
+ }
+ iprot.ReadMessageEnd(ctx)
- tickerCancel := func() {}
- _ = tickerCancel
+ tickerCancel := func() {}
+ _ = tickerCancel
- if err2 = p.handler.EmitBatch(ctx, args.Batch); err2 != nil {
- tickerCancel()
- return true, thrift.WrapTException(err2)
- }
- tickerCancel()
- return true, nil
+ if err2 = p.handler.EmitBatch(ctx, args.Batch); err2 != nil {
+ tickerCancel()
+ return true, thrift.WrapTException(err2)
+ }
+ tickerCancel()
+ return true, nil
}
-
// HELPER FUNCTIONS AND STRUCTURES
// Attributes:
-// - Spans
+// - Spans
type AgentEmitZipkinBatchArgs struct {
- Spans []*zipkincore.Span `thrift:"spans,1" db:"spans" json:"spans"`
+ Spans []*zipkincore.Span `thrift:"spans,1" db:"spans" json:"spans"`
}
func NewAgentEmitZipkinBatchArgs() *AgentEmitZipkinBatchArgs {
- return &AgentEmitZipkinBatchArgs{}
+ return &AgentEmitZipkinBatchArgs{}
}
-
func (p *AgentEmitZipkinBatchArgs) GetSpans() []*zipkincore.Span {
- return p.Spans
+ return p.Spans
}
func (p *AgentEmitZipkinBatchArgs) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- return nil
-}
-
-func (p *AgentEmitZipkinBatchArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- _, size, err := iprot.ReadListBegin(ctx)
- if err != nil {
- return thrift.PrependError("error reading list begin: ", err)
- }
- tSlice := make([]*zipkincore.Span, 0, size)
- p.Spans = tSlice
- for i := 0; i < size; i ++ {
- _elem4 := &zipkincore.Span{}
- if err := _elem4.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err)
- }
- p.Spans = append(p.Spans, _elem4)
- }
- if err := iprot.ReadListEnd(ctx); err != nil {
- return thrift.PrependError("error reading list end: ", err)
- }
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ return nil
+}
+
+func (p *AgentEmitZipkinBatchArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ _, size, err := iprot.ReadListBegin(ctx)
+ if err != nil {
+ return thrift.PrependError("error reading list begin: ", err)
+ }
+ tSlice := make([]*zipkincore.Span, 0, size)
+ p.Spans = tSlice
+ for i := 0; i < size; i++ {
+ _elem4 := &zipkincore.Span{}
+ if err := _elem4.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err)
+ }
+ p.Spans = append(p.Spans, _elem4)
+ }
+ if err := iprot.ReadListEnd(ctx); err != nil {
+ return thrift.PrependError("error reading list end: ", err)
+ }
+ return nil
}
func (p *AgentEmitZipkinBatchArgs) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "emitZipkinBatch_args"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "emitZipkinBatch_args"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *AgentEmitZipkinBatchArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "spans", thrift.LIST, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:spans: ", p), err) }
- if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Spans)); err != nil {
- return thrift.PrependError("error writing list begin: ", err)
- }
- for _, v := range p.Spans {
- if err := v.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
- }
- }
- if err := oprot.WriteListEnd(ctx); err != nil {
- return thrift.PrependError("error writing list end: ", err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:spans: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "spans", thrift.LIST, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:spans: ", p), err)
+ }
+ if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Spans)); err != nil {
+ return thrift.PrependError("error writing list begin: ", err)
+ }
+ for _, v := range p.Spans {
+ if err := v.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
+ }
+ }
+ if err := oprot.WriteListEnd(ctx); err != nil {
+ return thrift.PrependError("error writing list end: ", err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:spans: ", p), err)
+ }
+ return err
}
func (p *AgentEmitZipkinBatchArgs) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("AgentEmitZipkinBatchArgs(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("AgentEmitZipkinBatchArgs(%+v)", *p)
}
// Attributes:
-// - Batch
+// - Batch
type AgentEmitBatchArgs struct {
- Batch *jaeger.Batch `thrift:"batch,1" db:"batch" json:"batch"`
+ Batch *jaeger.Batch `thrift:"batch,1" db:"batch" json:"batch"`
}
func NewAgentEmitBatchArgs() *AgentEmitBatchArgs {
- return &AgentEmitBatchArgs{}
+ return &AgentEmitBatchArgs{}
}
var AgentEmitBatchArgs_Batch_DEFAULT *jaeger.Batch
+
func (p *AgentEmitBatchArgs) GetBatch() *jaeger.Batch {
- if !p.IsSetBatch() {
- return AgentEmitBatchArgs_Batch_DEFAULT
- }
-return p.Batch
+ if !p.IsSetBatch() {
+ return AgentEmitBatchArgs_Batch_DEFAULT
+ }
+ return p.Batch
}
func (p *AgentEmitBatchArgs) IsSetBatch() bool {
- return p.Batch != nil
+ return p.Batch != nil
}
func (p *AgentEmitBatchArgs) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.STRUCT {
- if err := p.ReadField1(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- return nil
-}
-
-func (p *AgentEmitBatchArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- p.Batch = &jaeger.Batch{}
- if err := p.Batch.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Batch), err)
- }
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.STRUCT {
+ if err := p.ReadField1(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ return nil
+}
+
+func (p *AgentEmitBatchArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ p.Batch = &jaeger.Batch{}
+ if err := p.Batch.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Batch), err)
+ }
+ return nil
}
func (p *AgentEmitBatchArgs) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "emitBatch_args"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "emitBatch_args"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *AgentEmitBatchArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "batch", thrift.STRUCT, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:batch: ", p), err) }
- if err := p.Batch.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Batch), err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:batch: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "batch", thrift.STRUCT, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:batch: ", p), err)
+ }
+ if err := p.Batch.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Batch), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:batch: ", p), err)
+ }
+ return err
}
func (p *AgentEmitBatchArgs) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("AgentEmitBatchArgs(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("AgentEmitBatchArgs(%+v)", *p)
}
-
-
diff --git a/thrift-gen/baggage/GoUnusedProtection__.go b/thrift-gen/baggage/GoUnusedProtection__.go
index 712b6a9da4c..b8f86906504 100644
--- a/thrift-gen/baggage/GoUnusedProtection__.go
+++ b/thrift-gen/baggage/GoUnusedProtection__.go
@@ -2,5 +2,4 @@
package baggage
-var GoUnusedProtection__ int;
-
+var GoUnusedProtection__ int
diff --git a/thrift-gen/baggage/baggage-consts.go b/thrift-gen/baggage/baggage-consts.go
index 0eeb8239f97..02d3dcf82e3 100644
--- a/thrift-gen/baggage/baggage-consts.go
+++ b/thrift-gen/baggage/baggage-consts.go
@@ -2,12 +2,12 @@
package baggage
-import(
+import (
"bytes"
"context"
"fmt"
- "time"
"github.com/apache/thrift/lib/go/thrift"
+ "time"
)
// (needed to ensure safety because of naive import list construction.)
@@ -17,7 +17,5 @@ var _ = context.Background
var _ = time.Now
var _ = bytes.Equal
-
func init() {
}
-
diff --git a/thrift-gen/baggage/baggage.go b/thrift-gen/baggage/baggage.go
index 40134450580..f2bfa6df596 100644
--- a/thrift-gen/baggage/baggage.go
+++ b/thrift-gen/baggage/baggage.go
@@ -2,12 +2,12 @@
package baggage
-import(
+import (
"bytes"
"context"
"fmt"
- "time"
"github.com/apache/thrift/lib/go/thrift"
+ "time"
)
// (needed to ensure safety because of naive import list construction.)
@@ -18,548 +18,581 @@ var _ = time.Now
var _ = bytes.Equal
// Attributes:
-// - BaggageKey
-// - MaxValueLength
+// - BaggageKey
+// - MaxValueLength
type BaggageRestriction struct {
- BaggageKey string `thrift:"baggageKey,1,required" db:"baggageKey" json:"baggageKey"`
- MaxValueLength int32 `thrift:"maxValueLength,2,required" db:"maxValueLength" json:"maxValueLength"`
+ BaggageKey string `thrift:"baggageKey,1,required" db:"baggageKey" json:"baggageKey"`
+ MaxValueLength int32 `thrift:"maxValueLength,2,required" db:"maxValueLength" json:"maxValueLength"`
}
func NewBaggageRestriction() *BaggageRestriction {
- return &BaggageRestriction{}
+ return &BaggageRestriction{}
}
-
func (p *BaggageRestriction) GetBaggageKey() string {
- return p.BaggageKey
+ return p.BaggageKey
}
func (p *BaggageRestriction) GetMaxValueLength() int32 {
- return p.MaxValueLength
+ return p.MaxValueLength
}
func (p *BaggageRestriction) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
- var issetBaggageKey bool = false;
- var issetMaxValueLength bool = false;
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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(ctx, iprot); err != nil {
- return err
- }
- issetBaggageKey = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 2:
- if fieldTypeId == thrift.I32 {
- if err := p.ReadField2(ctx, iprot); err != nil {
- return err
- }
- issetMaxValueLength = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- if !issetBaggageKey{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field BaggageKey is not set"));
- }
- if !issetMaxValueLength{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field MaxValueLength is not set"));
- }
- return nil
-}
-
-func (p *BaggageRestriction) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadString(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.BaggageKey = v
-}
- return nil
-}
-
-func (p *BaggageRestriction) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI32(ctx); err != nil {
- return thrift.PrependError("error reading field 2: ", err)
-} else {
- p.MaxValueLength = v
-}
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ var issetBaggageKey bool = false
+ var issetMaxValueLength bool = false
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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(ctx, iprot); err != nil {
+ return err
+ }
+ issetBaggageKey = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 2:
+ if fieldTypeId == thrift.I32 {
+ if err := p.ReadField2(ctx, iprot); err != nil {
+ return err
+ }
+ issetMaxValueLength = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ if !issetBaggageKey {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field BaggageKey is not set"))
+ }
+ if !issetMaxValueLength {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field MaxValueLength is not set"))
+ }
+ return nil
+}
+
+func (p *BaggageRestriction) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadString(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.BaggageKey = v
+ }
+ return nil
+}
+
+func (p *BaggageRestriction) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI32(ctx); err != nil {
+ return thrift.PrependError("error reading field 2: ", err)
+ } else {
+ p.MaxValueLength = v
+ }
+ return nil
}
func (p *BaggageRestriction) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "BaggageRestriction"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- if err := p.writeField2(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "BaggageRestriction"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField2(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *BaggageRestriction) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "baggageKey", thrift.STRING, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:baggageKey: ", p), err) }
- if err := oprot.WriteString(ctx, string(p.BaggageKey)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.baggageKey (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:baggageKey: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "baggageKey", thrift.STRING, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:baggageKey: ", p), err)
+ }
+ if err := oprot.WriteString(ctx, string(p.BaggageKey)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.baggageKey (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:baggageKey: ", p), err)
+ }
+ return err
}
func (p *BaggageRestriction) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "maxValueLength", thrift.I32, 2); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:maxValueLength: ", p), err) }
- if err := oprot.WriteI32(ctx, int32(p.MaxValueLength)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.maxValueLength (2) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 2:maxValueLength: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "maxValueLength", thrift.I32, 2); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:maxValueLength: ", p), err)
+ }
+ if err := oprot.WriteI32(ctx, int32(p.MaxValueLength)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.maxValueLength (2) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 2:maxValueLength: ", p), err)
+ }
+ return err
}
func (p *BaggageRestriction) Equals(other *BaggageRestriction) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.BaggageKey != other.BaggageKey { return false }
- if p.MaxValueLength != other.MaxValueLength { return false }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.BaggageKey != other.BaggageKey {
+ return false
+ }
+ if p.MaxValueLength != other.MaxValueLength {
+ return false
+ }
+ return true
}
func (p *BaggageRestriction) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("BaggageRestriction(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("BaggageRestriction(%+v)", *p)
}
type BaggageRestrictionManager interface {
- // getBaggageRestrictions retrieves the baggage restrictions for a specific service.
- // Usually, baggageRestrictions apply to all services however there may be situations
- // where a baggageKey might only be allowed to be set by a specific service.
- //
- // Parameters:
- // - ServiceName
- GetBaggageRestrictions(ctx context.Context, serviceName string) (_r []*BaggageRestriction, _err error)
+ // getBaggageRestrictions retrieves the baggage restrictions for a specific service.
+ // Usually, baggageRestrictions apply to all services however there may be situations
+ // where a baggageKey might only be allowed to be set by a specific service.
+ //
+ // Parameters:
+ // - ServiceName
+ GetBaggageRestrictions(ctx context.Context, serviceName string) (_r []*BaggageRestriction, _err error)
}
type BaggageRestrictionManagerClient struct {
- c thrift.TClient
- meta thrift.ResponseMeta
+ c thrift.TClient
+ meta thrift.ResponseMeta
}
func NewBaggageRestrictionManagerClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *BaggageRestrictionManagerClient {
- return &BaggageRestrictionManagerClient{
- c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
- }
+ return &BaggageRestrictionManagerClient{
+ c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
+ }
}
func NewBaggageRestrictionManagerClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *BaggageRestrictionManagerClient {
- return &BaggageRestrictionManagerClient{
- c: thrift.NewTStandardClient(iprot, oprot),
- }
+ return &BaggageRestrictionManagerClient{
+ c: thrift.NewTStandardClient(iprot, oprot),
+ }
}
func NewBaggageRestrictionManagerClient(c thrift.TClient) *BaggageRestrictionManagerClient {
- return &BaggageRestrictionManagerClient{
- c: c,
- }
+ return &BaggageRestrictionManagerClient{
+ c: c,
+ }
}
func (p *BaggageRestrictionManagerClient) Client_() thrift.TClient {
- return p.c
+ return p.c
}
func (p *BaggageRestrictionManagerClient) LastResponseMeta_() thrift.ResponseMeta {
- return p.meta
+ return p.meta
}
func (p *BaggageRestrictionManagerClient) SetLastResponseMeta_(meta thrift.ResponseMeta) {
- p.meta = meta
+ p.meta = meta
}
// getBaggageRestrictions retrieves the baggage restrictions for a specific service.
// Usually, baggageRestrictions apply to all services however there may be situations
// where a baggageKey might only be allowed to be set by a specific service.
-//
+//
// Parameters:
-// - ServiceName
+// - ServiceName
func (p *BaggageRestrictionManagerClient) GetBaggageRestrictions(ctx context.Context, serviceName string) (_r []*BaggageRestriction, _err error) {
- var _args0 BaggageRestrictionManagerGetBaggageRestrictionsArgs
- _args0.ServiceName = serviceName
- var _result2 BaggageRestrictionManagerGetBaggageRestrictionsResult
- var _meta1 thrift.ResponseMeta
- _meta1, _err = p.Client_().Call(ctx, "getBaggageRestrictions", &_args0, &_result2)
- p.SetLastResponseMeta_(_meta1)
- if _err != nil {
- return
- }
- return _result2.GetSuccess(), nil
+ var _args0 BaggageRestrictionManagerGetBaggageRestrictionsArgs
+ _args0.ServiceName = serviceName
+ var _result2 BaggageRestrictionManagerGetBaggageRestrictionsResult
+ var _meta1 thrift.ResponseMeta
+ _meta1, _err = p.Client_().Call(ctx, "getBaggageRestrictions", &_args0, &_result2)
+ p.SetLastResponseMeta_(_meta1)
+ if _err != nil {
+ return
+ }
+ return _result2.GetSuccess(), nil
}
type BaggageRestrictionManagerProcessor struct {
- processorMap map[string]thrift.TProcessorFunction
- handler BaggageRestrictionManager
+ processorMap map[string]thrift.TProcessorFunction
+ handler BaggageRestrictionManager
}
func (p *BaggageRestrictionManagerProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
- p.processorMap[key] = processor
+ p.processorMap[key] = processor
}
func (p *BaggageRestrictionManagerProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
- processor, ok = p.processorMap[key]
- return processor, ok
+ processor, ok = p.processorMap[key]
+ return processor, ok
}
func (p *BaggageRestrictionManagerProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
- return p.processorMap
+ return p.processorMap
}
func NewBaggageRestrictionManagerProcessor(handler BaggageRestrictionManager) *BaggageRestrictionManagerProcessor {
- self3 := &BaggageRestrictionManagerProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)}
- self3.processorMap["getBaggageRestrictions"] = &baggageRestrictionManagerProcessorGetBaggageRestrictions{handler:handler}
-return self3
+ self3 := &BaggageRestrictionManagerProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
+ self3.processorMap["getBaggageRestrictions"] = &baggageRestrictionManagerProcessorGetBaggageRestrictions{handler: handler}
+ return self3
}
func (p *BaggageRestrictionManagerProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
- name, _, seqId, err2 := iprot.ReadMessageBegin(ctx)
- if err2 != nil { return false, thrift.WrapTException(err2) }
- if processor, ok := p.GetProcessorFunction(name); ok {
- return processor.Process(ctx, seqId, iprot, oprot)
- }
- iprot.Skip(ctx, thrift.STRUCT)
- iprot.ReadMessageEnd(ctx)
- x4 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name)
- oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId)
- x4.Write(ctx, oprot)
- oprot.WriteMessageEnd(ctx)
- oprot.Flush(ctx)
- return false, x4
+ name, _, seqId, err2 := iprot.ReadMessageBegin(ctx)
+ if err2 != nil {
+ return false, thrift.WrapTException(err2)
+ }
+ if processor, ok := p.GetProcessorFunction(name); ok {
+ return processor.Process(ctx, seqId, iprot, oprot)
+ }
+ iprot.Skip(ctx, thrift.STRUCT)
+ iprot.ReadMessageEnd(ctx)
+ x4 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
+ oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId)
+ x4.Write(ctx, oprot)
+ oprot.WriteMessageEnd(ctx)
+ oprot.Flush(ctx)
+ return false, x4
}
type baggageRestrictionManagerProcessorGetBaggageRestrictions struct {
- handler BaggageRestrictionManager
+ handler BaggageRestrictionManager
}
func (p *baggageRestrictionManagerProcessorGetBaggageRestrictions) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
- args := BaggageRestrictionManagerGetBaggageRestrictionsArgs{}
- var err2 error
- if err2 = args.Read(ctx, iprot); err2 != nil {
- iprot.ReadMessageEnd(ctx)
- x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
- oprot.WriteMessageBegin(ctx, "getBaggageRestrictions", thrift.EXCEPTION, seqId)
- x.Write(ctx, oprot)
- oprot.WriteMessageEnd(ctx)
- oprot.Flush(ctx)
- return false, thrift.WrapTException(err2)
- }
- iprot.ReadMessageEnd(ctx)
-
- tickerCancel := func() {}
- // Start a goroutine to do server side connectivity check.
- if thrift.ServerConnectivityCheckInterval > 0 {
- var cancel context.CancelFunc
- ctx, cancel = context.WithCancel(ctx)
- defer cancel()
- var tickerCtx context.Context
- tickerCtx, tickerCancel = context.WithCancel(context.Background())
- defer tickerCancel()
- go func(ctx context.Context, cancel context.CancelFunc) {
- ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
- defer ticker.Stop()
- for {
- select {
- case <-ctx.Done():
- return
- case <-ticker.C:
- if !iprot.Transport().IsOpen() {
- cancel()
- return
- }
- }
- }
- }(tickerCtx, cancel)
- }
-
- result := BaggageRestrictionManagerGetBaggageRestrictionsResult{}
- var retval []*BaggageRestriction
- if retval, err2 = p.handler.GetBaggageRestrictions(ctx, args.ServiceName); err2 != nil {
- tickerCancel()
- if err2 == thrift.ErrAbandonRequest {
- return false, thrift.WrapTException(err2)
- }
- x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getBaggageRestrictions: " + err2.Error())
- oprot.WriteMessageBegin(ctx, "getBaggageRestrictions", thrift.EXCEPTION, seqId)
- x.Write(ctx, oprot)
- oprot.WriteMessageEnd(ctx)
- oprot.Flush(ctx)
- return true, thrift.WrapTException(err2)
- } else {
- result.Success = retval
- }
- tickerCancel()
- if err2 = oprot.WriteMessageBegin(ctx, "getBaggageRestrictions", thrift.REPLY, seqId); err2 != nil {
- err = thrift.WrapTException(err2)
- }
- if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
- err = thrift.WrapTException(err2)
- }
- if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
- err = thrift.WrapTException(err2)
- }
- if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
- err = thrift.WrapTException(err2)
- }
- if err != nil {
- return
- }
- return true, err
+ args := BaggageRestrictionManagerGetBaggageRestrictionsArgs{}
+ var err2 error
+ if err2 = args.Read(ctx, iprot); err2 != nil {
+ iprot.ReadMessageEnd(ctx)
+ x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
+ oprot.WriteMessageBegin(ctx, "getBaggageRestrictions", thrift.EXCEPTION, seqId)
+ x.Write(ctx, oprot)
+ oprot.WriteMessageEnd(ctx)
+ oprot.Flush(ctx)
+ return false, thrift.WrapTException(err2)
+ }
+ iprot.ReadMessageEnd(ctx)
+
+ tickerCancel := func() {}
+ // Start a goroutine to do server side connectivity check.
+ if thrift.ServerConnectivityCheckInterval > 0 {
+ var cancel context.CancelFunc
+ ctx, cancel = context.WithCancel(ctx)
+ defer cancel()
+ var tickerCtx context.Context
+ tickerCtx, tickerCancel = context.WithCancel(context.Background())
+ defer tickerCancel()
+ go func(ctx context.Context, cancel context.CancelFunc) {
+ ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
+ defer ticker.Stop()
+ for {
+ select {
+ case <-ctx.Done():
+ return
+ case <-ticker.C:
+ if !iprot.Transport().IsOpen() {
+ cancel()
+ return
+ }
+ }
+ }
+ }(tickerCtx, cancel)
+ }
+
+ result := BaggageRestrictionManagerGetBaggageRestrictionsResult{}
+ var retval []*BaggageRestriction
+ if retval, err2 = p.handler.GetBaggageRestrictions(ctx, args.ServiceName); err2 != nil {
+ tickerCancel()
+ if err2 == thrift.ErrAbandonRequest {
+ return false, thrift.WrapTException(err2)
+ }
+ x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getBaggageRestrictions: "+err2.Error())
+ oprot.WriteMessageBegin(ctx, "getBaggageRestrictions", thrift.EXCEPTION, seqId)
+ x.Write(ctx, oprot)
+ oprot.WriteMessageEnd(ctx)
+ oprot.Flush(ctx)
+ return true, thrift.WrapTException(err2)
+ } else {
+ result.Success = retval
+ }
+ tickerCancel()
+ if err2 = oprot.WriteMessageBegin(ctx, "getBaggageRestrictions", thrift.REPLY, seqId); err2 != nil {
+ err = thrift.WrapTException(err2)
+ }
+ if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
+ err = thrift.WrapTException(err2)
+ }
+ if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
+ err = thrift.WrapTException(err2)
+ }
+ if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
+ err = thrift.WrapTException(err2)
+ }
+ if err != nil {
+ return
+ }
+ return true, err
}
-
// HELPER FUNCTIONS AND STRUCTURES
// Attributes:
-// - ServiceName
+// - ServiceName
type BaggageRestrictionManagerGetBaggageRestrictionsArgs struct {
- ServiceName string `thrift:"serviceName,1" db:"serviceName" json:"serviceName"`
+ ServiceName string `thrift:"serviceName,1" db:"serviceName" json:"serviceName"`
}
func NewBaggageRestrictionManagerGetBaggageRestrictionsArgs() *BaggageRestrictionManagerGetBaggageRestrictionsArgs {
- return &BaggageRestrictionManagerGetBaggageRestrictionsArgs{}
+ return &BaggageRestrictionManagerGetBaggageRestrictionsArgs{}
}
-
func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) GetServiceName() string {
- return p.ServiceName
+ return p.ServiceName
}
func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- return nil
-}
-
-func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadString(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.ServiceName = v
-}
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ return nil
+}
+
+func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadString(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.ServiceName = v
+ }
+ return nil
}
func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "getBaggageRestrictions_args"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "getBaggageRestrictions_args"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "serviceName", thrift.STRING, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:serviceName: ", p), err) }
- if err := oprot.WriteString(ctx, string(p.ServiceName)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.serviceName (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:serviceName: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "serviceName", thrift.STRING, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:serviceName: ", p), err)
+ }
+ if err := oprot.WriteString(ctx, string(p.ServiceName)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.serviceName (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:serviceName: ", p), err)
+ }
+ return err
}
func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("BaggageRestrictionManagerGetBaggageRestrictionsArgs(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("BaggageRestrictionManagerGetBaggageRestrictionsArgs(%+v)", *p)
}
// Attributes:
-// - Success
+// - Success
type BaggageRestrictionManagerGetBaggageRestrictionsResult struct {
- Success []*BaggageRestriction `thrift:"success,0" db:"success" json:"success,omitempty"`
+ Success []*BaggageRestriction `thrift:"success,0" db:"success" json:"success,omitempty"`
}
func NewBaggageRestrictionManagerGetBaggageRestrictionsResult() *BaggageRestrictionManagerGetBaggageRestrictionsResult {
- return &BaggageRestrictionManagerGetBaggageRestrictionsResult{}
+ return &BaggageRestrictionManagerGetBaggageRestrictionsResult{}
}
var BaggageRestrictionManagerGetBaggageRestrictionsResult_Success_DEFAULT []*BaggageRestriction
func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) GetSuccess() []*BaggageRestriction {
- return p.Success
+ return p.Success
}
func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) IsSetSuccess() bool {
- return p.Success != nil
+ return p.Success != nil
}
func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.LIST {
- if err := p.ReadField0(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- return nil
-}
-
-func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
- _, size, err := iprot.ReadListBegin(ctx)
- if err != nil {
- return thrift.PrependError("error reading list begin: ", err)
- }
- tSlice := make([]*BaggageRestriction, 0, size)
- p.Success = tSlice
- for i := 0; i < size; i ++ {
- _elem5 := &BaggageRestriction{}
- if err := _elem5.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem5), err)
- }
- p.Success = append(p.Success, _elem5)
- }
- if err := iprot.ReadListEnd(ctx); err != nil {
- return thrift.PrependError("error reading list end: ", err)
- }
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.LIST {
+ if err := p.ReadField0(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ return nil
+}
+
+func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
+ _, size, err := iprot.ReadListBegin(ctx)
+ if err != nil {
+ return thrift.PrependError("error reading list begin: ", err)
+ }
+ tSlice := make([]*BaggageRestriction, 0, size)
+ p.Success = tSlice
+ for i := 0; i < size; i++ {
+ _elem5 := &BaggageRestriction{}
+ if err := _elem5.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem5), err)
+ }
+ p.Success = append(p.Success, _elem5)
+ }
+ if err := iprot.ReadListEnd(ctx); err != nil {
+ return thrift.PrependError("error reading list end: ", err)
+ }
+ return nil
}
func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "getBaggageRestrictions_result"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField0(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "getBaggageRestrictions_result"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField0(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetSuccess() {
- if err := oprot.WriteFieldBegin(ctx, "success", thrift.LIST, 0); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
- if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Success)); err != nil {
- return thrift.PrependError("error writing list begin: ", err)
- }
- for _, v := range p.Success {
- if err := v.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
- }
- }
- if err := oprot.WriteListEnd(ctx); err != nil {
- return thrift.PrependError("error writing list end: ", err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
- }
- return err
+ if p.IsSetSuccess() {
+ if err := oprot.WriteFieldBegin(ctx, "success", thrift.LIST, 0); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
+ }
+ if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Success)); err != nil {
+ return thrift.PrependError("error writing list begin: ", err)
+ }
+ for _, v := range p.Success {
+ if err := v.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
+ }
+ }
+ if err := oprot.WriteListEnd(ctx); err != nil {
+ return thrift.PrependError("error writing list end: ", err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
+ }
+ }
+ return err
}
func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("BaggageRestrictionManagerGetBaggageRestrictionsResult(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("BaggageRestrictionManagerGetBaggageRestrictionsResult(%+v)", *p)
}
-
-
diff --git a/thrift-gen/jaeger/GoUnusedProtection__.go b/thrift-gen/jaeger/GoUnusedProtection__.go
index fe45a9f9ad2..4e709e137ce 100644
--- a/thrift-gen/jaeger/GoUnusedProtection__.go
+++ b/thrift-gen/jaeger/GoUnusedProtection__.go
@@ -2,5 +2,4 @@
package jaeger
-var GoUnusedProtection__ int;
-
+var GoUnusedProtection__ int
diff --git a/thrift-gen/jaeger/jaeger-consts.go b/thrift-gen/jaeger/jaeger-consts.go
index ca723e29f1a..d80725aeca2 100644
--- a/thrift-gen/jaeger/jaeger-consts.go
+++ b/thrift-gen/jaeger/jaeger-consts.go
@@ -2,12 +2,12 @@
package jaeger
-import(
+import (
"bytes"
"context"
"fmt"
- "time"
"github.com/apache/thrift/lib/go/thrift"
+ "time"
)
// (needed to ensure safety because of naive import list construction.)
@@ -17,7 +17,5 @@ var _ = context.Background
var _ = time.Now
var _ = bytes.Equal
-
func init() {
}
-
diff --git a/thrift-gen/jaeger/jaeger.go b/thrift-gen/jaeger/jaeger.go
index 9a55459f33f..8afd720c07d 100644
--- a/thrift-gen/jaeger/jaeger.go
+++ b/thrift-gen/jaeger/jaeger.go
@@ -2,14 +2,14 @@
package jaeger
-import(
+import (
"bytes"
"context"
"database/sql/driver"
"errors"
"fmt"
- "time"
"github.com/apache/thrift/lib/go/thrift"
+ "time"
)
// (needed to ensure safety because of naive import list construction.)
@@ -20,2679 +20,3002 @@ var _ = time.Now
var _ = bytes.Equal
type TagType int64
+
const (
- TagType_STRING TagType = 0
- TagType_DOUBLE TagType = 1
- TagType_BOOL TagType = 2
- TagType_LONG TagType = 3
- TagType_BINARY TagType = 4
+ TagType_STRING TagType = 0
+ TagType_DOUBLE TagType = 1
+ TagType_BOOL TagType = 2
+ TagType_LONG TagType = 3
+ TagType_BINARY TagType = 4
)
func (p TagType) String() string {
- switch p {
- case TagType_STRING: return "STRING"
- case TagType_DOUBLE: return "DOUBLE"
- case TagType_BOOL: return "BOOL"
- case TagType_LONG: return "LONG"
- case TagType_BINARY: return "BINARY"
- }
- return ""
+ switch p {
+ case TagType_STRING:
+ return "STRING"
+ case TagType_DOUBLE:
+ return "DOUBLE"
+ case TagType_BOOL:
+ return "BOOL"
+ case TagType_LONG:
+ return "LONG"
+ case TagType_BINARY:
+ return "BINARY"
+ }
+ return ""
}
func TagTypeFromString(s string) (TagType, error) {
- switch s {
- case "STRING": return TagType_STRING, nil
- case "DOUBLE": return TagType_DOUBLE, nil
- case "BOOL": return TagType_BOOL, nil
- case "LONG": return TagType_LONG, nil
- case "BINARY": return TagType_BINARY, nil
- }
- return TagType(0), fmt.Errorf("not a valid TagType string")
+ switch s {
+ case "STRING":
+ return TagType_STRING, nil
+ case "DOUBLE":
+ return TagType_DOUBLE, nil
+ case "BOOL":
+ return TagType_BOOL, nil
+ case "LONG":
+ return TagType_LONG, nil
+ case "BINARY":
+ return TagType_BINARY, nil
+ }
+ return TagType(0), fmt.Errorf("not a valid TagType string")
}
-
func TagTypePtr(v TagType) *TagType { return &v }
func (p TagType) MarshalText() ([]byte, error) {
-return []byte(p.String()), nil
+ return []byte(p.String()), nil
}
func (p *TagType) UnmarshalText(text []byte) error {
-q, err := TagTypeFromString(string(text))
-if (err != nil) {
-return err
-}
-*p = q
-return nil
+ q, err := TagTypeFromString(string(text))
+ if err != nil {
+ return err
+ }
+ *p = q
+ return nil
}
func (p *TagType) Scan(value interface{}) error {
-v, ok := value.(int64)
-if !ok {
-return errors.New("Scan value is not int64")
-}
-*p = TagType(v)
-return nil
+ v, ok := value.(int64)
+ if !ok {
+ return errors.New("Scan value is not int64")
+ }
+ *p = TagType(v)
+ return nil
}
-func (p * TagType) Value() (driver.Value, error) {
- if p == nil {
- return nil, nil
- }
-return int64(*p), nil
+func (p *TagType) Value() (driver.Value, error) {
+ if p == nil {
+ return nil, nil
+ }
+ return int64(*p), nil
}
+
type SpanRefType int64
+
const (
- SpanRefType_CHILD_OF SpanRefType = 0
- SpanRefType_FOLLOWS_FROM SpanRefType = 1
+ SpanRefType_CHILD_OF SpanRefType = 0
+ SpanRefType_FOLLOWS_FROM SpanRefType = 1
)
func (p SpanRefType) String() string {
- switch p {
- case SpanRefType_CHILD_OF: return "CHILD_OF"
- case SpanRefType_FOLLOWS_FROM: return "FOLLOWS_FROM"
- }
- return ""
+ switch p {
+ case SpanRefType_CHILD_OF:
+ return "CHILD_OF"
+ case SpanRefType_FOLLOWS_FROM:
+ return "FOLLOWS_FROM"
+ }
+ return ""
}
func SpanRefTypeFromString(s string) (SpanRefType, error) {
- switch s {
- case "CHILD_OF": return SpanRefType_CHILD_OF, nil
- case "FOLLOWS_FROM": return SpanRefType_FOLLOWS_FROM, nil
- }
- return SpanRefType(0), fmt.Errorf("not a valid SpanRefType string")
+ switch s {
+ case "CHILD_OF":
+ return SpanRefType_CHILD_OF, nil
+ case "FOLLOWS_FROM":
+ return SpanRefType_FOLLOWS_FROM, nil
+ }
+ return SpanRefType(0), fmt.Errorf("not a valid SpanRefType string")
}
-
func SpanRefTypePtr(v SpanRefType) *SpanRefType { return &v }
func (p SpanRefType) MarshalText() ([]byte, error) {
-return []byte(p.String()), nil
+ return []byte(p.String()), nil
}
func (p *SpanRefType) UnmarshalText(text []byte) error {
-q, err := SpanRefTypeFromString(string(text))
-if (err != nil) {
-return err
-}
-*p = q
-return nil
+ q, err := SpanRefTypeFromString(string(text))
+ if err != nil {
+ return err
+ }
+ *p = q
+ return nil
}
func (p *SpanRefType) Scan(value interface{}) error {
-v, ok := value.(int64)
-if !ok {
-return errors.New("Scan value is not int64")
-}
-*p = SpanRefType(v)
-return nil
+ v, ok := value.(int64)
+ if !ok {
+ return errors.New("Scan value is not int64")
+ }
+ *p = SpanRefType(v)
+ return nil
}
-func (p * SpanRefType) Value() (driver.Value, error) {
- if p == nil {
- return nil, nil
- }
-return int64(*p), nil
+func (p *SpanRefType) Value() (driver.Value, error) {
+ if p == nil {
+ return nil, nil
+ }
+ return int64(*p), nil
}
+
// Attributes:
-// - Key
-// - VType
-// - VStr
-// - VDouble
-// - VBool
-// - VLong
-// - VBinary
+// - Key
+// - VType
+// - VStr
+// - VDouble
+// - VBool
+// - VLong
+// - VBinary
type Tag struct {
- Key string `thrift:"key,1,required" db:"key" json:"key"`
- VType TagType `thrift:"vType,2,required" db:"vType" json:"vType"`
- VStr *string `thrift:"vStr,3" db:"vStr" json:"vStr,omitempty"`
- VDouble *float64 `thrift:"vDouble,4" db:"vDouble" json:"vDouble,omitempty"`
- VBool *bool `thrift:"vBool,5" db:"vBool" json:"vBool,omitempty"`
- VLong *int64 `thrift:"vLong,6" db:"vLong" json:"vLong,omitempty"`
- VBinary []byte `thrift:"vBinary,7" db:"vBinary" json:"vBinary,omitempty"`
+ Key string `thrift:"key,1,required" db:"key" json:"key"`
+ VType TagType `thrift:"vType,2,required" db:"vType" json:"vType"`
+ VStr *string `thrift:"vStr,3" db:"vStr" json:"vStr,omitempty"`
+ VDouble *float64 `thrift:"vDouble,4" db:"vDouble" json:"vDouble,omitempty"`
+ VBool *bool `thrift:"vBool,5" db:"vBool" json:"vBool,omitempty"`
+ VLong *int64 `thrift:"vLong,6" db:"vLong" json:"vLong,omitempty"`
+ VBinary []byte `thrift:"vBinary,7" db:"vBinary" json:"vBinary,omitempty"`
}
func NewTag() *Tag {
- return &Tag{}
+ return &Tag{}
}
-
func (p *Tag) GetKey() string {
- return p.Key
+ return p.Key
}
func (p *Tag) GetVType() TagType {
- return p.VType
+ return p.VType
}
+
var Tag_VStr_DEFAULT string
+
func (p *Tag) GetVStr() string {
- if !p.IsSetVStr() {
- return Tag_VStr_DEFAULT
- }
-return *p.VStr
+ if !p.IsSetVStr() {
+ return Tag_VStr_DEFAULT
+ }
+ return *p.VStr
}
+
var Tag_VDouble_DEFAULT float64
+
func (p *Tag) GetVDouble() float64 {
- if !p.IsSetVDouble() {
- return Tag_VDouble_DEFAULT
- }
-return *p.VDouble
+ if !p.IsSetVDouble() {
+ return Tag_VDouble_DEFAULT
+ }
+ return *p.VDouble
}
+
var Tag_VBool_DEFAULT bool
+
func (p *Tag) GetVBool() bool {
- if !p.IsSetVBool() {
- return Tag_VBool_DEFAULT
- }
-return *p.VBool
+ if !p.IsSetVBool() {
+ return Tag_VBool_DEFAULT
+ }
+ return *p.VBool
}
+
var Tag_VLong_DEFAULT int64
+
func (p *Tag) GetVLong() int64 {
- if !p.IsSetVLong() {
- return Tag_VLong_DEFAULT
- }
-return *p.VLong
+ if !p.IsSetVLong() {
+ return Tag_VLong_DEFAULT
+ }
+ return *p.VLong
}
+
var Tag_VBinary_DEFAULT []byte
func (p *Tag) GetVBinary() []byte {
- return p.VBinary
+ return p.VBinary
}
func (p *Tag) IsSetVStr() bool {
- return p.VStr != nil
+ return p.VStr != nil
}
func (p *Tag) IsSetVDouble() bool {
- return p.VDouble != nil
+ return p.VDouble != nil
}
func (p *Tag) IsSetVBool() bool {
- return p.VBool != nil
+ return p.VBool != nil
}
func (p *Tag) IsSetVLong() bool {
- return p.VLong != nil
+ return p.VLong != nil
}
func (p *Tag) IsSetVBinary() bool {
- return p.VBinary != nil
+ return p.VBinary != nil
}
func (p *Tag) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
- var issetKey bool = false;
- var issetVType bool = false;
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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(ctx, iprot); err != nil {
- return err
- }
- issetKey = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 2:
- if fieldTypeId == thrift.I32 {
- if err := p.ReadField2(ctx, iprot); err != nil {
- return err
- }
- issetVType = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 3:
- if fieldTypeId == thrift.STRING {
- if err := p.ReadField3(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 4:
- if fieldTypeId == thrift.DOUBLE {
- if err := p.ReadField4(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 5:
- if fieldTypeId == thrift.BOOL {
- if err := p.ReadField5(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 6:
- if fieldTypeId == thrift.I64 {
- if err := p.ReadField6(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 7:
- if fieldTypeId == thrift.STRING {
- if err := p.ReadField7(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- if !issetKey{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Key is not set"));
- }
- if !issetVType{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field VType is not set"));
- }
- return nil
-}
-
-func (p *Tag) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadString(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.Key = v
-}
- return nil
-}
-
-func (p *Tag) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI32(ctx); err != nil {
- return thrift.PrependError("error reading field 2: ", err)
-} else {
- temp := TagType(v)
- p.VType = temp
-}
- return nil
-}
-
-func (p *Tag) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadString(ctx); err != nil {
- return thrift.PrependError("error reading field 3: ", err)
-} else {
- p.VStr = &v
-}
- return nil
-}
-
-func (p *Tag) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadDouble(ctx); err != nil {
- return thrift.PrependError("error reading field 4: ", err)
-} else {
- p.VDouble = &v
-}
- return nil
-}
-
-func (p *Tag) ReadField5(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadBool(ctx); err != nil {
- return thrift.PrependError("error reading field 5: ", err)
-} else {
- p.VBool = &v
-}
- return nil
-}
-
-func (p *Tag) ReadField6(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 6: ", err)
-} else {
- p.VLong = &v
-}
- return nil
-}
-
-func (p *Tag) ReadField7(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadBinary(ctx); err != nil {
- return thrift.PrependError("error reading field 7: ", err)
-} else {
- p.VBinary = v
-}
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ var issetKey bool = false
+ var issetVType bool = false
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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(ctx, iprot); err != nil {
+ return err
+ }
+ issetKey = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 2:
+ if fieldTypeId == thrift.I32 {
+ if err := p.ReadField2(ctx, iprot); err != nil {
+ return err
+ }
+ issetVType = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 3:
+ if fieldTypeId == thrift.STRING {
+ if err := p.ReadField3(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 4:
+ if fieldTypeId == thrift.DOUBLE {
+ if err := p.ReadField4(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 5:
+ if fieldTypeId == thrift.BOOL {
+ if err := p.ReadField5(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 6:
+ if fieldTypeId == thrift.I64 {
+ if err := p.ReadField6(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 7:
+ if fieldTypeId == thrift.STRING {
+ if err := p.ReadField7(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ if !issetKey {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Key is not set"))
+ }
+ if !issetVType {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field VType is not set"))
+ }
+ return nil
+}
+
+func (p *Tag) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadString(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.Key = v
+ }
+ return nil
+}
+
+func (p *Tag) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI32(ctx); err != nil {
+ return thrift.PrependError("error reading field 2: ", err)
+ } else {
+ temp := TagType(v)
+ p.VType = temp
+ }
+ return nil
+}
+
+func (p *Tag) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadString(ctx); err != nil {
+ return thrift.PrependError("error reading field 3: ", err)
+ } else {
+ p.VStr = &v
+ }
+ return nil
+}
+
+func (p *Tag) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadDouble(ctx); err != nil {
+ return thrift.PrependError("error reading field 4: ", err)
+ } else {
+ p.VDouble = &v
+ }
+ return nil
+}
+
+func (p *Tag) ReadField5(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadBool(ctx); err != nil {
+ return thrift.PrependError("error reading field 5: ", err)
+ } else {
+ p.VBool = &v
+ }
+ return nil
+}
+
+func (p *Tag) ReadField6(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 6: ", err)
+ } else {
+ p.VLong = &v
+ }
+ return nil
+}
+
+func (p *Tag) ReadField7(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadBinary(ctx); err != nil {
+ return thrift.PrependError("error reading field 7: ", err)
+ } else {
+ p.VBinary = v
+ }
+ return nil
}
func (p *Tag) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "Tag"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- if err := p.writeField2(ctx, oprot); err != nil { return err }
- if err := p.writeField3(ctx, oprot); err != nil { return err }
- if err := p.writeField4(ctx, oprot); err != nil { return err }
- if err := p.writeField5(ctx, oprot); err != nil { return err }
- if err := p.writeField6(ctx, oprot); err != nil { return err }
- if err := p.writeField7(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "Tag"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField2(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField3(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField4(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField5(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField6(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField7(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *Tag) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRING, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) }
- if err := oprot.WriteString(ctx, string(p.Key)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRING, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err)
+ }
+ if err := oprot.WriteString(ctx, string(p.Key)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err)
+ }
+ return err
}
func (p *Tag) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "vType", thrift.I32, 2); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:vType: ", p), err) }
- if err := oprot.WriteI32(ctx, int32(p.VType)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.vType (2) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 2:vType: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "vType", thrift.I32, 2); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:vType: ", p), err)
+ }
+ if err := oprot.WriteI32(ctx, int32(p.VType)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.vType (2) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 2:vType: ", p), err)
+ }
+ return err
}
func (p *Tag) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetVStr() {
- if err := oprot.WriteFieldBegin(ctx, "vStr", thrift.STRING, 3); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:vStr: ", p), err) }
- if err := oprot.WriteString(ctx, string(*p.VStr)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.vStr (3) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 3:vStr: ", p), err) }
- }
- return err
+ if p.IsSetVStr() {
+ if err := oprot.WriteFieldBegin(ctx, "vStr", thrift.STRING, 3); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:vStr: ", p), err)
+ }
+ if err := oprot.WriteString(ctx, string(*p.VStr)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.vStr (3) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 3:vStr: ", p), err)
+ }
+ }
+ return err
}
func (p *Tag) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetVDouble() {
- if err := oprot.WriteFieldBegin(ctx, "vDouble", thrift.DOUBLE, 4); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:vDouble: ", p), err) }
- if err := oprot.WriteDouble(ctx, float64(*p.VDouble)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.vDouble (4) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 4:vDouble: ", p), err) }
- }
- return err
+ if p.IsSetVDouble() {
+ if err := oprot.WriteFieldBegin(ctx, "vDouble", thrift.DOUBLE, 4); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:vDouble: ", p), err)
+ }
+ if err := oprot.WriteDouble(ctx, float64(*p.VDouble)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.vDouble (4) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 4:vDouble: ", p), err)
+ }
+ }
+ return err
}
func (p *Tag) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetVBool() {
- if err := oprot.WriteFieldBegin(ctx, "vBool", thrift.BOOL, 5); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:vBool: ", p), err) }
- if err := oprot.WriteBool(ctx, bool(*p.VBool)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.vBool (5) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 5:vBool: ", p), err) }
- }
- return err
+ if p.IsSetVBool() {
+ if err := oprot.WriteFieldBegin(ctx, "vBool", thrift.BOOL, 5); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:vBool: ", p), err)
+ }
+ if err := oprot.WriteBool(ctx, bool(*p.VBool)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.vBool (5) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 5:vBool: ", p), err)
+ }
+ }
+ return err
}
func (p *Tag) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetVLong() {
- if err := oprot.WriteFieldBegin(ctx, "vLong", thrift.I64, 6); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:vLong: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(*p.VLong)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.vLong (6) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 6:vLong: ", p), err) }
- }
- return err
+ if p.IsSetVLong() {
+ if err := oprot.WriteFieldBegin(ctx, "vLong", thrift.I64, 6); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:vLong: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(*p.VLong)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.vLong (6) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 6:vLong: ", p), err)
+ }
+ }
+ return err
}
func (p *Tag) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetVBinary() {
- if err := oprot.WriteFieldBegin(ctx, "vBinary", thrift.STRING, 7); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:vBinary: ", p), err) }
- if err := oprot.WriteBinary(ctx, p.VBinary); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.vBinary (7) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 7:vBinary: ", p), err) }
- }
- return err
+ if p.IsSetVBinary() {
+ if err := oprot.WriteFieldBegin(ctx, "vBinary", thrift.STRING, 7); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:vBinary: ", p), err)
+ }
+ if err := oprot.WriteBinary(ctx, p.VBinary); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.vBinary (7) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 7:vBinary: ", p), err)
+ }
+ }
+ return err
}
func (p *Tag) Equals(other *Tag) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.Key != other.Key { return false }
- if p.VType != other.VType { return false }
- if p.VStr != other.VStr {
- if p.VStr == nil || other.VStr == nil {
- return false
- }
- if (*p.VStr) != (*other.VStr) { return false }
- }
- if p.VDouble != other.VDouble {
- if p.VDouble == nil || other.VDouble == nil {
- return false
- }
- if (*p.VDouble) != (*other.VDouble) { return false }
- }
- if p.VBool != other.VBool {
- if p.VBool == nil || other.VBool == nil {
- return false
- }
- if (*p.VBool) != (*other.VBool) { return false }
- }
- if p.VLong != other.VLong {
- if p.VLong == nil || other.VLong == nil {
- return false
- }
- if (*p.VLong) != (*other.VLong) { return false }
- }
- if bytes.Compare(p.VBinary, other.VBinary) != 0 { return false }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.Key != other.Key {
+ return false
+ }
+ if p.VType != other.VType {
+ return false
+ }
+ if p.VStr != other.VStr {
+ if p.VStr == nil || other.VStr == nil {
+ return false
+ }
+ if (*p.VStr) != (*other.VStr) {
+ return false
+ }
+ }
+ if p.VDouble != other.VDouble {
+ if p.VDouble == nil || other.VDouble == nil {
+ return false
+ }
+ if (*p.VDouble) != (*other.VDouble) {
+ return false
+ }
+ }
+ if p.VBool != other.VBool {
+ if p.VBool == nil || other.VBool == nil {
+ return false
+ }
+ if (*p.VBool) != (*other.VBool) {
+ return false
+ }
+ }
+ if p.VLong != other.VLong {
+ if p.VLong == nil || other.VLong == nil {
+ return false
+ }
+ if (*p.VLong) != (*other.VLong) {
+ return false
+ }
+ }
+ if bytes.Compare(p.VBinary, other.VBinary) != 0 {
+ return false
+ }
+ return true
}
func (p *Tag) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("Tag(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("Tag(%+v)", *p)
}
// Attributes:
-// - Timestamp
-// - Fields
+// - Timestamp
+// - Fields
type Log struct {
- Timestamp int64 `thrift:"timestamp,1,required" db:"timestamp" json:"timestamp"`
- Fields []*Tag `thrift:"fields,2,required" db:"fields" json:"fields"`
+ Timestamp int64 `thrift:"timestamp,1,required" db:"timestamp" json:"timestamp"`
+ Fields []*Tag `thrift:"fields,2,required" db:"fields" json:"fields"`
}
func NewLog() *Log {
- return &Log{}
+ return &Log{}
}
-
func (p *Log) GetTimestamp() int64 {
- return p.Timestamp
+ return p.Timestamp
}
func (p *Log) GetFields() []*Tag {
- return p.Fields
+ return p.Fields
}
func (p *Log) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
- var issetTimestamp bool = false;
- var issetFields bool = false;
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.I64 {
- if err := p.ReadField1(ctx, iprot); err != nil {
- return err
- }
- issetTimestamp = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 2:
- if fieldTypeId == thrift.LIST {
- if err := p.ReadField2(ctx, iprot); err != nil {
- return err
- }
- issetFields = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- if !issetTimestamp{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Timestamp is not set"));
- }
- if !issetFields{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Fields is not set"));
- }
- return nil
-}
-
-func (p *Log) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.Timestamp = v
-}
- return nil
-}
-
-func (p *Log) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
- _, size, err := iprot.ReadListBegin(ctx)
- if err != nil {
- return thrift.PrependError("error reading list begin: ", err)
- }
- tSlice := make([]*Tag, 0, size)
- p.Fields = tSlice
- for i := 0; i < size; i ++ {
- _elem0 := &Tag{}
- if err := _elem0.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem0), err)
- }
- p.Fields = append(p.Fields, _elem0)
- }
- if err := iprot.ReadListEnd(ctx); err != nil {
- return thrift.PrependError("error reading list end: ", err)
- }
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ var issetTimestamp bool = false
+ var issetFields bool = false
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.I64 {
+ if err := p.ReadField1(ctx, iprot); err != nil {
+ return err
+ }
+ issetTimestamp = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 2:
+ if fieldTypeId == thrift.LIST {
+ if err := p.ReadField2(ctx, iprot); err != nil {
+ return err
+ }
+ issetFields = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ if !issetTimestamp {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Timestamp is not set"))
+ }
+ if !issetFields {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Fields is not set"))
+ }
+ return nil
+}
+
+func (p *Log) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.Timestamp = v
+ }
+ return nil
+}
+
+func (p *Log) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
+ _, size, err := iprot.ReadListBegin(ctx)
+ if err != nil {
+ return thrift.PrependError("error reading list begin: ", err)
+ }
+ tSlice := make([]*Tag, 0, size)
+ p.Fields = tSlice
+ for i := 0; i < size; i++ {
+ _elem0 := &Tag{}
+ if err := _elem0.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem0), err)
+ }
+ p.Fields = append(p.Fields, _elem0)
+ }
+ if err := iprot.ReadListEnd(ctx); err != nil {
+ return thrift.PrependError("error reading list end: ", err)
+ }
+ return nil
}
func (p *Log) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "Log"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- if err := p.writeField2(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "Log"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField2(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *Log) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:timestamp: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(p.Timestamp)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.timestamp (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:timestamp: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:timestamp: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(p.Timestamp)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.timestamp (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:timestamp: ", p), err)
+ }
+ return err
}
func (p *Log) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "fields", thrift.LIST, 2); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:fields: ", p), err) }
- if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Fields)); err != nil {
- return thrift.PrependError("error writing list begin: ", err)
- }
- for _, v := range p.Fields {
- if err := v.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
- }
- }
- if err := oprot.WriteListEnd(ctx); err != nil {
- return thrift.PrependError("error writing list end: ", err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 2:fields: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "fields", thrift.LIST, 2); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:fields: ", p), err)
+ }
+ if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Fields)); err != nil {
+ return thrift.PrependError("error writing list begin: ", err)
+ }
+ for _, v := range p.Fields {
+ if err := v.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
+ }
+ }
+ if err := oprot.WriteListEnd(ctx); err != nil {
+ return thrift.PrependError("error writing list end: ", err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 2:fields: ", p), err)
+ }
+ return err
}
func (p *Log) Equals(other *Log) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.Timestamp != other.Timestamp { return false }
- if len(p.Fields) != len(other.Fields) { return false }
- for i, _tgt := range p.Fields {
- _src1 := other.Fields[i]
- if !_tgt.Equals(_src1) { return false }
- }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.Timestamp != other.Timestamp {
+ return false
+ }
+ if len(p.Fields) != len(other.Fields) {
+ return false
+ }
+ for i, _tgt := range p.Fields {
+ _src1 := other.Fields[i]
+ if !_tgt.Equals(_src1) {
+ return false
+ }
+ }
+ return true
}
func (p *Log) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("Log(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("Log(%+v)", *p)
}
// Attributes:
-// - RefType
-// - TraceIdLow
-// - TraceIdHigh
-// - SpanId
+// - RefType
+// - TraceIdLow
+// - TraceIdHigh
+// - SpanId
type SpanRef struct {
- RefType SpanRefType `thrift:"refType,1,required" db:"refType" json:"refType"`
- TraceIdLow int64 `thrift:"traceIdLow,2,required" db:"traceIdLow" json:"traceIdLow"`
- TraceIdHigh int64 `thrift:"traceIdHigh,3,required" db:"traceIdHigh" json:"traceIdHigh"`
- SpanId int64 `thrift:"spanId,4,required" db:"spanId" json:"spanId"`
+ RefType SpanRefType `thrift:"refType,1,required" db:"refType" json:"refType"`
+ TraceIdLow int64 `thrift:"traceIdLow,2,required" db:"traceIdLow" json:"traceIdLow"`
+ TraceIdHigh int64 `thrift:"traceIdHigh,3,required" db:"traceIdHigh" json:"traceIdHigh"`
+ SpanId int64 `thrift:"spanId,4,required" db:"spanId" json:"spanId"`
}
func NewSpanRef() *SpanRef {
- return &SpanRef{}
+ return &SpanRef{}
}
-
func (p *SpanRef) GetRefType() SpanRefType {
- return p.RefType
+ return p.RefType
}
func (p *SpanRef) GetTraceIdLow() int64 {
- return p.TraceIdLow
+ return p.TraceIdLow
}
func (p *SpanRef) GetTraceIdHigh() int64 {
- return p.TraceIdHigh
+ return p.TraceIdHigh
}
func (p *SpanRef) GetSpanId() int64 {
- return p.SpanId
+ return p.SpanId
}
func (p *SpanRef) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
- var issetRefType bool = false;
- var issetTraceIdLow bool = false;
- var issetTraceIdHigh bool = false;
- var issetSpanId bool = false;
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.I32 {
- if err := p.ReadField1(ctx, iprot); err != nil {
- return err
- }
- issetRefType = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 2:
- if fieldTypeId == thrift.I64 {
- if err := p.ReadField2(ctx, iprot); err != nil {
- return err
- }
- issetTraceIdLow = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 3:
- if fieldTypeId == thrift.I64 {
- if err := p.ReadField3(ctx, iprot); err != nil {
- return err
- }
- issetTraceIdHigh = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 4:
- if fieldTypeId == thrift.I64 {
- if err := p.ReadField4(ctx, iprot); err != nil {
- return err
- }
- issetSpanId = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- if !issetRefType{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field RefType is not set"));
- }
- if !issetTraceIdLow{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdLow is not set"));
- }
- if !issetTraceIdHigh{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdHigh is not set"));
- }
- if !issetSpanId{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SpanId is not set"));
- }
- return nil
-}
-
-func (p *SpanRef) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI32(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- temp := SpanRefType(v)
- p.RefType = temp
-}
- return nil
-}
-
-func (p *SpanRef) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 2: ", err)
-} else {
- p.TraceIdLow = v
-}
- return nil
-}
-
-func (p *SpanRef) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 3: ", err)
-} else {
- p.TraceIdHigh = v
-}
- return nil
-}
-
-func (p *SpanRef) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 4: ", err)
-} else {
- p.SpanId = v
-}
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ var issetRefType bool = false
+ var issetTraceIdLow bool = false
+ var issetTraceIdHigh bool = false
+ var issetSpanId bool = false
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.I32 {
+ if err := p.ReadField1(ctx, iprot); err != nil {
+ return err
+ }
+ issetRefType = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 2:
+ if fieldTypeId == thrift.I64 {
+ if err := p.ReadField2(ctx, iprot); err != nil {
+ return err
+ }
+ issetTraceIdLow = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 3:
+ if fieldTypeId == thrift.I64 {
+ if err := p.ReadField3(ctx, iprot); err != nil {
+ return err
+ }
+ issetTraceIdHigh = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 4:
+ if fieldTypeId == thrift.I64 {
+ if err := p.ReadField4(ctx, iprot); err != nil {
+ return err
+ }
+ issetSpanId = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ if !issetRefType {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field RefType is not set"))
+ }
+ if !issetTraceIdLow {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdLow is not set"))
+ }
+ if !issetTraceIdHigh {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdHigh is not set"))
+ }
+ if !issetSpanId {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SpanId is not set"))
+ }
+ return nil
+}
+
+func (p *SpanRef) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI32(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ temp := SpanRefType(v)
+ p.RefType = temp
+ }
+ return nil
+}
+
+func (p *SpanRef) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 2: ", err)
+ } else {
+ p.TraceIdLow = v
+ }
+ return nil
+}
+
+func (p *SpanRef) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 3: ", err)
+ } else {
+ p.TraceIdHigh = v
+ }
+ return nil
+}
+
+func (p *SpanRef) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 4: ", err)
+ } else {
+ p.SpanId = v
+ }
+ return nil
}
func (p *SpanRef) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "SpanRef"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- if err := p.writeField2(ctx, oprot); err != nil { return err }
- if err := p.writeField3(ctx, oprot); err != nil { return err }
- if err := p.writeField4(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "SpanRef"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField2(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField3(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField4(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *SpanRef) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "refType", thrift.I32, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:refType: ", p), err) }
- if err := oprot.WriteI32(ctx, int32(p.RefType)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.refType (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:refType: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "refType", thrift.I32, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:refType: ", p), err)
+ }
+ if err := oprot.WriteI32(ctx, int32(p.RefType)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.refType (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:refType: ", p), err)
+ }
+ return err
}
func (p *SpanRef) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "traceIdLow", thrift.I64, 2); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:traceIdLow: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(p.TraceIdLow)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.traceIdLow (2) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 2:traceIdLow: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "traceIdLow", thrift.I64, 2); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:traceIdLow: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(p.TraceIdLow)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.traceIdLow (2) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 2:traceIdLow: ", p), err)
+ }
+ return err
}
func (p *SpanRef) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "traceIdHigh", thrift.I64, 3); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:traceIdHigh: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(p.TraceIdHigh)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.traceIdHigh (3) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 3:traceIdHigh: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "traceIdHigh", thrift.I64, 3); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:traceIdHigh: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(p.TraceIdHigh)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.traceIdHigh (3) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 3:traceIdHigh: ", p), err)
+ }
+ return err
}
func (p *SpanRef) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "spanId", thrift.I64, 4); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:spanId: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(p.SpanId)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.spanId (4) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 4:spanId: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "spanId", thrift.I64, 4); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:spanId: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(p.SpanId)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.spanId (4) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 4:spanId: ", p), err)
+ }
+ return err
}
func (p *SpanRef) Equals(other *SpanRef) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.RefType != other.RefType { return false }
- if p.TraceIdLow != other.TraceIdLow { return false }
- if p.TraceIdHigh != other.TraceIdHigh { return false }
- if p.SpanId != other.SpanId { return false }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.RefType != other.RefType {
+ return false
+ }
+ if p.TraceIdLow != other.TraceIdLow {
+ return false
+ }
+ if p.TraceIdHigh != other.TraceIdHigh {
+ return false
+ }
+ if p.SpanId != other.SpanId {
+ return false
+ }
+ return true
}
func (p *SpanRef) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("SpanRef(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("SpanRef(%+v)", *p)
}
// Attributes:
-// - TraceIdLow
-// - TraceIdHigh
-// - SpanId
-// - ParentSpanId
-// - OperationName
-// - References
-// - Flags
-// - StartTime
-// - Duration
-// - Tags
-// - Logs
+// - TraceIdLow
+// - TraceIdHigh
+// - SpanId
+// - ParentSpanId
+// - OperationName
+// - References
+// - Flags
+// - StartTime
+// - Duration
+// - Tags
+// - Logs
type Span struct {
- TraceIdLow int64 `thrift:"traceIdLow,1,required" db:"traceIdLow" json:"traceIdLow"`
- TraceIdHigh int64 `thrift:"traceIdHigh,2,required" db:"traceIdHigh" json:"traceIdHigh"`
- SpanId int64 `thrift:"spanId,3,required" db:"spanId" json:"spanId"`
- ParentSpanId int64 `thrift:"parentSpanId,4,required" db:"parentSpanId" json:"parentSpanId"`
- OperationName string `thrift:"operationName,5,required" db:"operationName" json:"operationName"`
- References []*SpanRef `thrift:"references,6" db:"references" json:"references,omitempty"`
- Flags int32 `thrift:"flags,7,required" db:"flags" json:"flags"`
- StartTime int64 `thrift:"startTime,8,required" db:"startTime" json:"startTime"`
- Duration int64 `thrift:"duration,9,required" db:"duration" json:"duration"`
- Tags []*Tag `thrift:"tags,10" db:"tags" json:"tags,omitempty"`
- Logs []*Log `thrift:"logs,11" db:"logs" json:"logs,omitempty"`
+ TraceIdLow int64 `thrift:"traceIdLow,1,required" db:"traceIdLow" json:"traceIdLow"`
+ TraceIdHigh int64 `thrift:"traceIdHigh,2,required" db:"traceIdHigh" json:"traceIdHigh"`
+ SpanId int64 `thrift:"spanId,3,required" db:"spanId" json:"spanId"`
+ ParentSpanId int64 `thrift:"parentSpanId,4,required" db:"parentSpanId" json:"parentSpanId"`
+ OperationName string `thrift:"operationName,5,required" db:"operationName" json:"operationName"`
+ References []*SpanRef `thrift:"references,6" db:"references" json:"references,omitempty"`
+ Flags int32 `thrift:"flags,7,required" db:"flags" json:"flags"`
+ StartTime int64 `thrift:"startTime,8,required" db:"startTime" json:"startTime"`
+ Duration int64 `thrift:"duration,9,required" db:"duration" json:"duration"`
+ Tags []*Tag `thrift:"tags,10" db:"tags" json:"tags,omitempty"`
+ Logs []*Log `thrift:"logs,11" db:"logs" json:"logs,omitempty"`
}
func NewSpan() *Span {
- return &Span{}
+ return &Span{}
}
-
func (p *Span) GetTraceIdLow() int64 {
- return p.TraceIdLow
+ return p.TraceIdLow
}
func (p *Span) GetTraceIdHigh() int64 {
- return p.TraceIdHigh
+ return p.TraceIdHigh
}
func (p *Span) GetSpanId() int64 {
- return p.SpanId
+ return p.SpanId
}
func (p *Span) GetParentSpanId() int64 {
- return p.ParentSpanId
+ return p.ParentSpanId
}
func (p *Span) GetOperationName() string {
- return p.OperationName
+ return p.OperationName
}
+
var Span_References_DEFAULT []*SpanRef
func (p *Span) GetReferences() []*SpanRef {
- return p.References
+ return p.References
}
func (p *Span) GetFlags() int32 {
- return p.Flags
+ return p.Flags
}
func (p *Span) GetStartTime() int64 {
- return p.StartTime
+ return p.StartTime
}
func (p *Span) GetDuration() int64 {
- return p.Duration
+ return p.Duration
}
+
var Span_Tags_DEFAULT []*Tag
func (p *Span) GetTags() []*Tag {
- return p.Tags
+ return p.Tags
}
+
var Span_Logs_DEFAULT []*Log
func (p *Span) GetLogs() []*Log {
- return p.Logs
+ return p.Logs
}
func (p *Span) IsSetReferences() bool {
- return p.References != nil
+ return p.References != nil
}
func (p *Span) IsSetTags() bool {
- return p.Tags != nil
+ return p.Tags != nil
}
func (p *Span) IsSetLogs() bool {
- return p.Logs != nil
+ return p.Logs != nil
}
func (p *Span) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
- var issetTraceIdLow bool = false;
- var issetTraceIdHigh bool = false;
- var issetSpanId bool = false;
- var issetParentSpanId bool = false;
- var issetOperationName bool = false;
- var issetFlags bool = false;
- var issetStartTime bool = false;
- var issetDuration bool = false;
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.I64 {
- if err := p.ReadField1(ctx, iprot); err != nil {
- return err
- }
- issetTraceIdLow = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 2:
- if fieldTypeId == thrift.I64 {
- if err := p.ReadField2(ctx, iprot); err != nil {
- return err
- }
- issetTraceIdHigh = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 3:
- if fieldTypeId == thrift.I64 {
- if err := p.ReadField3(ctx, iprot); err != nil {
- return err
- }
- issetSpanId = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 4:
- if fieldTypeId == thrift.I64 {
- if err := p.ReadField4(ctx, iprot); err != nil {
- return err
- }
- issetParentSpanId = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 5:
- if fieldTypeId == thrift.STRING {
- if err := p.ReadField5(ctx, iprot); err != nil {
- return err
- }
- issetOperationName = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 6:
- if fieldTypeId == thrift.LIST {
- if err := p.ReadField6(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 7:
- if fieldTypeId == thrift.I32 {
- if err := p.ReadField7(ctx, iprot); err != nil {
- return err
- }
- issetFlags = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 8:
- if fieldTypeId == thrift.I64 {
- if err := p.ReadField8(ctx, iprot); err != nil {
- return err
- }
- issetStartTime = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 9:
- if fieldTypeId == thrift.I64 {
- if err := p.ReadField9(ctx, iprot); err != nil {
- return err
- }
- issetDuration = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 10:
- if fieldTypeId == thrift.LIST {
- if err := p.ReadField10(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 11:
- if fieldTypeId == thrift.LIST {
- if err := p.ReadField11(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- if !issetTraceIdLow{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdLow is not set"));
- }
- if !issetTraceIdHigh{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdHigh is not set"));
- }
- if !issetSpanId{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SpanId is not set"));
- }
- if !issetParentSpanId{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ParentSpanId is not set"));
- }
- if !issetOperationName{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field OperationName is not set"));
- }
- if !issetFlags{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Flags is not set"));
- }
- if !issetStartTime{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StartTime is not set"));
- }
- if !issetDuration{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Duration is not set"));
- }
- return nil
-}
-
-func (p *Span) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.TraceIdLow = v
-}
- return nil
-}
-
-func (p *Span) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 2: ", err)
-} else {
- p.TraceIdHigh = v
-}
- return nil
-}
-
-func (p *Span) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 3: ", err)
-} else {
- p.SpanId = v
-}
- return nil
-}
-
-func (p *Span) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 4: ", err)
-} else {
- p.ParentSpanId = v
-}
- return nil
-}
-
-func (p *Span) ReadField5(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadString(ctx); err != nil {
- return thrift.PrependError("error reading field 5: ", err)
-} else {
- p.OperationName = v
-}
- return nil
-}
-
-func (p *Span) ReadField6(ctx context.Context, iprot thrift.TProtocol) error {
- _, size, err := iprot.ReadListBegin(ctx)
- if err != nil {
- return thrift.PrependError("error reading list begin: ", err)
- }
- tSlice := make([]*SpanRef, 0, size)
- p.References = tSlice
- for i := 0; i < size; i ++ {
- _elem2 := &SpanRef{}
- if err := _elem2.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem2), err)
- }
- p.References = append(p.References, _elem2)
- }
- if err := iprot.ReadListEnd(ctx); err != nil {
- return thrift.PrependError("error reading list end: ", err)
- }
- return nil
-}
-
-func (p *Span) ReadField7(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI32(ctx); err != nil {
- return thrift.PrependError("error reading field 7: ", err)
-} else {
- p.Flags = v
-}
- return nil
-}
-
-func (p *Span) ReadField8(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 8: ", err)
-} else {
- p.StartTime = v
-}
- return nil
-}
-
-func (p *Span) ReadField9(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 9: ", err)
-} else {
- p.Duration = v
-}
- return nil
-}
-
-func (p *Span) ReadField10(ctx context.Context, iprot thrift.TProtocol) error {
- _, size, err := iprot.ReadListBegin(ctx)
- if err != nil {
- return thrift.PrependError("error reading list begin: ", err)
- }
- tSlice := make([]*Tag, 0, size)
- p.Tags = tSlice
- for i := 0; i < size; i ++ {
- _elem3 := &Tag{}
- if err := _elem3.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem3), err)
- }
- p.Tags = append(p.Tags, _elem3)
- }
- if err := iprot.ReadListEnd(ctx); err != nil {
- return thrift.PrependError("error reading list end: ", err)
- }
- return nil
-}
-
-func (p *Span) ReadField11(ctx context.Context, iprot thrift.TProtocol) error {
- _, size, err := iprot.ReadListBegin(ctx)
- if err != nil {
- return thrift.PrependError("error reading list begin: ", err)
- }
- tSlice := make([]*Log, 0, size)
- p.Logs = tSlice
- for i := 0; i < size; i ++ {
- _elem4 := &Log{}
- if err := _elem4.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err)
- }
- p.Logs = append(p.Logs, _elem4)
- }
- if err := iprot.ReadListEnd(ctx); err != nil {
- return thrift.PrependError("error reading list end: ", err)
- }
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ var issetTraceIdLow bool = false
+ var issetTraceIdHigh bool = false
+ var issetSpanId bool = false
+ var issetParentSpanId bool = false
+ var issetOperationName bool = false
+ var issetFlags bool = false
+ var issetStartTime bool = false
+ var issetDuration bool = false
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.I64 {
+ if err := p.ReadField1(ctx, iprot); err != nil {
+ return err
+ }
+ issetTraceIdLow = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 2:
+ if fieldTypeId == thrift.I64 {
+ if err := p.ReadField2(ctx, iprot); err != nil {
+ return err
+ }
+ issetTraceIdHigh = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 3:
+ if fieldTypeId == thrift.I64 {
+ if err := p.ReadField3(ctx, iprot); err != nil {
+ return err
+ }
+ issetSpanId = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 4:
+ if fieldTypeId == thrift.I64 {
+ if err := p.ReadField4(ctx, iprot); err != nil {
+ return err
+ }
+ issetParentSpanId = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 5:
+ if fieldTypeId == thrift.STRING {
+ if err := p.ReadField5(ctx, iprot); err != nil {
+ return err
+ }
+ issetOperationName = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 6:
+ if fieldTypeId == thrift.LIST {
+ if err := p.ReadField6(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 7:
+ if fieldTypeId == thrift.I32 {
+ if err := p.ReadField7(ctx, iprot); err != nil {
+ return err
+ }
+ issetFlags = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 8:
+ if fieldTypeId == thrift.I64 {
+ if err := p.ReadField8(ctx, iprot); err != nil {
+ return err
+ }
+ issetStartTime = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 9:
+ if fieldTypeId == thrift.I64 {
+ if err := p.ReadField9(ctx, iprot); err != nil {
+ return err
+ }
+ issetDuration = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 10:
+ if fieldTypeId == thrift.LIST {
+ if err := p.ReadField10(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 11:
+ if fieldTypeId == thrift.LIST {
+ if err := p.ReadField11(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ if !issetTraceIdLow {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdLow is not set"))
+ }
+ if !issetTraceIdHigh {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdHigh is not set"))
+ }
+ if !issetSpanId {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SpanId is not set"))
+ }
+ if !issetParentSpanId {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ParentSpanId is not set"))
+ }
+ if !issetOperationName {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field OperationName is not set"))
+ }
+ if !issetFlags {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Flags is not set"))
+ }
+ if !issetStartTime {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StartTime is not set"))
+ }
+ if !issetDuration {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Duration is not set"))
+ }
+ return nil
+}
+
+func (p *Span) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.TraceIdLow = v
+ }
+ return nil
+}
+
+func (p *Span) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 2: ", err)
+ } else {
+ p.TraceIdHigh = v
+ }
+ return nil
+}
+
+func (p *Span) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 3: ", err)
+ } else {
+ p.SpanId = v
+ }
+ return nil
+}
+
+func (p *Span) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 4: ", err)
+ } else {
+ p.ParentSpanId = v
+ }
+ return nil
+}
+
+func (p *Span) ReadField5(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadString(ctx); err != nil {
+ return thrift.PrependError("error reading field 5: ", err)
+ } else {
+ p.OperationName = v
+ }
+ return nil
+}
+
+func (p *Span) ReadField6(ctx context.Context, iprot thrift.TProtocol) error {
+ _, size, err := iprot.ReadListBegin(ctx)
+ if err != nil {
+ return thrift.PrependError("error reading list begin: ", err)
+ }
+ tSlice := make([]*SpanRef, 0, size)
+ p.References = tSlice
+ for i := 0; i < size; i++ {
+ _elem2 := &SpanRef{}
+ if err := _elem2.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem2), err)
+ }
+ p.References = append(p.References, _elem2)
+ }
+ if err := iprot.ReadListEnd(ctx); err != nil {
+ return thrift.PrependError("error reading list end: ", err)
+ }
+ return nil
+}
+
+func (p *Span) ReadField7(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI32(ctx); err != nil {
+ return thrift.PrependError("error reading field 7: ", err)
+ } else {
+ p.Flags = v
+ }
+ return nil
+}
+
+func (p *Span) ReadField8(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 8: ", err)
+ } else {
+ p.StartTime = v
+ }
+ return nil
+}
+
+func (p *Span) ReadField9(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 9: ", err)
+ } else {
+ p.Duration = v
+ }
+ return nil
+}
+
+func (p *Span) ReadField10(ctx context.Context, iprot thrift.TProtocol) error {
+ _, size, err := iprot.ReadListBegin(ctx)
+ if err != nil {
+ return thrift.PrependError("error reading list begin: ", err)
+ }
+ tSlice := make([]*Tag, 0, size)
+ p.Tags = tSlice
+ for i := 0; i < size; i++ {
+ _elem3 := &Tag{}
+ if err := _elem3.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem3), err)
+ }
+ p.Tags = append(p.Tags, _elem3)
+ }
+ if err := iprot.ReadListEnd(ctx); err != nil {
+ return thrift.PrependError("error reading list end: ", err)
+ }
+ return nil
+}
+
+func (p *Span) ReadField11(ctx context.Context, iprot thrift.TProtocol) error {
+ _, size, err := iprot.ReadListBegin(ctx)
+ if err != nil {
+ return thrift.PrependError("error reading list begin: ", err)
+ }
+ tSlice := make([]*Log, 0, size)
+ p.Logs = tSlice
+ for i := 0; i < size; i++ {
+ _elem4 := &Log{}
+ if err := _elem4.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err)
+ }
+ p.Logs = append(p.Logs, _elem4)
+ }
+ if err := iprot.ReadListEnd(ctx); err != nil {
+ return thrift.PrependError("error reading list end: ", err)
+ }
+ return nil
}
func (p *Span) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "Span"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- if err := p.writeField2(ctx, oprot); err != nil { return err }
- if err := p.writeField3(ctx, oprot); err != nil { return err }
- if err := p.writeField4(ctx, oprot); err != nil { return err }
- if err := p.writeField5(ctx, oprot); err != nil { return err }
- if err := p.writeField6(ctx, oprot); err != nil { return err }
- if err := p.writeField7(ctx, oprot); err != nil { return err }
- if err := p.writeField8(ctx, oprot); err != nil { return err }
- if err := p.writeField9(ctx, oprot); err != nil { return err }
- if err := p.writeField10(ctx, oprot); err != nil { return err }
- if err := p.writeField11(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "Span"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField2(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField3(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField4(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField5(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField6(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField7(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField8(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField9(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField10(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField11(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *Span) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "traceIdLow", thrift.I64, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:traceIdLow: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(p.TraceIdLow)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.traceIdLow (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:traceIdLow: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "traceIdLow", thrift.I64, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:traceIdLow: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(p.TraceIdLow)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.traceIdLow (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:traceIdLow: ", p), err)
+ }
+ return err
}
func (p *Span) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "traceIdHigh", thrift.I64, 2); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:traceIdHigh: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(p.TraceIdHigh)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.traceIdHigh (2) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 2:traceIdHigh: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "traceIdHigh", thrift.I64, 2); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:traceIdHigh: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(p.TraceIdHigh)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.traceIdHigh (2) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 2:traceIdHigh: ", p), err)
+ }
+ return err
}
func (p *Span) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "spanId", thrift.I64, 3); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:spanId: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(p.SpanId)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.spanId (3) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 3:spanId: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "spanId", thrift.I64, 3); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:spanId: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(p.SpanId)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.spanId (3) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 3:spanId: ", p), err)
+ }
+ return err
}
func (p *Span) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "parentSpanId", thrift.I64, 4); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:parentSpanId: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(p.ParentSpanId)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.parentSpanId (4) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 4:parentSpanId: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "parentSpanId", thrift.I64, 4); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:parentSpanId: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(p.ParentSpanId)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.parentSpanId (4) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 4:parentSpanId: ", p), err)
+ }
+ return err
}
func (p *Span) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "operationName", thrift.STRING, 5); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:operationName: ", p), err) }
- if err := oprot.WriteString(ctx, string(p.OperationName)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.operationName (5) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 5:operationName: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "operationName", thrift.STRING, 5); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:operationName: ", p), err)
+ }
+ if err := oprot.WriteString(ctx, string(p.OperationName)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.operationName (5) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 5:operationName: ", p), err)
+ }
+ return err
}
func (p *Span) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetReferences() {
- if err := oprot.WriteFieldBegin(ctx, "references", thrift.LIST, 6); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:references: ", p), err) }
- if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.References)); err != nil {
- return thrift.PrependError("error writing list begin: ", err)
- }
- for _, v := range p.References {
- if err := v.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
- }
- }
- if err := oprot.WriteListEnd(ctx); err != nil {
- return thrift.PrependError("error writing list end: ", err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 6:references: ", p), err) }
- }
- return err
+ if p.IsSetReferences() {
+ if err := oprot.WriteFieldBegin(ctx, "references", thrift.LIST, 6); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:references: ", p), err)
+ }
+ if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.References)); err != nil {
+ return thrift.PrependError("error writing list begin: ", err)
+ }
+ for _, v := range p.References {
+ if err := v.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
+ }
+ }
+ if err := oprot.WriteListEnd(ctx); err != nil {
+ return thrift.PrependError("error writing list end: ", err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 6:references: ", p), err)
+ }
+ }
+ return err
}
func (p *Span) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "flags", thrift.I32, 7); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:flags: ", p), err) }
- if err := oprot.WriteI32(ctx, int32(p.Flags)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.flags (7) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 7:flags: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "flags", thrift.I32, 7); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:flags: ", p), err)
+ }
+ if err := oprot.WriteI32(ctx, int32(p.Flags)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.flags (7) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 7:flags: ", p), err)
+ }
+ return err
}
func (p *Span) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "startTime", thrift.I64, 8); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:startTime: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(p.StartTime)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.startTime (8) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 8:startTime: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "startTime", thrift.I64, 8); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:startTime: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(p.StartTime)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.startTime (8) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 8:startTime: ", p), err)
+ }
+ return err
}
func (p *Span) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "duration", thrift.I64, 9); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:duration: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(p.Duration)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.duration (9) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 9:duration: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "duration", thrift.I64, 9); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:duration: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(p.Duration)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.duration (9) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 9:duration: ", p), err)
+ }
+ return err
}
func (p *Span) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetTags() {
- if err := oprot.WriteFieldBegin(ctx, "tags", thrift.LIST, 10); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:tags: ", p), err) }
- if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Tags)); err != nil {
- return thrift.PrependError("error writing list begin: ", err)
- }
- for _, v := range p.Tags {
- if err := v.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
- }
- }
- if err := oprot.WriteListEnd(ctx); err != nil {
- return thrift.PrependError("error writing list end: ", err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 10:tags: ", p), err) }
- }
- return err
+ if p.IsSetTags() {
+ if err := oprot.WriteFieldBegin(ctx, "tags", thrift.LIST, 10); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:tags: ", p), err)
+ }
+ if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Tags)); err != nil {
+ return thrift.PrependError("error writing list begin: ", err)
+ }
+ for _, v := range p.Tags {
+ if err := v.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
+ }
+ }
+ if err := oprot.WriteListEnd(ctx); err != nil {
+ return thrift.PrependError("error writing list end: ", err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 10:tags: ", p), err)
+ }
+ }
+ return err
}
func (p *Span) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetLogs() {
- if err := oprot.WriteFieldBegin(ctx, "logs", thrift.LIST, 11); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:logs: ", p), err) }
- if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Logs)); err != nil {
- return thrift.PrependError("error writing list begin: ", err)
- }
- for _, v := range p.Logs {
- if err := v.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
- }
- }
- if err := oprot.WriteListEnd(ctx); err != nil {
- return thrift.PrependError("error writing list end: ", err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 11:logs: ", p), err) }
- }
- return err
+ if p.IsSetLogs() {
+ if err := oprot.WriteFieldBegin(ctx, "logs", thrift.LIST, 11); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:logs: ", p), err)
+ }
+ if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Logs)); err != nil {
+ return thrift.PrependError("error writing list begin: ", err)
+ }
+ for _, v := range p.Logs {
+ if err := v.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
+ }
+ }
+ if err := oprot.WriteListEnd(ctx); err != nil {
+ return thrift.PrependError("error writing list end: ", err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 11:logs: ", p), err)
+ }
+ }
+ return err
}
func (p *Span) Equals(other *Span) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.TraceIdLow != other.TraceIdLow { return false }
- if p.TraceIdHigh != other.TraceIdHigh { return false }
- if p.SpanId != other.SpanId { return false }
- if p.ParentSpanId != other.ParentSpanId { return false }
- if p.OperationName != other.OperationName { return false }
- if len(p.References) != len(other.References) { return false }
- for i, _tgt := range p.References {
- _src5 := other.References[i]
- if !_tgt.Equals(_src5) { return false }
- }
- if p.Flags != other.Flags { return false }
- if p.StartTime != other.StartTime { return false }
- if p.Duration != other.Duration { return false }
- if len(p.Tags) != len(other.Tags) { return false }
- for i, _tgt := range p.Tags {
- _src6 := other.Tags[i]
- if !_tgt.Equals(_src6) { return false }
- }
- if len(p.Logs) != len(other.Logs) { return false }
- for i, _tgt := range p.Logs {
- _src7 := other.Logs[i]
- if !_tgt.Equals(_src7) { return false }
- }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.TraceIdLow != other.TraceIdLow {
+ return false
+ }
+ if p.TraceIdHigh != other.TraceIdHigh {
+ return false
+ }
+ if p.SpanId != other.SpanId {
+ return false
+ }
+ if p.ParentSpanId != other.ParentSpanId {
+ return false
+ }
+ if p.OperationName != other.OperationName {
+ return false
+ }
+ if len(p.References) != len(other.References) {
+ return false
+ }
+ for i, _tgt := range p.References {
+ _src5 := other.References[i]
+ if !_tgt.Equals(_src5) {
+ return false
+ }
+ }
+ if p.Flags != other.Flags {
+ return false
+ }
+ if p.StartTime != other.StartTime {
+ return false
+ }
+ if p.Duration != other.Duration {
+ return false
+ }
+ if len(p.Tags) != len(other.Tags) {
+ return false
+ }
+ for i, _tgt := range p.Tags {
+ _src6 := other.Tags[i]
+ if !_tgt.Equals(_src6) {
+ return false
+ }
+ }
+ if len(p.Logs) != len(other.Logs) {
+ return false
+ }
+ for i, _tgt := range p.Logs {
+ _src7 := other.Logs[i]
+ if !_tgt.Equals(_src7) {
+ return false
+ }
+ }
+ return true
}
func (p *Span) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("Span(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("Span(%+v)", *p)
}
// Attributes:
-// - ServiceName
-// - Tags
+// - ServiceName
+// - Tags
type Process struct {
- ServiceName string `thrift:"serviceName,1,required" db:"serviceName" json:"serviceName"`
- Tags []*Tag `thrift:"tags,2" db:"tags" json:"tags,omitempty"`
+ ServiceName string `thrift:"serviceName,1,required" db:"serviceName" json:"serviceName"`
+ Tags []*Tag `thrift:"tags,2" db:"tags" json:"tags,omitempty"`
}
func NewProcess() *Process {
- return &Process{}
+ return &Process{}
}
-
func (p *Process) GetServiceName() string {
- return p.ServiceName
+ return p.ServiceName
}
+
var Process_Tags_DEFAULT []*Tag
func (p *Process) GetTags() []*Tag {
- return p.Tags
+ return p.Tags
}
func (p *Process) IsSetTags() bool {
- return p.Tags != nil
+ return p.Tags != nil
}
func (p *Process) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
- var issetServiceName bool = false;
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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(ctx, iprot); err != nil {
- return err
- }
- issetServiceName = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 2:
- if fieldTypeId == thrift.LIST {
- if err := p.ReadField2(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- if !issetServiceName{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ServiceName is not set"));
- }
- return nil
-}
-
-func (p *Process) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadString(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.ServiceName = v
-}
- return nil
-}
-
-func (p *Process) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
- _, size, err := iprot.ReadListBegin(ctx)
- if err != nil {
- return thrift.PrependError("error reading list begin: ", err)
- }
- tSlice := make([]*Tag, 0, size)
- p.Tags = tSlice
- for i := 0; i < size; i ++ {
- _elem8 := &Tag{}
- if err := _elem8.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem8), err)
- }
- p.Tags = append(p.Tags, _elem8)
- }
- if err := iprot.ReadListEnd(ctx); err != nil {
- return thrift.PrependError("error reading list end: ", err)
- }
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ var issetServiceName bool = false
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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(ctx, iprot); err != nil {
+ return err
+ }
+ issetServiceName = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 2:
+ if fieldTypeId == thrift.LIST {
+ if err := p.ReadField2(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ if !issetServiceName {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ServiceName is not set"))
+ }
+ return nil
+}
+
+func (p *Process) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadString(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.ServiceName = v
+ }
+ return nil
+}
+
+func (p *Process) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
+ _, size, err := iprot.ReadListBegin(ctx)
+ if err != nil {
+ return thrift.PrependError("error reading list begin: ", err)
+ }
+ tSlice := make([]*Tag, 0, size)
+ p.Tags = tSlice
+ for i := 0; i < size; i++ {
+ _elem8 := &Tag{}
+ if err := _elem8.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem8), err)
+ }
+ p.Tags = append(p.Tags, _elem8)
+ }
+ if err := iprot.ReadListEnd(ctx); err != nil {
+ return thrift.PrependError("error reading list end: ", err)
+ }
+ return nil
}
func (p *Process) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "Process"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- if err := p.writeField2(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "Process"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField2(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *Process) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "serviceName", thrift.STRING, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:serviceName: ", p), err) }
- if err := oprot.WriteString(ctx, string(p.ServiceName)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.serviceName (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:serviceName: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "serviceName", thrift.STRING, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:serviceName: ", p), err)
+ }
+ if err := oprot.WriteString(ctx, string(p.ServiceName)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.serviceName (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:serviceName: ", p), err)
+ }
+ return err
}
func (p *Process) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetTags() {
- if err := oprot.WriteFieldBegin(ctx, "tags", thrift.LIST, 2); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:tags: ", p), err) }
- if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Tags)); err != nil {
- return thrift.PrependError("error writing list begin: ", err)
- }
- for _, v := range p.Tags {
- if err := v.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
- }
- }
- if err := oprot.WriteListEnd(ctx); err != nil {
- return thrift.PrependError("error writing list end: ", err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 2:tags: ", p), err) }
- }
- return err
+ if p.IsSetTags() {
+ if err := oprot.WriteFieldBegin(ctx, "tags", thrift.LIST, 2); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:tags: ", p), err)
+ }
+ if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Tags)); err != nil {
+ return thrift.PrependError("error writing list begin: ", err)
+ }
+ for _, v := range p.Tags {
+ if err := v.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
+ }
+ }
+ if err := oprot.WriteListEnd(ctx); err != nil {
+ return thrift.PrependError("error writing list end: ", err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 2:tags: ", p), err)
+ }
+ }
+ return err
}
func (p *Process) Equals(other *Process) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.ServiceName != other.ServiceName { return false }
- if len(p.Tags) != len(other.Tags) { return false }
- for i, _tgt := range p.Tags {
- _src9 := other.Tags[i]
- if !_tgt.Equals(_src9) { return false }
- }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.ServiceName != other.ServiceName {
+ return false
+ }
+ if len(p.Tags) != len(other.Tags) {
+ return false
+ }
+ for i, _tgt := range p.Tags {
+ _src9 := other.Tags[i]
+ if !_tgt.Equals(_src9) {
+ return false
+ }
+ }
+ return true
}
func (p *Process) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("Process(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("Process(%+v)", *p)
}
// Attributes:
-// - FullQueueDroppedSpans
-// - TooLargeDroppedSpans
-// - FailedToEmitSpans
+// - FullQueueDroppedSpans
+// - TooLargeDroppedSpans
+// - FailedToEmitSpans
type ClientStats struct {
- FullQueueDroppedSpans int64 `thrift:"fullQueueDroppedSpans,1,required" db:"fullQueueDroppedSpans" json:"fullQueueDroppedSpans"`
- TooLargeDroppedSpans int64 `thrift:"tooLargeDroppedSpans,2,required" db:"tooLargeDroppedSpans" json:"tooLargeDroppedSpans"`
- FailedToEmitSpans int64 `thrift:"failedToEmitSpans,3,required" db:"failedToEmitSpans" json:"failedToEmitSpans"`
+ FullQueueDroppedSpans int64 `thrift:"fullQueueDroppedSpans,1,required" db:"fullQueueDroppedSpans" json:"fullQueueDroppedSpans"`
+ TooLargeDroppedSpans int64 `thrift:"tooLargeDroppedSpans,2,required" db:"tooLargeDroppedSpans" json:"tooLargeDroppedSpans"`
+ FailedToEmitSpans int64 `thrift:"failedToEmitSpans,3,required" db:"failedToEmitSpans" json:"failedToEmitSpans"`
}
func NewClientStats() *ClientStats {
- return &ClientStats{}
+ return &ClientStats{}
}
-
func (p *ClientStats) GetFullQueueDroppedSpans() int64 {
- return p.FullQueueDroppedSpans
+ return p.FullQueueDroppedSpans
}
func (p *ClientStats) GetTooLargeDroppedSpans() int64 {
- return p.TooLargeDroppedSpans
+ return p.TooLargeDroppedSpans
}
func (p *ClientStats) GetFailedToEmitSpans() int64 {
- return p.FailedToEmitSpans
+ return p.FailedToEmitSpans
}
func (p *ClientStats) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
- var issetFullQueueDroppedSpans bool = false;
- var issetTooLargeDroppedSpans bool = false;
- var issetFailedToEmitSpans bool = false;
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.I64 {
- if err := p.ReadField1(ctx, iprot); err != nil {
- return err
- }
- issetFullQueueDroppedSpans = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 2:
- if fieldTypeId == thrift.I64 {
- if err := p.ReadField2(ctx, iprot); err != nil {
- return err
- }
- issetTooLargeDroppedSpans = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 3:
- if fieldTypeId == thrift.I64 {
- if err := p.ReadField3(ctx, iprot); err != nil {
- return err
- }
- issetFailedToEmitSpans = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- if !issetFullQueueDroppedSpans{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field FullQueueDroppedSpans is not set"));
- }
- if !issetTooLargeDroppedSpans{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TooLargeDroppedSpans is not set"));
- }
- if !issetFailedToEmitSpans{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field FailedToEmitSpans is not set"));
- }
- return nil
-}
-
-func (p *ClientStats) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.FullQueueDroppedSpans = v
-}
- return nil
-}
-
-func (p *ClientStats) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 2: ", err)
-} else {
- p.TooLargeDroppedSpans = v
-}
- return nil
-}
-
-func (p *ClientStats) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 3: ", err)
-} else {
- p.FailedToEmitSpans = v
-}
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ var issetFullQueueDroppedSpans bool = false
+ var issetTooLargeDroppedSpans bool = false
+ var issetFailedToEmitSpans bool = false
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.I64 {
+ if err := p.ReadField1(ctx, iprot); err != nil {
+ return err
+ }
+ issetFullQueueDroppedSpans = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 2:
+ if fieldTypeId == thrift.I64 {
+ if err := p.ReadField2(ctx, iprot); err != nil {
+ return err
+ }
+ issetTooLargeDroppedSpans = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 3:
+ if fieldTypeId == thrift.I64 {
+ if err := p.ReadField3(ctx, iprot); err != nil {
+ return err
+ }
+ issetFailedToEmitSpans = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ if !issetFullQueueDroppedSpans {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field FullQueueDroppedSpans is not set"))
+ }
+ if !issetTooLargeDroppedSpans {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TooLargeDroppedSpans is not set"))
+ }
+ if !issetFailedToEmitSpans {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field FailedToEmitSpans is not set"))
+ }
+ return nil
+}
+
+func (p *ClientStats) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.FullQueueDroppedSpans = v
+ }
+ return nil
+}
+
+func (p *ClientStats) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 2: ", err)
+ } else {
+ p.TooLargeDroppedSpans = v
+ }
+ return nil
+}
+
+func (p *ClientStats) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 3: ", err)
+ } else {
+ p.FailedToEmitSpans = v
+ }
+ return nil
}
func (p *ClientStats) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "ClientStats"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- if err := p.writeField2(ctx, oprot); err != nil { return err }
- if err := p.writeField3(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "ClientStats"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField2(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField3(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *ClientStats) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "fullQueueDroppedSpans", thrift.I64, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:fullQueueDroppedSpans: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(p.FullQueueDroppedSpans)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.fullQueueDroppedSpans (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:fullQueueDroppedSpans: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "fullQueueDroppedSpans", thrift.I64, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:fullQueueDroppedSpans: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(p.FullQueueDroppedSpans)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.fullQueueDroppedSpans (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:fullQueueDroppedSpans: ", p), err)
+ }
+ return err
}
func (p *ClientStats) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "tooLargeDroppedSpans", thrift.I64, 2); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:tooLargeDroppedSpans: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(p.TooLargeDroppedSpans)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.tooLargeDroppedSpans (2) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 2:tooLargeDroppedSpans: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "tooLargeDroppedSpans", thrift.I64, 2); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:tooLargeDroppedSpans: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(p.TooLargeDroppedSpans)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.tooLargeDroppedSpans (2) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 2:tooLargeDroppedSpans: ", p), err)
+ }
+ return err
}
func (p *ClientStats) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "failedToEmitSpans", thrift.I64, 3); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:failedToEmitSpans: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(p.FailedToEmitSpans)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.failedToEmitSpans (3) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 3:failedToEmitSpans: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "failedToEmitSpans", thrift.I64, 3); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:failedToEmitSpans: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(p.FailedToEmitSpans)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.failedToEmitSpans (3) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 3:failedToEmitSpans: ", p), err)
+ }
+ return err
}
func (p *ClientStats) Equals(other *ClientStats) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.FullQueueDroppedSpans != other.FullQueueDroppedSpans { return false }
- if p.TooLargeDroppedSpans != other.TooLargeDroppedSpans { return false }
- if p.FailedToEmitSpans != other.FailedToEmitSpans { return false }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.FullQueueDroppedSpans != other.FullQueueDroppedSpans {
+ return false
+ }
+ if p.TooLargeDroppedSpans != other.TooLargeDroppedSpans {
+ return false
+ }
+ if p.FailedToEmitSpans != other.FailedToEmitSpans {
+ return false
+ }
+ return true
}
func (p *ClientStats) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("ClientStats(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("ClientStats(%+v)", *p)
}
// Attributes:
-// - Process
-// - Spans
-// - SeqNo
-// - Stats
+// - Process
+// - Spans
+// - SeqNo
+// - Stats
type Batch struct {
- Process *Process `thrift:"process,1,required" db:"process" json:"process"`
- Spans []*Span `thrift:"spans,2,required" db:"spans" json:"spans"`
- SeqNo *int64 `thrift:"seqNo,3" db:"seqNo" json:"seqNo,omitempty"`
- Stats *ClientStats `thrift:"stats,4" db:"stats" json:"stats,omitempty"`
+ Process *Process `thrift:"process,1,required" db:"process" json:"process"`
+ Spans []*Span `thrift:"spans,2,required" db:"spans" json:"spans"`
+ SeqNo *int64 `thrift:"seqNo,3" db:"seqNo" json:"seqNo,omitempty"`
+ Stats *ClientStats `thrift:"stats,4" db:"stats" json:"stats,omitempty"`
}
func NewBatch() *Batch {
- return &Batch{}
+ return &Batch{}
}
var Batch_Process_DEFAULT *Process
+
func (p *Batch) GetProcess() *Process {
- if !p.IsSetProcess() {
- return Batch_Process_DEFAULT
- }
-return p.Process
+ if !p.IsSetProcess() {
+ return Batch_Process_DEFAULT
+ }
+ return p.Process
}
func (p *Batch) GetSpans() []*Span {
- return p.Spans
+ return p.Spans
}
+
var Batch_SeqNo_DEFAULT int64
+
func (p *Batch) GetSeqNo() int64 {
- if !p.IsSetSeqNo() {
- return Batch_SeqNo_DEFAULT
- }
-return *p.SeqNo
+ if !p.IsSetSeqNo() {
+ return Batch_SeqNo_DEFAULT
+ }
+ return *p.SeqNo
}
+
var Batch_Stats_DEFAULT *ClientStats
+
func (p *Batch) GetStats() *ClientStats {
- if !p.IsSetStats() {
- return Batch_Stats_DEFAULT
- }
-return p.Stats
+ if !p.IsSetStats() {
+ return Batch_Stats_DEFAULT
+ }
+ return p.Stats
}
func (p *Batch) IsSetProcess() bool {
- return p.Process != nil
+ return p.Process != nil
}
func (p *Batch) IsSetSeqNo() bool {
- return p.SeqNo != nil
+ return p.SeqNo != nil
}
func (p *Batch) IsSetStats() bool {
- return p.Stats != nil
+ return p.Stats != nil
}
func (p *Batch) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
- var issetProcess bool = false;
- var issetSpans bool = false;
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.STRUCT {
- if err := p.ReadField1(ctx, iprot); err != nil {
- return err
- }
- issetProcess = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 2:
- if fieldTypeId == thrift.LIST {
- if err := p.ReadField2(ctx, iprot); err != nil {
- return err
- }
- issetSpans = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 3:
- if fieldTypeId == thrift.I64 {
- if err := p.ReadField3(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 4:
- if fieldTypeId == thrift.STRUCT {
- if err := p.ReadField4(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- if !issetProcess{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Process is not set"));
- }
- if !issetSpans{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Spans is not set"));
- }
- return nil
-}
-
-func (p *Batch) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- p.Process = &Process{}
- if err := p.Process.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Process), err)
- }
- return nil
-}
-
-func (p *Batch) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
- _, size, err := iprot.ReadListBegin(ctx)
- if err != nil {
- return thrift.PrependError("error reading list begin: ", err)
- }
- tSlice := make([]*Span, 0, size)
- p.Spans = tSlice
- for i := 0; i < size; i ++ {
- _elem10 := &Span{}
- if err := _elem10.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem10), err)
- }
- p.Spans = append(p.Spans, _elem10)
- }
- if err := iprot.ReadListEnd(ctx); err != nil {
- return thrift.PrependError("error reading list end: ", err)
- }
- return nil
-}
-
-func (p *Batch) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 3: ", err)
-} else {
- p.SeqNo = &v
-}
- return nil
-}
-
-func (p *Batch) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
- p.Stats = &ClientStats{}
- if err := p.Stats.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Stats), err)
- }
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ var issetProcess bool = false
+ var issetSpans bool = false
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.STRUCT {
+ if err := p.ReadField1(ctx, iprot); err != nil {
+ return err
+ }
+ issetProcess = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 2:
+ if fieldTypeId == thrift.LIST {
+ if err := p.ReadField2(ctx, iprot); err != nil {
+ return err
+ }
+ issetSpans = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 3:
+ if fieldTypeId == thrift.I64 {
+ if err := p.ReadField3(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 4:
+ if fieldTypeId == thrift.STRUCT {
+ if err := p.ReadField4(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ if !issetProcess {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Process is not set"))
+ }
+ if !issetSpans {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Spans is not set"))
+ }
+ return nil
+}
+
+func (p *Batch) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ p.Process = &Process{}
+ if err := p.Process.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Process), err)
+ }
+ return nil
+}
+
+func (p *Batch) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
+ _, size, err := iprot.ReadListBegin(ctx)
+ if err != nil {
+ return thrift.PrependError("error reading list begin: ", err)
+ }
+ tSlice := make([]*Span, 0, size)
+ p.Spans = tSlice
+ for i := 0; i < size; i++ {
+ _elem10 := &Span{}
+ if err := _elem10.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem10), err)
+ }
+ p.Spans = append(p.Spans, _elem10)
+ }
+ if err := iprot.ReadListEnd(ctx); err != nil {
+ return thrift.PrependError("error reading list end: ", err)
+ }
+ return nil
+}
+
+func (p *Batch) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 3: ", err)
+ } else {
+ p.SeqNo = &v
+ }
+ return nil
+}
+
+func (p *Batch) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
+ p.Stats = &ClientStats{}
+ if err := p.Stats.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Stats), err)
+ }
+ return nil
}
func (p *Batch) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "Batch"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- if err := p.writeField2(ctx, oprot); err != nil { return err }
- if err := p.writeField3(ctx, oprot); err != nil { return err }
- if err := p.writeField4(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "Batch"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField2(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField3(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField4(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *Batch) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "process", thrift.STRUCT, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:process: ", p), err) }
- if err := p.Process.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Process), err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:process: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "process", thrift.STRUCT, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:process: ", p), err)
+ }
+ if err := p.Process.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Process), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:process: ", p), err)
+ }
+ return err
}
func (p *Batch) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "spans", thrift.LIST, 2); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:spans: ", p), err) }
- if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Spans)); err != nil {
- return thrift.PrependError("error writing list begin: ", err)
- }
- for _, v := range p.Spans {
- if err := v.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
- }
- }
- if err := oprot.WriteListEnd(ctx); err != nil {
- return thrift.PrependError("error writing list end: ", err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 2:spans: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "spans", thrift.LIST, 2); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:spans: ", p), err)
+ }
+ if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Spans)); err != nil {
+ return thrift.PrependError("error writing list begin: ", err)
+ }
+ for _, v := range p.Spans {
+ if err := v.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
+ }
+ }
+ if err := oprot.WriteListEnd(ctx); err != nil {
+ return thrift.PrependError("error writing list end: ", err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 2:spans: ", p), err)
+ }
+ return err
}
func (p *Batch) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetSeqNo() {
- if err := oprot.WriteFieldBegin(ctx, "seqNo", thrift.I64, 3); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:seqNo: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(*p.SeqNo)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.seqNo (3) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 3:seqNo: ", p), err) }
- }
- return err
+ if p.IsSetSeqNo() {
+ if err := oprot.WriteFieldBegin(ctx, "seqNo", thrift.I64, 3); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:seqNo: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(*p.SeqNo)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.seqNo (3) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 3:seqNo: ", p), err)
+ }
+ }
+ return err
}
func (p *Batch) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetStats() {
- if err := oprot.WriteFieldBegin(ctx, "stats", thrift.STRUCT, 4); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:stats: ", p), err) }
- if err := p.Stats.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Stats), err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 4:stats: ", p), err) }
- }
- return err
+ if p.IsSetStats() {
+ if err := oprot.WriteFieldBegin(ctx, "stats", thrift.STRUCT, 4); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:stats: ", p), err)
+ }
+ if err := p.Stats.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Stats), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 4:stats: ", p), err)
+ }
+ }
+ return err
}
func (p *Batch) Equals(other *Batch) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if !p.Process.Equals(other.Process) { return false }
- if len(p.Spans) != len(other.Spans) { return false }
- for i, _tgt := range p.Spans {
- _src11 := other.Spans[i]
- if !_tgt.Equals(_src11) { return false }
- }
- if p.SeqNo != other.SeqNo {
- if p.SeqNo == nil || other.SeqNo == nil {
- return false
- }
- if (*p.SeqNo) != (*other.SeqNo) { return false }
- }
- if !p.Stats.Equals(other.Stats) { return false }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if !p.Process.Equals(other.Process) {
+ return false
+ }
+ if len(p.Spans) != len(other.Spans) {
+ return false
+ }
+ for i, _tgt := range p.Spans {
+ _src11 := other.Spans[i]
+ if !_tgt.Equals(_src11) {
+ return false
+ }
+ }
+ if p.SeqNo != other.SeqNo {
+ if p.SeqNo == nil || other.SeqNo == nil {
+ return false
+ }
+ if (*p.SeqNo) != (*other.SeqNo) {
+ return false
+ }
+ }
+ if !p.Stats.Equals(other.Stats) {
+ return false
+ }
+ return true
}
func (p *Batch) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("Batch(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("Batch(%+v)", *p)
}
// Attributes:
-// - Ok
+// - Ok
type BatchSubmitResponse struct {
- Ok bool `thrift:"ok,1,required" db:"ok" json:"ok"`
+ Ok bool `thrift:"ok,1,required" db:"ok" json:"ok"`
}
func NewBatchSubmitResponse() *BatchSubmitResponse {
- return &BatchSubmitResponse{}
+ return &BatchSubmitResponse{}
}
-
func (p *BatchSubmitResponse) GetOk() bool {
- return p.Ok
+ return p.Ok
}
func (p *BatchSubmitResponse) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
- var issetOk bool = false;
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.BOOL {
- if err := p.ReadField1(ctx, iprot); err != nil {
- return err
- }
- issetOk = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- if !issetOk{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Ok is not set"));
- }
- return nil
-}
-
-func (p *BatchSubmitResponse) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadBool(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.Ok = v
-}
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ var issetOk bool = false
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.BOOL {
+ if err := p.ReadField1(ctx, iprot); err != nil {
+ return err
+ }
+ issetOk = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ if !issetOk {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Ok is not set"))
+ }
+ return nil
+}
+
+func (p *BatchSubmitResponse) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadBool(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.Ok = v
+ }
+ return nil
}
func (p *BatchSubmitResponse) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "BatchSubmitResponse"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "BatchSubmitResponse"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *BatchSubmitResponse) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "ok", thrift.BOOL, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ok: ", p), err) }
- if err := oprot.WriteBool(ctx, bool(p.Ok)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.ok (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ok: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "ok", thrift.BOOL, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ok: ", p), err)
+ }
+ if err := oprot.WriteBool(ctx, bool(p.Ok)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.ok (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ok: ", p), err)
+ }
+ return err
}
func (p *BatchSubmitResponse) Equals(other *BatchSubmitResponse) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.Ok != other.Ok { return false }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.Ok != other.Ok {
+ return false
+ }
+ return true
}
func (p *BatchSubmitResponse) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("BatchSubmitResponse(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("BatchSubmitResponse(%+v)", *p)
}
type Collector interface {
- // Parameters:
- // - Batches
- SubmitBatches(ctx context.Context, batches []*Batch) (_r []*BatchSubmitResponse, _err error)
+ // Parameters:
+ // - Batches
+ SubmitBatches(ctx context.Context, batches []*Batch) (_r []*BatchSubmitResponse, _err error)
}
type CollectorClient struct {
- c thrift.TClient
- meta thrift.ResponseMeta
+ c thrift.TClient
+ meta thrift.ResponseMeta
}
func NewCollectorClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *CollectorClient {
- return &CollectorClient{
- c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
- }
+ return &CollectorClient{
+ c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
+ }
}
func NewCollectorClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *CollectorClient {
- return &CollectorClient{
- c: thrift.NewTStandardClient(iprot, oprot),
- }
+ return &CollectorClient{
+ c: thrift.NewTStandardClient(iprot, oprot),
+ }
}
func NewCollectorClient(c thrift.TClient) *CollectorClient {
- return &CollectorClient{
- c: c,
- }
+ return &CollectorClient{
+ c: c,
+ }
}
func (p *CollectorClient) Client_() thrift.TClient {
- return p.c
+ return p.c
}
func (p *CollectorClient) LastResponseMeta_() thrift.ResponseMeta {
- return p.meta
+ return p.meta
}
func (p *CollectorClient) SetLastResponseMeta_(meta thrift.ResponseMeta) {
- p.meta = meta
+ p.meta = meta
}
// Parameters:
-// - Batches
+// - Batches
func (p *CollectorClient) SubmitBatches(ctx context.Context, batches []*Batch) (_r []*BatchSubmitResponse, _err error) {
- var _args12 CollectorSubmitBatchesArgs
- _args12.Batches = batches
- var _result14 CollectorSubmitBatchesResult
- var _meta13 thrift.ResponseMeta
- _meta13, _err = p.Client_().Call(ctx, "submitBatches", &_args12, &_result14)
- p.SetLastResponseMeta_(_meta13)
- if _err != nil {
- return
- }
- return _result14.GetSuccess(), nil
+ var _args12 CollectorSubmitBatchesArgs
+ _args12.Batches = batches
+ var _result14 CollectorSubmitBatchesResult
+ var _meta13 thrift.ResponseMeta
+ _meta13, _err = p.Client_().Call(ctx, "submitBatches", &_args12, &_result14)
+ p.SetLastResponseMeta_(_meta13)
+ if _err != nil {
+ return
+ }
+ return _result14.GetSuccess(), nil
}
type CollectorProcessor struct {
- processorMap map[string]thrift.TProcessorFunction
- handler Collector
+ processorMap map[string]thrift.TProcessorFunction
+ handler Collector
}
func (p *CollectorProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
- p.processorMap[key] = processor
+ p.processorMap[key] = processor
}
func (p *CollectorProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
- processor, ok = p.processorMap[key]
- return processor, ok
+ processor, ok = p.processorMap[key]
+ return processor, ok
}
func (p *CollectorProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
- return p.processorMap
+ return p.processorMap
}
func NewCollectorProcessor(handler Collector) *CollectorProcessor {
- self15 := &CollectorProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)}
- self15.processorMap["submitBatches"] = &collectorProcessorSubmitBatches{handler:handler}
-return self15
+ self15 := &CollectorProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
+ self15.processorMap["submitBatches"] = &collectorProcessorSubmitBatches{handler: handler}
+ return self15
}
func (p *CollectorProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
- name, _, seqId, err2 := iprot.ReadMessageBegin(ctx)
- if err2 != nil { return false, thrift.WrapTException(err2) }
- if processor, ok := p.GetProcessorFunction(name); ok {
- return processor.Process(ctx, seqId, iprot, oprot)
- }
- iprot.Skip(ctx, thrift.STRUCT)
- iprot.ReadMessageEnd(ctx)
- x16 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name)
- oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId)
- x16.Write(ctx, oprot)
- oprot.WriteMessageEnd(ctx)
- oprot.Flush(ctx)
- return false, x16
+ name, _, seqId, err2 := iprot.ReadMessageBegin(ctx)
+ if err2 != nil {
+ return false, thrift.WrapTException(err2)
+ }
+ if processor, ok := p.GetProcessorFunction(name); ok {
+ return processor.Process(ctx, seqId, iprot, oprot)
+ }
+ iprot.Skip(ctx, thrift.STRUCT)
+ iprot.ReadMessageEnd(ctx)
+ x16 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
+ oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId)
+ x16.Write(ctx, oprot)
+ oprot.WriteMessageEnd(ctx)
+ oprot.Flush(ctx)
+ return false, x16
}
type collectorProcessorSubmitBatches struct {
- handler Collector
+ handler Collector
}
func (p *collectorProcessorSubmitBatches) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
- args := CollectorSubmitBatchesArgs{}
- var err2 error
- if err2 = args.Read(ctx, iprot); err2 != nil {
- iprot.ReadMessageEnd(ctx)
- x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
- oprot.WriteMessageBegin(ctx, "submitBatches", thrift.EXCEPTION, seqId)
- x.Write(ctx, oprot)
- oprot.WriteMessageEnd(ctx)
- oprot.Flush(ctx)
- return false, thrift.WrapTException(err2)
- }
- iprot.ReadMessageEnd(ctx)
-
- tickerCancel := func() {}
- // Start a goroutine to do server side connectivity check.
- if thrift.ServerConnectivityCheckInterval > 0 {
- var cancel context.CancelFunc
- ctx, cancel = context.WithCancel(ctx)
- defer cancel()
- var tickerCtx context.Context
- tickerCtx, tickerCancel = context.WithCancel(context.Background())
- defer tickerCancel()
- go func(ctx context.Context, cancel context.CancelFunc) {
- ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
- defer ticker.Stop()
- for {
- select {
- case <-ctx.Done():
- return
- case <-ticker.C:
- if !iprot.Transport().IsOpen() {
- cancel()
- return
- }
- }
- }
- }(tickerCtx, cancel)
- }
-
- result := CollectorSubmitBatchesResult{}
- var retval []*BatchSubmitResponse
- if retval, err2 = p.handler.SubmitBatches(ctx, args.Batches); err2 != nil {
- tickerCancel()
- if err2 == thrift.ErrAbandonRequest {
- return false, thrift.WrapTException(err2)
- }
- x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing submitBatches: " + err2.Error())
- oprot.WriteMessageBegin(ctx, "submitBatches", thrift.EXCEPTION, seqId)
- x.Write(ctx, oprot)
- oprot.WriteMessageEnd(ctx)
- oprot.Flush(ctx)
- return true, thrift.WrapTException(err2)
- } else {
- result.Success = retval
- }
- tickerCancel()
- if err2 = oprot.WriteMessageBegin(ctx, "submitBatches", thrift.REPLY, seqId); err2 != nil {
- err = thrift.WrapTException(err2)
- }
- if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
- err = thrift.WrapTException(err2)
- }
- if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
- err = thrift.WrapTException(err2)
- }
- if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
- err = thrift.WrapTException(err2)
- }
- if err != nil {
- return
- }
- return true, err
+ args := CollectorSubmitBatchesArgs{}
+ var err2 error
+ if err2 = args.Read(ctx, iprot); err2 != nil {
+ iprot.ReadMessageEnd(ctx)
+ x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
+ oprot.WriteMessageBegin(ctx, "submitBatches", thrift.EXCEPTION, seqId)
+ x.Write(ctx, oprot)
+ oprot.WriteMessageEnd(ctx)
+ oprot.Flush(ctx)
+ return false, thrift.WrapTException(err2)
+ }
+ iprot.ReadMessageEnd(ctx)
+
+ tickerCancel := func() {}
+ // Start a goroutine to do server side connectivity check.
+ if thrift.ServerConnectivityCheckInterval > 0 {
+ var cancel context.CancelFunc
+ ctx, cancel = context.WithCancel(ctx)
+ defer cancel()
+ var tickerCtx context.Context
+ tickerCtx, tickerCancel = context.WithCancel(context.Background())
+ defer tickerCancel()
+ go func(ctx context.Context, cancel context.CancelFunc) {
+ ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
+ defer ticker.Stop()
+ for {
+ select {
+ case <-ctx.Done():
+ return
+ case <-ticker.C:
+ if !iprot.Transport().IsOpen() {
+ cancel()
+ return
+ }
+ }
+ }
+ }(tickerCtx, cancel)
+ }
+
+ result := CollectorSubmitBatchesResult{}
+ var retval []*BatchSubmitResponse
+ if retval, err2 = p.handler.SubmitBatches(ctx, args.Batches); err2 != nil {
+ tickerCancel()
+ if err2 == thrift.ErrAbandonRequest {
+ return false, thrift.WrapTException(err2)
+ }
+ x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing submitBatches: "+err2.Error())
+ oprot.WriteMessageBegin(ctx, "submitBatches", thrift.EXCEPTION, seqId)
+ x.Write(ctx, oprot)
+ oprot.WriteMessageEnd(ctx)
+ oprot.Flush(ctx)
+ return true, thrift.WrapTException(err2)
+ } else {
+ result.Success = retval
+ }
+ tickerCancel()
+ if err2 = oprot.WriteMessageBegin(ctx, "submitBatches", thrift.REPLY, seqId); err2 != nil {
+ err = thrift.WrapTException(err2)
+ }
+ if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
+ err = thrift.WrapTException(err2)
+ }
+ if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
+ err = thrift.WrapTException(err2)
+ }
+ if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
+ err = thrift.WrapTException(err2)
+ }
+ if err != nil {
+ return
+ }
+ return true, err
}
-
// HELPER FUNCTIONS AND STRUCTURES
// Attributes:
-// - Batches
+// - Batches
type CollectorSubmitBatchesArgs struct {
- Batches []*Batch `thrift:"batches,1" db:"batches" json:"batches"`
+ Batches []*Batch `thrift:"batches,1" db:"batches" json:"batches"`
}
func NewCollectorSubmitBatchesArgs() *CollectorSubmitBatchesArgs {
- return &CollectorSubmitBatchesArgs{}
+ return &CollectorSubmitBatchesArgs{}
}
-
func (p *CollectorSubmitBatchesArgs) GetBatches() []*Batch {
- return p.Batches
+ return p.Batches
}
func (p *CollectorSubmitBatchesArgs) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- return nil
-}
-
-func (p *CollectorSubmitBatchesArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- _, size, err := iprot.ReadListBegin(ctx)
- if err != nil {
- return thrift.PrependError("error reading list begin: ", err)
- }
- tSlice := make([]*Batch, 0, size)
- p.Batches = tSlice
- for i := 0; i < size; i ++ {
- _elem17 := &Batch{}
- if err := _elem17.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem17), err)
- }
- p.Batches = append(p.Batches, _elem17)
- }
- if err := iprot.ReadListEnd(ctx); err != nil {
- return thrift.PrependError("error reading list end: ", err)
- }
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ return nil
+}
+
+func (p *CollectorSubmitBatchesArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ _, size, err := iprot.ReadListBegin(ctx)
+ if err != nil {
+ return thrift.PrependError("error reading list begin: ", err)
+ }
+ tSlice := make([]*Batch, 0, size)
+ p.Batches = tSlice
+ for i := 0; i < size; i++ {
+ _elem17 := &Batch{}
+ if err := _elem17.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem17), err)
+ }
+ p.Batches = append(p.Batches, _elem17)
+ }
+ if err := iprot.ReadListEnd(ctx); err != nil {
+ return thrift.PrependError("error reading list end: ", err)
+ }
+ return nil
}
func (p *CollectorSubmitBatchesArgs) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "submitBatches_args"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "submitBatches_args"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *CollectorSubmitBatchesArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "batches", thrift.LIST, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:batches: ", p), err) }
- if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Batches)); err != nil {
- return thrift.PrependError("error writing list begin: ", err)
- }
- for _, v := range p.Batches {
- if err := v.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
- }
- }
- if err := oprot.WriteListEnd(ctx); err != nil {
- return thrift.PrependError("error writing list end: ", err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:batches: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "batches", thrift.LIST, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:batches: ", p), err)
+ }
+ if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Batches)); err != nil {
+ return thrift.PrependError("error writing list begin: ", err)
+ }
+ for _, v := range p.Batches {
+ if err := v.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
+ }
+ }
+ if err := oprot.WriteListEnd(ctx); err != nil {
+ return thrift.PrependError("error writing list end: ", err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:batches: ", p), err)
+ }
+ return err
}
func (p *CollectorSubmitBatchesArgs) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("CollectorSubmitBatchesArgs(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("CollectorSubmitBatchesArgs(%+v)", *p)
}
// Attributes:
-// - Success
+// - Success
type CollectorSubmitBatchesResult struct {
- Success []*BatchSubmitResponse `thrift:"success,0" db:"success" json:"success,omitempty"`
+ Success []*BatchSubmitResponse `thrift:"success,0" db:"success" json:"success,omitempty"`
}
func NewCollectorSubmitBatchesResult() *CollectorSubmitBatchesResult {
- return &CollectorSubmitBatchesResult{}
+ return &CollectorSubmitBatchesResult{}
}
var CollectorSubmitBatchesResult_Success_DEFAULT []*BatchSubmitResponse
func (p *CollectorSubmitBatchesResult) GetSuccess() []*BatchSubmitResponse {
- return p.Success
+ return p.Success
}
func (p *CollectorSubmitBatchesResult) IsSetSuccess() bool {
- return p.Success != nil
+ return p.Success != nil
}
func (p *CollectorSubmitBatchesResult) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.LIST {
- if err := p.ReadField0(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- return nil
-}
-
-func (p *CollectorSubmitBatchesResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
- _, size, err := iprot.ReadListBegin(ctx)
- if err != nil {
- return thrift.PrependError("error reading list begin: ", err)
- }
- tSlice := make([]*BatchSubmitResponse, 0, size)
- p.Success = tSlice
- for i := 0; i < size; i ++ {
- _elem18 := &BatchSubmitResponse{}
- if err := _elem18.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem18), err)
- }
- p.Success = append(p.Success, _elem18)
- }
- if err := iprot.ReadListEnd(ctx); err != nil {
- return thrift.PrependError("error reading list end: ", err)
- }
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.LIST {
+ if err := p.ReadField0(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ return nil
+}
+
+func (p *CollectorSubmitBatchesResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
+ _, size, err := iprot.ReadListBegin(ctx)
+ if err != nil {
+ return thrift.PrependError("error reading list begin: ", err)
+ }
+ tSlice := make([]*BatchSubmitResponse, 0, size)
+ p.Success = tSlice
+ for i := 0; i < size; i++ {
+ _elem18 := &BatchSubmitResponse{}
+ if err := _elem18.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem18), err)
+ }
+ p.Success = append(p.Success, _elem18)
+ }
+ if err := iprot.ReadListEnd(ctx); err != nil {
+ return thrift.PrependError("error reading list end: ", err)
+ }
+ return nil
}
func (p *CollectorSubmitBatchesResult) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "submitBatches_result"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField0(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "submitBatches_result"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField0(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *CollectorSubmitBatchesResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetSuccess() {
- if err := oprot.WriteFieldBegin(ctx, "success", thrift.LIST, 0); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
- if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Success)); err != nil {
- return thrift.PrependError("error writing list begin: ", err)
- }
- for _, v := range p.Success {
- if err := v.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
- }
- }
- if err := oprot.WriteListEnd(ctx); err != nil {
- return thrift.PrependError("error writing list end: ", err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
- }
- return err
+ if p.IsSetSuccess() {
+ if err := oprot.WriteFieldBegin(ctx, "success", thrift.LIST, 0); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
+ }
+ if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Success)); err != nil {
+ return thrift.PrependError("error writing list begin: ", err)
+ }
+ for _, v := range p.Success {
+ if err := v.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
+ }
+ }
+ if err := oprot.WriteListEnd(ctx); err != nil {
+ return thrift.PrependError("error writing list end: ", err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
+ }
+ }
+ return err
}
func (p *CollectorSubmitBatchesResult) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("CollectorSubmitBatchesResult(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("CollectorSubmitBatchesResult(%+v)", *p)
}
-
-
diff --git a/thrift-gen/sampling/GoUnusedProtection__.go b/thrift-gen/sampling/GoUnusedProtection__.go
index 015ad4b0674..47d051cd17d 100644
--- a/thrift-gen/sampling/GoUnusedProtection__.go
+++ b/thrift-gen/sampling/GoUnusedProtection__.go
@@ -2,5 +2,4 @@
package sampling
-var GoUnusedProtection__ int;
-
+var GoUnusedProtection__ int
diff --git a/thrift-gen/sampling/sampling-consts.go b/thrift-gen/sampling/sampling-consts.go
index 9899b278c72..ad3a4282994 100644
--- a/thrift-gen/sampling/sampling-consts.go
+++ b/thrift-gen/sampling/sampling-consts.go
@@ -2,12 +2,12 @@
package sampling
-import(
+import (
"bytes"
"context"
"fmt"
- "time"
"github.com/apache/thrift/lib/go/thrift"
+ "time"
)
// (needed to ensure safety because of naive import list construction.)
@@ -17,7 +17,5 @@ var _ = context.Background
var _ = time.Now
var _ = bytes.Equal
-
func init() {
}
-
diff --git a/thrift-gen/sampling/sampling.go b/thrift-gen/sampling/sampling.go
index f251540656d..12e6c5e637d 100644
--- a/thrift-gen/sampling/sampling.go
+++ b/thrift-gen/sampling/sampling.go
@@ -2,14 +2,14 @@
package sampling
-import(
+import (
"bytes"
"context"
"database/sql/driver"
"errors"
"fmt"
- "time"
"github.com/apache/thrift/lib/go/thrift"
+ "time"
)
// (needed to ensure safety because of naive import list construction.)
@@ -20,1304 +20,1436 @@ var _ = time.Now
var _ = bytes.Equal
type SamplingStrategyType int64
+
const (
- SamplingStrategyType_PROBABILISTIC SamplingStrategyType = 0
- SamplingStrategyType_RATE_LIMITING SamplingStrategyType = 1
+ SamplingStrategyType_PROBABILISTIC SamplingStrategyType = 0
+ SamplingStrategyType_RATE_LIMITING SamplingStrategyType = 1
)
func (p SamplingStrategyType) String() string {
- switch p {
- case SamplingStrategyType_PROBABILISTIC: return "PROBABILISTIC"
- case SamplingStrategyType_RATE_LIMITING: return "RATE_LIMITING"
- }
- return ""
+ switch p {
+ case SamplingStrategyType_PROBABILISTIC:
+ return "PROBABILISTIC"
+ case SamplingStrategyType_RATE_LIMITING:
+ return "RATE_LIMITING"
+ }
+ return ""
}
func SamplingStrategyTypeFromString(s string) (SamplingStrategyType, error) {
- switch s {
- case "PROBABILISTIC": return SamplingStrategyType_PROBABILISTIC, nil
- case "RATE_LIMITING": return SamplingStrategyType_RATE_LIMITING, nil
- }
- return SamplingStrategyType(0), fmt.Errorf("not a valid SamplingStrategyType string")
+ switch s {
+ case "PROBABILISTIC":
+ return SamplingStrategyType_PROBABILISTIC, nil
+ case "RATE_LIMITING":
+ return SamplingStrategyType_RATE_LIMITING, nil
+ }
+ return SamplingStrategyType(0), fmt.Errorf("not a valid SamplingStrategyType string")
}
-
func SamplingStrategyTypePtr(v SamplingStrategyType) *SamplingStrategyType { return &v }
func (p SamplingStrategyType) MarshalText() ([]byte, error) {
-return []byte(p.String()), nil
+ return []byte(p.String()), nil
}
func (p *SamplingStrategyType) UnmarshalText(text []byte) error {
-q, err := SamplingStrategyTypeFromString(string(text))
-if (err != nil) {
-return err
-}
-*p = q
-return nil
+ q, err := SamplingStrategyTypeFromString(string(text))
+ if err != nil {
+ return err
+ }
+ *p = q
+ return nil
}
func (p *SamplingStrategyType) Scan(value interface{}) error {
-v, ok := value.(int64)
-if !ok {
-return errors.New("Scan value is not int64")
-}
-*p = SamplingStrategyType(v)
-return nil
+ v, ok := value.(int64)
+ if !ok {
+ return errors.New("Scan value is not int64")
+ }
+ *p = SamplingStrategyType(v)
+ return nil
}
-func (p * SamplingStrategyType) Value() (driver.Value, error) {
- if p == nil {
- return nil, nil
- }
-return int64(*p), nil
+func (p *SamplingStrategyType) Value() (driver.Value, error) {
+ if p == nil {
+ return nil, nil
+ }
+ return int64(*p), nil
}
+
// Attributes:
-// - SamplingRate
+// - SamplingRate
type ProbabilisticSamplingStrategy struct {
- SamplingRate float64 `thrift:"samplingRate,1,required" db:"samplingRate" json:"samplingRate"`
+ SamplingRate float64 `thrift:"samplingRate,1,required" db:"samplingRate" json:"samplingRate"`
}
func NewProbabilisticSamplingStrategy() *ProbabilisticSamplingStrategy {
- return &ProbabilisticSamplingStrategy{}
+ return &ProbabilisticSamplingStrategy{}
}
-
func (p *ProbabilisticSamplingStrategy) GetSamplingRate() float64 {
- return p.SamplingRate
+ return p.SamplingRate
}
func (p *ProbabilisticSamplingStrategy) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
- var issetSamplingRate bool = false;
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.DOUBLE {
- if err := p.ReadField1(ctx, iprot); err != nil {
- return err
- }
- issetSamplingRate = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- if !issetSamplingRate{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SamplingRate is not set"));
- }
- return nil
-}
-
-func (p *ProbabilisticSamplingStrategy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadDouble(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.SamplingRate = v
-}
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ var issetSamplingRate bool = false
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.DOUBLE {
+ if err := p.ReadField1(ctx, iprot); err != nil {
+ return err
+ }
+ issetSamplingRate = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ if !issetSamplingRate {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SamplingRate is not set"))
+ }
+ return nil
+}
+
+func (p *ProbabilisticSamplingStrategy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadDouble(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.SamplingRate = v
+ }
+ return nil
}
func (p *ProbabilisticSamplingStrategy) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "ProbabilisticSamplingStrategy"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "ProbabilisticSamplingStrategy"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *ProbabilisticSamplingStrategy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "samplingRate", thrift.DOUBLE, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:samplingRate: ", p), err) }
- if err := oprot.WriteDouble(ctx, float64(p.SamplingRate)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.samplingRate (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:samplingRate: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "samplingRate", thrift.DOUBLE, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:samplingRate: ", p), err)
+ }
+ if err := oprot.WriteDouble(ctx, float64(p.SamplingRate)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.samplingRate (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:samplingRate: ", p), err)
+ }
+ return err
}
func (p *ProbabilisticSamplingStrategy) Equals(other *ProbabilisticSamplingStrategy) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.SamplingRate != other.SamplingRate { return false }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.SamplingRate != other.SamplingRate {
+ return false
+ }
+ return true
}
func (p *ProbabilisticSamplingStrategy) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("ProbabilisticSamplingStrategy(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("ProbabilisticSamplingStrategy(%+v)", *p)
}
// Attributes:
-// - MaxTracesPerSecond
+// - MaxTracesPerSecond
type RateLimitingSamplingStrategy struct {
- MaxTracesPerSecond int16 `thrift:"maxTracesPerSecond,1,required" db:"maxTracesPerSecond" json:"maxTracesPerSecond"`
+ MaxTracesPerSecond int16 `thrift:"maxTracesPerSecond,1,required" db:"maxTracesPerSecond" json:"maxTracesPerSecond"`
}
func NewRateLimitingSamplingStrategy() *RateLimitingSamplingStrategy {
- return &RateLimitingSamplingStrategy{}
+ return &RateLimitingSamplingStrategy{}
}
-
func (p *RateLimitingSamplingStrategy) GetMaxTracesPerSecond() int16 {
- return p.MaxTracesPerSecond
+ return p.MaxTracesPerSecond
}
func (p *RateLimitingSamplingStrategy) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
- var issetMaxTracesPerSecond bool = false;
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.I16 {
- if err := p.ReadField1(ctx, iprot); err != nil {
- return err
- }
- issetMaxTracesPerSecond = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- if !issetMaxTracesPerSecond{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field MaxTracesPerSecond is not set"));
- }
- return nil
-}
-
-func (p *RateLimitingSamplingStrategy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI16(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.MaxTracesPerSecond = v
-}
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ var issetMaxTracesPerSecond bool = false
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.I16 {
+ if err := p.ReadField1(ctx, iprot); err != nil {
+ return err
+ }
+ issetMaxTracesPerSecond = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ if !issetMaxTracesPerSecond {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field MaxTracesPerSecond is not set"))
+ }
+ return nil
+}
+
+func (p *RateLimitingSamplingStrategy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI16(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.MaxTracesPerSecond = v
+ }
+ return nil
}
func (p *RateLimitingSamplingStrategy) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "RateLimitingSamplingStrategy"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "RateLimitingSamplingStrategy"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *RateLimitingSamplingStrategy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "maxTracesPerSecond", thrift.I16, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:maxTracesPerSecond: ", p), err) }
- if err := oprot.WriteI16(ctx, int16(p.MaxTracesPerSecond)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.maxTracesPerSecond (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:maxTracesPerSecond: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "maxTracesPerSecond", thrift.I16, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:maxTracesPerSecond: ", p), err)
+ }
+ if err := oprot.WriteI16(ctx, int16(p.MaxTracesPerSecond)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.maxTracesPerSecond (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:maxTracesPerSecond: ", p), err)
+ }
+ return err
}
func (p *RateLimitingSamplingStrategy) Equals(other *RateLimitingSamplingStrategy) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.MaxTracesPerSecond != other.MaxTracesPerSecond { return false }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.MaxTracesPerSecond != other.MaxTracesPerSecond {
+ return false
+ }
+ return true
}
func (p *RateLimitingSamplingStrategy) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("RateLimitingSamplingStrategy(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("RateLimitingSamplingStrategy(%+v)", *p)
}
// Attributes:
-// - Operation
-// - ProbabilisticSampling
+// - Operation
+// - ProbabilisticSampling
type OperationSamplingStrategy struct {
- Operation string `thrift:"operation,1,required" db:"operation" json:"operation"`
- ProbabilisticSampling *ProbabilisticSamplingStrategy `thrift:"probabilisticSampling,2,required" db:"probabilisticSampling" json:"probabilisticSampling"`
+ Operation string `thrift:"operation,1,required" db:"operation" json:"operation"`
+ ProbabilisticSampling *ProbabilisticSamplingStrategy `thrift:"probabilisticSampling,2,required" db:"probabilisticSampling" json:"probabilisticSampling"`
}
func NewOperationSamplingStrategy() *OperationSamplingStrategy {
- return &OperationSamplingStrategy{}
+ return &OperationSamplingStrategy{}
}
-
func (p *OperationSamplingStrategy) GetOperation() string {
- return p.Operation
+ return p.Operation
}
+
var OperationSamplingStrategy_ProbabilisticSampling_DEFAULT *ProbabilisticSamplingStrategy
+
func (p *OperationSamplingStrategy) GetProbabilisticSampling() *ProbabilisticSamplingStrategy {
- if !p.IsSetProbabilisticSampling() {
- return OperationSamplingStrategy_ProbabilisticSampling_DEFAULT
- }
-return p.ProbabilisticSampling
+ if !p.IsSetProbabilisticSampling() {
+ return OperationSamplingStrategy_ProbabilisticSampling_DEFAULT
+ }
+ return p.ProbabilisticSampling
}
func (p *OperationSamplingStrategy) IsSetProbabilisticSampling() bool {
- return p.ProbabilisticSampling != nil
+ return p.ProbabilisticSampling != nil
}
func (p *OperationSamplingStrategy) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
- var issetOperation bool = false;
- var issetProbabilisticSampling bool = false;
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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(ctx, iprot); err != nil {
- return err
- }
- issetOperation = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 2:
- if fieldTypeId == thrift.STRUCT {
- if err := p.ReadField2(ctx, iprot); err != nil {
- return err
- }
- issetProbabilisticSampling = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- if !issetOperation{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Operation is not set"));
- }
- if !issetProbabilisticSampling{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ProbabilisticSampling is not set"));
- }
- return nil
-}
-
-func (p *OperationSamplingStrategy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadString(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.Operation = v
-}
- return nil
-}
-
-func (p *OperationSamplingStrategy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
- p.ProbabilisticSampling = &ProbabilisticSamplingStrategy{}
- if err := p.ProbabilisticSampling.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ProbabilisticSampling), err)
- }
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ var issetOperation bool = false
+ var issetProbabilisticSampling bool = false
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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(ctx, iprot); err != nil {
+ return err
+ }
+ issetOperation = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 2:
+ if fieldTypeId == thrift.STRUCT {
+ if err := p.ReadField2(ctx, iprot); err != nil {
+ return err
+ }
+ issetProbabilisticSampling = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ if !issetOperation {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Operation is not set"))
+ }
+ if !issetProbabilisticSampling {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ProbabilisticSampling is not set"))
+ }
+ return nil
+}
+
+func (p *OperationSamplingStrategy) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadString(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.Operation = v
+ }
+ return nil
+}
+
+func (p *OperationSamplingStrategy) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
+ p.ProbabilisticSampling = &ProbabilisticSamplingStrategy{}
+ if err := p.ProbabilisticSampling.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ProbabilisticSampling), err)
+ }
+ return nil
}
func (p *OperationSamplingStrategy) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "OperationSamplingStrategy"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- if err := p.writeField2(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "OperationSamplingStrategy"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField2(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *OperationSamplingStrategy) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "operation", thrift.STRING, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:operation: ", p), err) }
- if err := oprot.WriteString(ctx, string(p.Operation)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.operation (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:operation: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "operation", thrift.STRING, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:operation: ", p), err)
+ }
+ if err := oprot.WriteString(ctx, string(p.Operation)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.operation (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:operation: ", p), err)
+ }
+ return err
}
func (p *OperationSamplingStrategy) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "probabilisticSampling", thrift.STRUCT, 2); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:probabilisticSampling: ", p), err) }
- if err := p.ProbabilisticSampling.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ProbabilisticSampling), err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 2:probabilisticSampling: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "probabilisticSampling", thrift.STRUCT, 2); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:probabilisticSampling: ", p), err)
+ }
+ if err := p.ProbabilisticSampling.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ProbabilisticSampling), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 2:probabilisticSampling: ", p), err)
+ }
+ return err
}
func (p *OperationSamplingStrategy) Equals(other *OperationSamplingStrategy) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.Operation != other.Operation { return false }
- if !p.ProbabilisticSampling.Equals(other.ProbabilisticSampling) { return false }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.Operation != other.Operation {
+ return false
+ }
+ if !p.ProbabilisticSampling.Equals(other.ProbabilisticSampling) {
+ return false
+ }
+ return true
}
func (p *OperationSamplingStrategy) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("OperationSamplingStrategy(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("OperationSamplingStrategy(%+v)", *p)
}
// Attributes:
-// - DefaultSamplingProbability
-// - DefaultLowerBoundTracesPerSecond
-// - PerOperationStrategies
-// - DefaultUpperBoundTracesPerSecond
+// - DefaultSamplingProbability
+// - DefaultLowerBoundTracesPerSecond
+// - PerOperationStrategies
+// - DefaultUpperBoundTracesPerSecond
type PerOperationSamplingStrategies struct {
- DefaultSamplingProbability float64 `thrift:"defaultSamplingProbability,1,required" db:"defaultSamplingProbability" json:"defaultSamplingProbability"`
- DefaultLowerBoundTracesPerSecond float64 `thrift:"defaultLowerBoundTracesPerSecond,2,required" db:"defaultLowerBoundTracesPerSecond" json:"defaultLowerBoundTracesPerSecond"`
- PerOperationStrategies []*OperationSamplingStrategy `thrift:"perOperationStrategies,3,required" db:"perOperationStrategies" json:"perOperationStrategies"`
- DefaultUpperBoundTracesPerSecond *float64 `thrift:"defaultUpperBoundTracesPerSecond,4" db:"defaultUpperBoundTracesPerSecond" json:"defaultUpperBoundTracesPerSecond,omitempty"`
+ DefaultSamplingProbability float64 `thrift:"defaultSamplingProbability,1,required" db:"defaultSamplingProbability" json:"defaultSamplingProbability"`
+ DefaultLowerBoundTracesPerSecond float64 `thrift:"defaultLowerBoundTracesPerSecond,2,required" db:"defaultLowerBoundTracesPerSecond" json:"defaultLowerBoundTracesPerSecond"`
+ PerOperationStrategies []*OperationSamplingStrategy `thrift:"perOperationStrategies,3,required" db:"perOperationStrategies" json:"perOperationStrategies"`
+ DefaultUpperBoundTracesPerSecond *float64 `thrift:"defaultUpperBoundTracesPerSecond,4" db:"defaultUpperBoundTracesPerSecond" json:"defaultUpperBoundTracesPerSecond,omitempty"`
}
func NewPerOperationSamplingStrategies() *PerOperationSamplingStrategies {
- return &PerOperationSamplingStrategies{}
+ return &PerOperationSamplingStrategies{}
}
-
func (p *PerOperationSamplingStrategies) GetDefaultSamplingProbability() float64 {
- return p.DefaultSamplingProbability
+ return p.DefaultSamplingProbability
}
func (p *PerOperationSamplingStrategies) GetDefaultLowerBoundTracesPerSecond() float64 {
- return p.DefaultLowerBoundTracesPerSecond
+ return p.DefaultLowerBoundTracesPerSecond
}
func (p *PerOperationSamplingStrategies) GetPerOperationStrategies() []*OperationSamplingStrategy {
- return p.PerOperationStrategies
+ return p.PerOperationStrategies
}
+
var PerOperationSamplingStrategies_DefaultUpperBoundTracesPerSecond_DEFAULT float64
+
func (p *PerOperationSamplingStrategies) GetDefaultUpperBoundTracesPerSecond() float64 {
- if !p.IsSetDefaultUpperBoundTracesPerSecond() {
- return PerOperationSamplingStrategies_DefaultUpperBoundTracesPerSecond_DEFAULT
- }
-return *p.DefaultUpperBoundTracesPerSecond
+ if !p.IsSetDefaultUpperBoundTracesPerSecond() {
+ return PerOperationSamplingStrategies_DefaultUpperBoundTracesPerSecond_DEFAULT
+ }
+ return *p.DefaultUpperBoundTracesPerSecond
}
func (p *PerOperationSamplingStrategies) IsSetDefaultUpperBoundTracesPerSecond() bool {
- return p.DefaultUpperBoundTracesPerSecond != nil
+ return p.DefaultUpperBoundTracesPerSecond != nil
}
func (p *PerOperationSamplingStrategies) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
- var issetDefaultSamplingProbability bool = false;
- var issetDefaultLowerBoundTracesPerSecond bool = false;
- var issetPerOperationStrategies bool = false;
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.DOUBLE {
- if err := p.ReadField1(ctx, iprot); err != nil {
- return err
- }
- issetDefaultSamplingProbability = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 2:
- if fieldTypeId == thrift.DOUBLE {
- if err := p.ReadField2(ctx, iprot); err != nil {
- return err
- }
- issetDefaultLowerBoundTracesPerSecond = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 3:
- if fieldTypeId == thrift.LIST {
- if err := p.ReadField3(ctx, iprot); err != nil {
- return err
- }
- issetPerOperationStrategies = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 4:
- if fieldTypeId == thrift.DOUBLE {
- if err := p.ReadField4(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- if !issetDefaultSamplingProbability{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DefaultSamplingProbability is not set"));
- }
- if !issetDefaultLowerBoundTracesPerSecond{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DefaultLowerBoundTracesPerSecond is not set"));
- }
- if !issetPerOperationStrategies{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PerOperationStrategies is not set"));
- }
- return nil
-}
-
-func (p *PerOperationSamplingStrategies) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadDouble(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.DefaultSamplingProbability = v
-}
- return nil
-}
-
-func (p *PerOperationSamplingStrategies) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadDouble(ctx); err != nil {
- return thrift.PrependError("error reading field 2: ", err)
-} else {
- p.DefaultLowerBoundTracesPerSecond = v
-}
- return nil
-}
-
-func (p *PerOperationSamplingStrategies) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
- _, size, err := iprot.ReadListBegin(ctx)
- if err != nil {
- return thrift.PrependError("error reading list begin: ", err)
- }
- tSlice := make([]*OperationSamplingStrategy, 0, size)
- p.PerOperationStrategies = tSlice
- for i := 0; i < size; i ++ {
- _elem0 := &OperationSamplingStrategy{}
- if err := _elem0.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem0), err)
- }
- p.PerOperationStrategies = append(p.PerOperationStrategies, _elem0)
- }
- if err := iprot.ReadListEnd(ctx); err != nil {
- return thrift.PrependError("error reading list end: ", err)
- }
- return nil
-}
-
-func (p *PerOperationSamplingStrategies) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadDouble(ctx); err != nil {
- return thrift.PrependError("error reading field 4: ", err)
-} else {
- p.DefaultUpperBoundTracesPerSecond = &v
-}
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ var issetDefaultSamplingProbability bool = false
+ var issetDefaultLowerBoundTracesPerSecond bool = false
+ var issetPerOperationStrategies bool = false
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.DOUBLE {
+ if err := p.ReadField1(ctx, iprot); err != nil {
+ return err
+ }
+ issetDefaultSamplingProbability = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 2:
+ if fieldTypeId == thrift.DOUBLE {
+ if err := p.ReadField2(ctx, iprot); err != nil {
+ return err
+ }
+ issetDefaultLowerBoundTracesPerSecond = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 3:
+ if fieldTypeId == thrift.LIST {
+ if err := p.ReadField3(ctx, iprot); err != nil {
+ return err
+ }
+ issetPerOperationStrategies = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 4:
+ if fieldTypeId == thrift.DOUBLE {
+ if err := p.ReadField4(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ if !issetDefaultSamplingProbability {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DefaultSamplingProbability is not set"))
+ }
+ if !issetDefaultLowerBoundTracesPerSecond {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DefaultLowerBoundTracesPerSecond is not set"))
+ }
+ if !issetPerOperationStrategies {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PerOperationStrategies is not set"))
+ }
+ return nil
+}
+
+func (p *PerOperationSamplingStrategies) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadDouble(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.DefaultSamplingProbability = v
+ }
+ return nil
+}
+
+func (p *PerOperationSamplingStrategies) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadDouble(ctx); err != nil {
+ return thrift.PrependError("error reading field 2: ", err)
+ } else {
+ p.DefaultLowerBoundTracesPerSecond = v
+ }
+ return nil
+}
+
+func (p *PerOperationSamplingStrategies) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
+ _, size, err := iprot.ReadListBegin(ctx)
+ if err != nil {
+ return thrift.PrependError("error reading list begin: ", err)
+ }
+ tSlice := make([]*OperationSamplingStrategy, 0, size)
+ p.PerOperationStrategies = tSlice
+ for i := 0; i < size; i++ {
+ _elem0 := &OperationSamplingStrategy{}
+ if err := _elem0.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem0), err)
+ }
+ p.PerOperationStrategies = append(p.PerOperationStrategies, _elem0)
+ }
+ if err := iprot.ReadListEnd(ctx); err != nil {
+ return thrift.PrependError("error reading list end: ", err)
+ }
+ return nil
+}
+
+func (p *PerOperationSamplingStrategies) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadDouble(ctx); err != nil {
+ return thrift.PrependError("error reading field 4: ", err)
+ } else {
+ p.DefaultUpperBoundTracesPerSecond = &v
+ }
+ return nil
}
func (p *PerOperationSamplingStrategies) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "PerOperationSamplingStrategies"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- if err := p.writeField2(ctx, oprot); err != nil { return err }
- if err := p.writeField3(ctx, oprot); err != nil { return err }
- if err := p.writeField4(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "PerOperationSamplingStrategies"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField2(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField3(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField4(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *PerOperationSamplingStrategies) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "defaultSamplingProbability", thrift.DOUBLE, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:defaultSamplingProbability: ", p), err) }
- if err := oprot.WriteDouble(ctx, float64(p.DefaultSamplingProbability)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.defaultSamplingProbability (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:defaultSamplingProbability: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "defaultSamplingProbability", thrift.DOUBLE, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:defaultSamplingProbability: ", p), err)
+ }
+ if err := oprot.WriteDouble(ctx, float64(p.DefaultSamplingProbability)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.defaultSamplingProbability (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:defaultSamplingProbability: ", p), err)
+ }
+ return err
}
func (p *PerOperationSamplingStrategies) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "defaultLowerBoundTracesPerSecond", thrift.DOUBLE, 2); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:defaultLowerBoundTracesPerSecond: ", p), err) }
- if err := oprot.WriteDouble(ctx, float64(p.DefaultLowerBoundTracesPerSecond)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.defaultLowerBoundTracesPerSecond (2) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 2:defaultLowerBoundTracesPerSecond: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "defaultLowerBoundTracesPerSecond", thrift.DOUBLE, 2); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:defaultLowerBoundTracesPerSecond: ", p), err)
+ }
+ if err := oprot.WriteDouble(ctx, float64(p.DefaultLowerBoundTracesPerSecond)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.defaultLowerBoundTracesPerSecond (2) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 2:defaultLowerBoundTracesPerSecond: ", p), err)
+ }
+ return err
}
func (p *PerOperationSamplingStrategies) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "perOperationStrategies", thrift.LIST, 3); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:perOperationStrategies: ", p), err) }
- if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.PerOperationStrategies)); err != nil {
- return thrift.PrependError("error writing list begin: ", err)
- }
- for _, v := range p.PerOperationStrategies {
- if err := v.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
- }
- }
- if err := oprot.WriteListEnd(ctx); err != nil {
- return thrift.PrependError("error writing list end: ", err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 3:perOperationStrategies: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "perOperationStrategies", thrift.LIST, 3); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:perOperationStrategies: ", p), err)
+ }
+ if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.PerOperationStrategies)); err != nil {
+ return thrift.PrependError("error writing list begin: ", err)
+ }
+ for _, v := range p.PerOperationStrategies {
+ if err := v.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
+ }
+ }
+ if err := oprot.WriteListEnd(ctx); err != nil {
+ return thrift.PrependError("error writing list end: ", err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 3:perOperationStrategies: ", p), err)
+ }
+ return err
}
func (p *PerOperationSamplingStrategies) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetDefaultUpperBoundTracesPerSecond() {
- if err := oprot.WriteFieldBegin(ctx, "defaultUpperBoundTracesPerSecond", thrift.DOUBLE, 4); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:defaultUpperBoundTracesPerSecond: ", p), err) }
- if err := oprot.WriteDouble(ctx, float64(*p.DefaultUpperBoundTracesPerSecond)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.defaultUpperBoundTracesPerSecond (4) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 4:defaultUpperBoundTracesPerSecond: ", p), err) }
- }
- return err
+ if p.IsSetDefaultUpperBoundTracesPerSecond() {
+ if err := oprot.WriteFieldBegin(ctx, "defaultUpperBoundTracesPerSecond", thrift.DOUBLE, 4); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:defaultUpperBoundTracesPerSecond: ", p), err)
+ }
+ if err := oprot.WriteDouble(ctx, float64(*p.DefaultUpperBoundTracesPerSecond)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.defaultUpperBoundTracesPerSecond (4) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 4:defaultUpperBoundTracesPerSecond: ", p), err)
+ }
+ }
+ return err
}
func (p *PerOperationSamplingStrategies) Equals(other *PerOperationSamplingStrategies) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.DefaultSamplingProbability != other.DefaultSamplingProbability { return false }
- if p.DefaultLowerBoundTracesPerSecond != other.DefaultLowerBoundTracesPerSecond { return false }
- if len(p.PerOperationStrategies) != len(other.PerOperationStrategies) { return false }
- for i, _tgt := range p.PerOperationStrategies {
- _src1 := other.PerOperationStrategies[i]
- if !_tgt.Equals(_src1) { return false }
- }
- if p.DefaultUpperBoundTracesPerSecond != other.DefaultUpperBoundTracesPerSecond {
- if p.DefaultUpperBoundTracesPerSecond == nil || other.DefaultUpperBoundTracesPerSecond == nil {
- return false
- }
- if (*p.DefaultUpperBoundTracesPerSecond) != (*other.DefaultUpperBoundTracesPerSecond) { return false }
- }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.DefaultSamplingProbability != other.DefaultSamplingProbability {
+ return false
+ }
+ if p.DefaultLowerBoundTracesPerSecond != other.DefaultLowerBoundTracesPerSecond {
+ return false
+ }
+ if len(p.PerOperationStrategies) != len(other.PerOperationStrategies) {
+ return false
+ }
+ for i, _tgt := range p.PerOperationStrategies {
+ _src1 := other.PerOperationStrategies[i]
+ if !_tgt.Equals(_src1) {
+ return false
+ }
+ }
+ if p.DefaultUpperBoundTracesPerSecond != other.DefaultUpperBoundTracesPerSecond {
+ if p.DefaultUpperBoundTracesPerSecond == nil || other.DefaultUpperBoundTracesPerSecond == nil {
+ return false
+ }
+ if (*p.DefaultUpperBoundTracesPerSecond) != (*other.DefaultUpperBoundTracesPerSecond) {
+ return false
+ }
+ }
+ return true
}
func (p *PerOperationSamplingStrategies) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("PerOperationSamplingStrategies(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("PerOperationSamplingStrategies(%+v)", *p)
}
// Attributes:
-// - StrategyType
-// - ProbabilisticSampling
-// - RateLimitingSampling
-// - OperationSampling
+// - StrategyType
+// - ProbabilisticSampling
+// - RateLimitingSampling
+// - OperationSampling
type SamplingStrategyResponse struct {
- StrategyType SamplingStrategyType `thrift:"strategyType,1,required" db:"strategyType" json:"strategyType"`
- ProbabilisticSampling *ProbabilisticSamplingStrategy `thrift:"probabilisticSampling,2" db:"probabilisticSampling" json:"probabilisticSampling,omitempty"`
- RateLimitingSampling *RateLimitingSamplingStrategy `thrift:"rateLimitingSampling,3" db:"rateLimitingSampling" json:"rateLimitingSampling,omitempty"`
- OperationSampling *PerOperationSamplingStrategies `thrift:"operationSampling,4" db:"operationSampling" json:"operationSampling,omitempty"`
+ StrategyType SamplingStrategyType `thrift:"strategyType,1,required" db:"strategyType" json:"strategyType"`
+ ProbabilisticSampling *ProbabilisticSamplingStrategy `thrift:"probabilisticSampling,2" db:"probabilisticSampling" json:"probabilisticSampling,omitempty"`
+ RateLimitingSampling *RateLimitingSamplingStrategy `thrift:"rateLimitingSampling,3" db:"rateLimitingSampling" json:"rateLimitingSampling,omitempty"`
+ OperationSampling *PerOperationSamplingStrategies `thrift:"operationSampling,4" db:"operationSampling" json:"operationSampling,omitempty"`
}
func NewSamplingStrategyResponse() *SamplingStrategyResponse {
- return &SamplingStrategyResponse{}
+ return &SamplingStrategyResponse{}
}
-
func (p *SamplingStrategyResponse) GetStrategyType() SamplingStrategyType {
- return p.StrategyType
+ return p.StrategyType
}
+
var SamplingStrategyResponse_ProbabilisticSampling_DEFAULT *ProbabilisticSamplingStrategy
+
func (p *SamplingStrategyResponse) GetProbabilisticSampling() *ProbabilisticSamplingStrategy {
- if !p.IsSetProbabilisticSampling() {
- return SamplingStrategyResponse_ProbabilisticSampling_DEFAULT
- }
-return p.ProbabilisticSampling
+ if !p.IsSetProbabilisticSampling() {
+ return SamplingStrategyResponse_ProbabilisticSampling_DEFAULT
+ }
+ return p.ProbabilisticSampling
}
+
var SamplingStrategyResponse_RateLimitingSampling_DEFAULT *RateLimitingSamplingStrategy
+
func (p *SamplingStrategyResponse) GetRateLimitingSampling() *RateLimitingSamplingStrategy {
- if !p.IsSetRateLimitingSampling() {
- return SamplingStrategyResponse_RateLimitingSampling_DEFAULT
- }
-return p.RateLimitingSampling
+ if !p.IsSetRateLimitingSampling() {
+ return SamplingStrategyResponse_RateLimitingSampling_DEFAULT
+ }
+ return p.RateLimitingSampling
}
+
var SamplingStrategyResponse_OperationSampling_DEFAULT *PerOperationSamplingStrategies
+
func (p *SamplingStrategyResponse) GetOperationSampling() *PerOperationSamplingStrategies {
- if !p.IsSetOperationSampling() {
- return SamplingStrategyResponse_OperationSampling_DEFAULT
- }
-return p.OperationSampling
+ if !p.IsSetOperationSampling() {
+ return SamplingStrategyResponse_OperationSampling_DEFAULT
+ }
+ return p.OperationSampling
}
func (p *SamplingStrategyResponse) IsSetProbabilisticSampling() bool {
- return p.ProbabilisticSampling != nil
+ return p.ProbabilisticSampling != nil
}
func (p *SamplingStrategyResponse) IsSetRateLimitingSampling() bool {
- return p.RateLimitingSampling != nil
+ return p.RateLimitingSampling != nil
}
func (p *SamplingStrategyResponse) IsSetOperationSampling() bool {
- return p.OperationSampling != nil
+ return p.OperationSampling != nil
}
func (p *SamplingStrategyResponse) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
- var issetStrategyType bool = false;
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.I32 {
- if err := p.ReadField1(ctx, iprot); err != nil {
- return err
- }
- issetStrategyType = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 2:
- if fieldTypeId == thrift.STRUCT {
- if err := p.ReadField2(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 3:
- if fieldTypeId == thrift.STRUCT {
- if err := p.ReadField3(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 4:
- if fieldTypeId == thrift.STRUCT {
- if err := p.ReadField4(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- if !issetStrategyType{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StrategyType is not set"));
- }
- return nil
-}
-
-func (p *SamplingStrategyResponse) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI32(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- temp := SamplingStrategyType(v)
- p.StrategyType = temp
-}
- return nil
-}
-
-func (p *SamplingStrategyResponse) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
- p.ProbabilisticSampling = &ProbabilisticSamplingStrategy{}
- if err := p.ProbabilisticSampling.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ProbabilisticSampling), err)
- }
- return nil
-}
-
-func (p *SamplingStrategyResponse) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
- p.RateLimitingSampling = &RateLimitingSamplingStrategy{}
- if err := p.RateLimitingSampling.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.RateLimitingSampling), err)
- }
- return nil
-}
-
-func (p *SamplingStrategyResponse) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
- p.OperationSampling = &PerOperationSamplingStrategies{}
- if err := p.OperationSampling.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.OperationSampling), err)
- }
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ var issetStrategyType bool = false
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.I32 {
+ if err := p.ReadField1(ctx, iprot); err != nil {
+ return err
+ }
+ issetStrategyType = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 2:
+ if fieldTypeId == thrift.STRUCT {
+ if err := p.ReadField2(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 3:
+ if fieldTypeId == thrift.STRUCT {
+ if err := p.ReadField3(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 4:
+ if fieldTypeId == thrift.STRUCT {
+ if err := p.ReadField4(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ if !issetStrategyType {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StrategyType is not set"))
+ }
+ return nil
+}
+
+func (p *SamplingStrategyResponse) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI32(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ temp := SamplingStrategyType(v)
+ p.StrategyType = temp
+ }
+ return nil
+}
+
+func (p *SamplingStrategyResponse) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
+ p.ProbabilisticSampling = &ProbabilisticSamplingStrategy{}
+ if err := p.ProbabilisticSampling.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ProbabilisticSampling), err)
+ }
+ return nil
+}
+
+func (p *SamplingStrategyResponse) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
+ p.RateLimitingSampling = &RateLimitingSamplingStrategy{}
+ if err := p.RateLimitingSampling.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.RateLimitingSampling), err)
+ }
+ return nil
+}
+
+func (p *SamplingStrategyResponse) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
+ p.OperationSampling = &PerOperationSamplingStrategies{}
+ if err := p.OperationSampling.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.OperationSampling), err)
+ }
+ return nil
}
func (p *SamplingStrategyResponse) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "SamplingStrategyResponse"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- if err := p.writeField2(ctx, oprot); err != nil { return err }
- if err := p.writeField3(ctx, oprot); err != nil { return err }
- if err := p.writeField4(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "SamplingStrategyResponse"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField2(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField3(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField4(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *SamplingStrategyResponse) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "strategyType", thrift.I32, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:strategyType: ", p), err) }
- if err := oprot.WriteI32(ctx, int32(p.StrategyType)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.strategyType (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:strategyType: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "strategyType", thrift.I32, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:strategyType: ", p), err)
+ }
+ if err := oprot.WriteI32(ctx, int32(p.StrategyType)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.strategyType (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:strategyType: ", p), err)
+ }
+ return err
}
func (p *SamplingStrategyResponse) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetProbabilisticSampling() {
- if err := oprot.WriteFieldBegin(ctx, "probabilisticSampling", thrift.STRUCT, 2); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:probabilisticSampling: ", p), err) }
- if err := p.ProbabilisticSampling.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ProbabilisticSampling), err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 2:probabilisticSampling: ", p), err) }
- }
- return err
+ if p.IsSetProbabilisticSampling() {
+ if err := oprot.WriteFieldBegin(ctx, "probabilisticSampling", thrift.STRUCT, 2); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:probabilisticSampling: ", p), err)
+ }
+ if err := p.ProbabilisticSampling.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ProbabilisticSampling), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 2:probabilisticSampling: ", p), err)
+ }
+ }
+ return err
}
func (p *SamplingStrategyResponse) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetRateLimitingSampling() {
- if err := oprot.WriteFieldBegin(ctx, "rateLimitingSampling", thrift.STRUCT, 3); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:rateLimitingSampling: ", p), err) }
- if err := p.RateLimitingSampling.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.RateLimitingSampling), err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 3:rateLimitingSampling: ", p), err) }
- }
- return err
+ if p.IsSetRateLimitingSampling() {
+ if err := oprot.WriteFieldBegin(ctx, "rateLimitingSampling", thrift.STRUCT, 3); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:rateLimitingSampling: ", p), err)
+ }
+ if err := p.RateLimitingSampling.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.RateLimitingSampling), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 3:rateLimitingSampling: ", p), err)
+ }
+ }
+ return err
}
func (p *SamplingStrategyResponse) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetOperationSampling() {
- if err := oprot.WriteFieldBegin(ctx, "operationSampling", thrift.STRUCT, 4); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:operationSampling: ", p), err) }
- if err := p.OperationSampling.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.OperationSampling), err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 4:operationSampling: ", p), err) }
- }
- return err
+ if p.IsSetOperationSampling() {
+ if err := oprot.WriteFieldBegin(ctx, "operationSampling", thrift.STRUCT, 4); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:operationSampling: ", p), err)
+ }
+ if err := p.OperationSampling.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.OperationSampling), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 4:operationSampling: ", p), err)
+ }
+ }
+ return err
}
func (p *SamplingStrategyResponse) Equals(other *SamplingStrategyResponse) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.StrategyType != other.StrategyType { return false }
- if !p.ProbabilisticSampling.Equals(other.ProbabilisticSampling) { return false }
- if !p.RateLimitingSampling.Equals(other.RateLimitingSampling) { return false }
- if !p.OperationSampling.Equals(other.OperationSampling) { return false }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.StrategyType != other.StrategyType {
+ return false
+ }
+ if !p.ProbabilisticSampling.Equals(other.ProbabilisticSampling) {
+ return false
+ }
+ if !p.RateLimitingSampling.Equals(other.RateLimitingSampling) {
+ return false
+ }
+ if !p.OperationSampling.Equals(other.OperationSampling) {
+ return false
+ }
+ return true
}
func (p *SamplingStrategyResponse) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("SamplingStrategyResponse(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("SamplingStrategyResponse(%+v)", *p)
}
type SamplingManager interface {
- // Parameters:
- // - ServiceName
- GetSamplingStrategy(ctx context.Context, serviceName string) (_r *SamplingStrategyResponse, _err error)
+ // Parameters:
+ // - ServiceName
+ GetSamplingStrategy(ctx context.Context, serviceName string) (_r *SamplingStrategyResponse, _err error)
}
type SamplingManagerClient struct {
- c thrift.TClient
- meta thrift.ResponseMeta
+ c thrift.TClient
+ meta thrift.ResponseMeta
}
func NewSamplingManagerClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *SamplingManagerClient {
- return &SamplingManagerClient{
- c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
- }
+ return &SamplingManagerClient{
+ c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
+ }
}
func NewSamplingManagerClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *SamplingManagerClient {
- return &SamplingManagerClient{
- c: thrift.NewTStandardClient(iprot, oprot),
- }
+ return &SamplingManagerClient{
+ c: thrift.NewTStandardClient(iprot, oprot),
+ }
}
func NewSamplingManagerClient(c thrift.TClient) *SamplingManagerClient {
- return &SamplingManagerClient{
- c: c,
- }
+ return &SamplingManagerClient{
+ c: c,
+ }
}
func (p *SamplingManagerClient) Client_() thrift.TClient {
- return p.c
+ return p.c
}
func (p *SamplingManagerClient) LastResponseMeta_() thrift.ResponseMeta {
- return p.meta
+ return p.meta
}
func (p *SamplingManagerClient) SetLastResponseMeta_(meta thrift.ResponseMeta) {
- p.meta = meta
+ p.meta = meta
}
// Parameters:
-// - ServiceName
+// - ServiceName
func (p *SamplingManagerClient) GetSamplingStrategy(ctx context.Context, serviceName string) (_r *SamplingStrategyResponse, _err error) {
- var _args2 SamplingManagerGetSamplingStrategyArgs
- _args2.ServiceName = serviceName
- var _result4 SamplingManagerGetSamplingStrategyResult
- var _meta3 thrift.ResponseMeta
- _meta3, _err = p.Client_().Call(ctx, "getSamplingStrategy", &_args2, &_result4)
- p.SetLastResponseMeta_(_meta3)
- if _err != nil {
- return
- }
- return _result4.GetSuccess(), nil
+ var _args2 SamplingManagerGetSamplingStrategyArgs
+ _args2.ServiceName = serviceName
+ var _result4 SamplingManagerGetSamplingStrategyResult
+ var _meta3 thrift.ResponseMeta
+ _meta3, _err = p.Client_().Call(ctx, "getSamplingStrategy", &_args2, &_result4)
+ p.SetLastResponseMeta_(_meta3)
+ if _err != nil {
+ return
+ }
+ return _result4.GetSuccess(), nil
}
type SamplingManagerProcessor struct {
- processorMap map[string]thrift.TProcessorFunction
- handler SamplingManager
+ processorMap map[string]thrift.TProcessorFunction
+ handler SamplingManager
}
func (p *SamplingManagerProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
- p.processorMap[key] = processor
+ p.processorMap[key] = processor
}
func (p *SamplingManagerProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
- processor, ok = p.processorMap[key]
- return processor, ok
+ processor, ok = p.processorMap[key]
+ return processor, ok
}
func (p *SamplingManagerProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
- return p.processorMap
+ return p.processorMap
}
func NewSamplingManagerProcessor(handler SamplingManager) *SamplingManagerProcessor {
- self5 := &SamplingManagerProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)}
- self5.processorMap["getSamplingStrategy"] = &samplingManagerProcessorGetSamplingStrategy{handler:handler}
-return self5
+ self5 := &SamplingManagerProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
+ self5.processorMap["getSamplingStrategy"] = &samplingManagerProcessorGetSamplingStrategy{handler: handler}
+ return self5
}
func (p *SamplingManagerProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
- name, _, seqId, err2 := iprot.ReadMessageBegin(ctx)
- if err2 != nil { return false, thrift.WrapTException(err2) }
- if processor, ok := p.GetProcessorFunction(name); ok {
- return processor.Process(ctx, seqId, iprot, oprot)
- }
- iprot.Skip(ctx, thrift.STRUCT)
- iprot.ReadMessageEnd(ctx)
- x6 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name)
- oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId)
- x6.Write(ctx, oprot)
- oprot.WriteMessageEnd(ctx)
- oprot.Flush(ctx)
- return false, x6
+ name, _, seqId, err2 := iprot.ReadMessageBegin(ctx)
+ if err2 != nil {
+ return false, thrift.WrapTException(err2)
+ }
+ if processor, ok := p.GetProcessorFunction(name); ok {
+ return processor.Process(ctx, seqId, iprot, oprot)
+ }
+ iprot.Skip(ctx, thrift.STRUCT)
+ iprot.ReadMessageEnd(ctx)
+ x6 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
+ oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId)
+ x6.Write(ctx, oprot)
+ oprot.WriteMessageEnd(ctx)
+ oprot.Flush(ctx)
+ return false, x6
}
type samplingManagerProcessorGetSamplingStrategy struct {
- handler SamplingManager
+ handler SamplingManager
}
func (p *samplingManagerProcessorGetSamplingStrategy) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
- args := SamplingManagerGetSamplingStrategyArgs{}
- var err2 error
- if err2 = args.Read(ctx, iprot); err2 != nil {
- iprot.ReadMessageEnd(ctx)
- x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
- oprot.WriteMessageBegin(ctx, "getSamplingStrategy", thrift.EXCEPTION, seqId)
- x.Write(ctx, oprot)
- oprot.WriteMessageEnd(ctx)
- oprot.Flush(ctx)
- return false, thrift.WrapTException(err2)
- }
- iprot.ReadMessageEnd(ctx)
-
- tickerCancel := func() {}
- // Start a goroutine to do server side connectivity check.
- if thrift.ServerConnectivityCheckInterval > 0 {
- var cancel context.CancelFunc
- ctx, cancel = context.WithCancel(ctx)
- defer cancel()
- var tickerCtx context.Context
- tickerCtx, tickerCancel = context.WithCancel(context.Background())
- defer tickerCancel()
- go func(ctx context.Context, cancel context.CancelFunc) {
- ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
- defer ticker.Stop()
- for {
- select {
- case <-ctx.Done():
- return
- case <-ticker.C:
- if !iprot.Transport().IsOpen() {
- cancel()
- return
- }
- }
- }
- }(tickerCtx, cancel)
- }
-
- result := SamplingManagerGetSamplingStrategyResult{}
- var retval *SamplingStrategyResponse
- if retval, err2 = p.handler.GetSamplingStrategy(ctx, args.ServiceName); err2 != nil {
- tickerCancel()
- if err2 == thrift.ErrAbandonRequest {
- return false, thrift.WrapTException(err2)
- }
- x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getSamplingStrategy: " + err2.Error())
- oprot.WriteMessageBegin(ctx, "getSamplingStrategy", thrift.EXCEPTION, seqId)
- x.Write(ctx, oprot)
- oprot.WriteMessageEnd(ctx)
- oprot.Flush(ctx)
- return true, thrift.WrapTException(err2)
- } else {
- result.Success = retval
- }
- tickerCancel()
- if err2 = oprot.WriteMessageBegin(ctx, "getSamplingStrategy", thrift.REPLY, seqId); err2 != nil {
- err = thrift.WrapTException(err2)
- }
- if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
- err = thrift.WrapTException(err2)
- }
- if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
- err = thrift.WrapTException(err2)
- }
- if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
- err = thrift.WrapTException(err2)
- }
- if err != nil {
- return
- }
- return true, err
+ args := SamplingManagerGetSamplingStrategyArgs{}
+ var err2 error
+ if err2 = args.Read(ctx, iprot); err2 != nil {
+ iprot.ReadMessageEnd(ctx)
+ x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
+ oprot.WriteMessageBegin(ctx, "getSamplingStrategy", thrift.EXCEPTION, seqId)
+ x.Write(ctx, oprot)
+ oprot.WriteMessageEnd(ctx)
+ oprot.Flush(ctx)
+ return false, thrift.WrapTException(err2)
+ }
+ iprot.ReadMessageEnd(ctx)
+
+ tickerCancel := func() {}
+ // Start a goroutine to do server side connectivity check.
+ if thrift.ServerConnectivityCheckInterval > 0 {
+ var cancel context.CancelFunc
+ ctx, cancel = context.WithCancel(ctx)
+ defer cancel()
+ var tickerCtx context.Context
+ tickerCtx, tickerCancel = context.WithCancel(context.Background())
+ defer tickerCancel()
+ go func(ctx context.Context, cancel context.CancelFunc) {
+ ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
+ defer ticker.Stop()
+ for {
+ select {
+ case <-ctx.Done():
+ return
+ case <-ticker.C:
+ if !iprot.Transport().IsOpen() {
+ cancel()
+ return
+ }
+ }
+ }
+ }(tickerCtx, cancel)
+ }
+
+ result := SamplingManagerGetSamplingStrategyResult{}
+ var retval *SamplingStrategyResponse
+ if retval, err2 = p.handler.GetSamplingStrategy(ctx, args.ServiceName); err2 != nil {
+ tickerCancel()
+ if err2 == thrift.ErrAbandonRequest {
+ return false, thrift.WrapTException(err2)
+ }
+ x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getSamplingStrategy: "+err2.Error())
+ oprot.WriteMessageBegin(ctx, "getSamplingStrategy", thrift.EXCEPTION, seqId)
+ x.Write(ctx, oprot)
+ oprot.WriteMessageEnd(ctx)
+ oprot.Flush(ctx)
+ return true, thrift.WrapTException(err2)
+ } else {
+ result.Success = retval
+ }
+ tickerCancel()
+ if err2 = oprot.WriteMessageBegin(ctx, "getSamplingStrategy", thrift.REPLY, seqId); err2 != nil {
+ err = thrift.WrapTException(err2)
+ }
+ if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
+ err = thrift.WrapTException(err2)
+ }
+ if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
+ err = thrift.WrapTException(err2)
+ }
+ if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
+ err = thrift.WrapTException(err2)
+ }
+ if err != nil {
+ return
+ }
+ return true, err
}
-
// HELPER FUNCTIONS AND STRUCTURES
// Attributes:
-// - ServiceName
+// - ServiceName
type SamplingManagerGetSamplingStrategyArgs struct {
- ServiceName string `thrift:"serviceName,1" db:"serviceName" json:"serviceName"`
+ ServiceName string `thrift:"serviceName,1" db:"serviceName" json:"serviceName"`
}
func NewSamplingManagerGetSamplingStrategyArgs() *SamplingManagerGetSamplingStrategyArgs {
- return &SamplingManagerGetSamplingStrategyArgs{}
+ return &SamplingManagerGetSamplingStrategyArgs{}
}
-
func (p *SamplingManagerGetSamplingStrategyArgs) GetServiceName() string {
- return p.ServiceName
+ return p.ServiceName
}
func (p *SamplingManagerGetSamplingStrategyArgs) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- return nil
-}
-
-func (p *SamplingManagerGetSamplingStrategyArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadString(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.ServiceName = v
-}
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ return nil
+}
+
+func (p *SamplingManagerGetSamplingStrategyArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadString(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.ServiceName = v
+ }
+ return nil
}
func (p *SamplingManagerGetSamplingStrategyArgs) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "getSamplingStrategy_args"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "getSamplingStrategy_args"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *SamplingManagerGetSamplingStrategyArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "serviceName", thrift.STRING, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:serviceName: ", p), err) }
- if err := oprot.WriteString(ctx, string(p.ServiceName)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.serviceName (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:serviceName: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "serviceName", thrift.STRING, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:serviceName: ", p), err)
+ }
+ if err := oprot.WriteString(ctx, string(p.ServiceName)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.serviceName (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:serviceName: ", p), err)
+ }
+ return err
}
func (p *SamplingManagerGetSamplingStrategyArgs) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("SamplingManagerGetSamplingStrategyArgs(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("SamplingManagerGetSamplingStrategyArgs(%+v)", *p)
}
// Attributes:
-// - Success
+// - Success
type SamplingManagerGetSamplingStrategyResult struct {
- Success *SamplingStrategyResponse `thrift:"success,0" db:"success" json:"success,omitempty"`
+ Success *SamplingStrategyResponse `thrift:"success,0" db:"success" json:"success,omitempty"`
}
func NewSamplingManagerGetSamplingStrategyResult() *SamplingManagerGetSamplingStrategyResult {
- return &SamplingManagerGetSamplingStrategyResult{}
+ return &SamplingManagerGetSamplingStrategyResult{}
}
var SamplingManagerGetSamplingStrategyResult_Success_DEFAULT *SamplingStrategyResponse
+
func (p *SamplingManagerGetSamplingStrategyResult) GetSuccess() *SamplingStrategyResponse {
- if !p.IsSetSuccess() {
- return SamplingManagerGetSamplingStrategyResult_Success_DEFAULT
- }
-return p.Success
+ if !p.IsSetSuccess() {
+ return SamplingManagerGetSamplingStrategyResult_Success_DEFAULT
+ }
+ return p.Success
}
func (p *SamplingManagerGetSamplingStrategyResult) IsSetSuccess() bool {
- return p.Success != nil
+ return p.Success != nil
}
func (p *SamplingManagerGetSamplingStrategyResult) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.STRUCT {
- if err := p.ReadField0(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- return nil
-}
-
-func (p *SamplingManagerGetSamplingStrategyResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
- p.Success = &SamplingStrategyResponse{}
- if err := p.Success.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
- }
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.STRUCT {
+ if err := p.ReadField0(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ return nil
+}
+
+func (p *SamplingManagerGetSamplingStrategyResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
+ p.Success = &SamplingStrategyResponse{}
+ if err := p.Success.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
+ }
+ return nil
}
func (p *SamplingManagerGetSamplingStrategyResult) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "getSamplingStrategy_result"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField0(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "getSamplingStrategy_result"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField0(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *SamplingManagerGetSamplingStrategyResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetSuccess() {
- if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
- if err := p.Success.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
- }
- return err
+ if p.IsSetSuccess() {
+ if err := oprot.WriteFieldBegin(ctx, "success", thrift.STRUCT, 0); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
+ }
+ if err := p.Success.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
+ }
+ }
+ return err
}
func (p *SamplingManagerGetSamplingStrategyResult) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("SamplingManagerGetSamplingStrategyResult(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("SamplingManagerGetSamplingStrategyResult(%+v)", *p)
}
-
-
diff --git a/thrift-gen/zipkincore/GoUnusedProtection__.go b/thrift-gen/zipkincore/GoUnusedProtection__.go
index ebf43018fe7..7744ed7fbaf 100644
--- a/thrift-gen/zipkincore/GoUnusedProtection__.go
+++ b/thrift-gen/zipkincore/GoUnusedProtection__.go
@@ -2,5 +2,4 @@
package zipkincore
-var GoUnusedProtection__ int;
-
+var GoUnusedProtection__ int
diff --git a/thrift-gen/zipkincore/zipkincore-consts.go b/thrift-gen/zipkincore/zipkincore-consts.go
index 8b6e02cd2d8..25450e8f4fb 100644
--- a/thrift-gen/zipkincore/zipkincore-consts.go
+++ b/thrift-gen/zipkincore/zipkincore-consts.go
@@ -2,12 +2,12 @@
package zipkincore
-import(
+import (
"bytes"
"context"
"fmt"
- "time"
"github.com/apache/thrift/lib/go/thrift"
+ "time"
)
// (needed to ensure safety because of naive import list construction.)
@@ -36,4 +36,3 @@ const MESSAGE_ADDR = "ma"
func init() {
}
-
diff --git a/thrift-gen/zipkincore/zipkincore.go b/thrift-gen/zipkincore/zipkincore.go
index 71e89125c7b..dbd79986072 100644
--- a/thrift-gen/zipkincore/zipkincore.go
+++ b/thrift-gen/zipkincore/zipkincore.go
@@ -2,14 +2,14 @@
package zipkincore
-import(
+import (
"bytes"
"context"
"database/sql/driver"
"errors"
"fmt"
- "time"
"github.com/apache/thrift/lib/go/thrift"
+ "time"
)
// (needed to ensure safety because of naive import list construction.)
@@ -20,1834 +20,2050 @@ var _ = time.Now
var _ = bytes.Equal
type AnnotationType int64
+
const (
- AnnotationType_BOOL AnnotationType = 0
- AnnotationType_BYTES AnnotationType = 1
- AnnotationType_I16 AnnotationType = 2
- AnnotationType_I32 AnnotationType = 3
- AnnotationType_I64 AnnotationType = 4
- AnnotationType_DOUBLE AnnotationType = 5
- AnnotationType_STRING AnnotationType = 6
+ AnnotationType_BOOL AnnotationType = 0
+ AnnotationType_BYTES AnnotationType = 1
+ AnnotationType_I16 AnnotationType = 2
+ AnnotationType_I32 AnnotationType = 3
+ AnnotationType_I64 AnnotationType = 4
+ AnnotationType_DOUBLE AnnotationType = 5
+ AnnotationType_STRING AnnotationType = 6
)
func (p AnnotationType) String() string {
- switch p {
- case AnnotationType_BOOL: return "BOOL"
- case AnnotationType_BYTES: return "BYTES"
- case AnnotationType_I16: return "I16"
- case AnnotationType_I32: return "I32"
- case AnnotationType_I64: return "I64"
- case AnnotationType_DOUBLE: return "DOUBLE"
- case AnnotationType_STRING: return "STRING"
- }
- return ""
+ switch p {
+ case AnnotationType_BOOL:
+ return "BOOL"
+ case AnnotationType_BYTES:
+ return "BYTES"
+ case AnnotationType_I16:
+ return "I16"
+ case AnnotationType_I32:
+ return "I32"
+ case AnnotationType_I64:
+ return "I64"
+ case AnnotationType_DOUBLE:
+ return "DOUBLE"
+ case AnnotationType_STRING:
+ return "STRING"
+ }
+ return ""
}
func AnnotationTypeFromString(s string) (AnnotationType, error) {
- switch s {
- case "BOOL": return AnnotationType_BOOL, nil
- case "BYTES": return AnnotationType_BYTES, nil
- case "I16": return AnnotationType_I16, nil
- case "I32": return AnnotationType_I32, nil
- case "I64": return AnnotationType_I64, nil
- case "DOUBLE": return AnnotationType_DOUBLE, nil
- case "STRING": return AnnotationType_STRING, nil
- }
- return AnnotationType(0), fmt.Errorf("not a valid AnnotationType string")
+ switch s {
+ case "BOOL":
+ return AnnotationType_BOOL, nil
+ case "BYTES":
+ return AnnotationType_BYTES, nil
+ case "I16":
+ return AnnotationType_I16, nil
+ case "I32":
+ return AnnotationType_I32, nil
+ case "I64":
+ return AnnotationType_I64, nil
+ case "DOUBLE":
+ return AnnotationType_DOUBLE, nil
+ case "STRING":
+ return AnnotationType_STRING, nil
+ }
+ return AnnotationType(0), fmt.Errorf("not a valid AnnotationType string")
}
-
func AnnotationTypePtr(v AnnotationType) *AnnotationType { return &v }
func (p AnnotationType) MarshalText() ([]byte, error) {
-return []byte(p.String()), nil
+ return []byte(p.String()), nil
}
func (p *AnnotationType) UnmarshalText(text []byte) error {
-q, err := AnnotationTypeFromString(string(text))
-if (err != nil) {
-return err
-}
-*p = q
-return nil
+ q, err := AnnotationTypeFromString(string(text))
+ if err != nil {
+ return err
+ }
+ *p = q
+ return nil
}
func (p *AnnotationType) Scan(value interface{}) error {
-v, ok := value.(int64)
-if !ok {
-return errors.New("Scan value is not int64")
-}
-*p = AnnotationType(v)
-return nil
+ v, ok := value.(int64)
+ if !ok {
+ return errors.New("Scan value is not int64")
+ }
+ *p = AnnotationType(v)
+ return nil
}
-func (p * AnnotationType) Value() (driver.Value, error) {
- if p == nil {
- return nil, nil
- }
-return int64(*p), nil
+func (p *AnnotationType) Value() (driver.Value, error) {
+ if p == nil {
+ return nil, nil
+ }
+ return int64(*p), nil
}
+
// Indicates the network context of a service recording an annotation with two
// exceptions.
-//
+//
// When a BinaryAnnotation, and key is CLIENT_ADDR or SERVER_ADDR,
// the endpoint indicates the source or destination of an RPC. This exception
// allows zipkin to display network context of uninstrumented services, or
// clients such as web browsers.
-//
+//
// Attributes:
-// - Ipv4: IPv4 host address packed into 4 bytes.
-//
+// - Ipv4: IPv4 host address packed into 4 bytes.
+//
// Ex for the ip 1.2.3.4, it would be (1 << 24) | (2 << 16) | (3 << 8) | 4
-// - Port: IPv4 port
-//
+// - Port: IPv4 port
+//
// Note: this is to be treated as an unsigned integer, so watch for negatives.
-//
+//
// Conventionally, when the port isn't known, port = 0.
-// - ServiceName: Service name in lowercase, such as "memcache" or "zipkin-web"
-//
+// - ServiceName: Service name in lowercase, such as "memcache" or "zipkin-web"
+//
// Conventionally, when the service name isn't known, service_name = "unknown".
-// - Ipv6: IPv6 host address packed into 16 bytes. Ex Inet6Address.getBytes()
+// - Ipv6: IPv6 host address packed into 16 bytes. Ex Inet6Address.getBytes()
type Endpoint struct {
- Ipv4 int32 `thrift:"ipv4,1" db:"ipv4" json:"ipv4"`
- Port int16 `thrift:"port,2" db:"port" json:"port"`
- ServiceName string `thrift:"service_name,3" db:"service_name" json:"service_name"`
- Ipv6 []byte `thrift:"ipv6,4" db:"ipv6" json:"ipv6,omitempty"`
+ Ipv4 int32 `thrift:"ipv4,1" db:"ipv4" json:"ipv4"`
+ Port int16 `thrift:"port,2" db:"port" json:"port"`
+ ServiceName string `thrift:"service_name,3" db:"service_name" json:"service_name"`
+ Ipv6 []byte `thrift:"ipv6,4" db:"ipv6" json:"ipv6,omitempty"`
}
func NewEndpoint() *Endpoint {
- return &Endpoint{}
+ return &Endpoint{}
}
-
func (p *Endpoint) GetIpv4() int32 {
- return p.Ipv4
+ return p.Ipv4
}
func (p *Endpoint) GetPort() int16 {
- return p.Port
+ return p.Port
}
func (p *Endpoint) GetServiceName() string {
- return p.ServiceName
+ return p.ServiceName
}
+
var Endpoint_Ipv6_DEFAULT []byte
func (p *Endpoint) GetIpv6() []byte {
- return p.Ipv6
+ return p.Ipv6
}
func (p *Endpoint) IsSetIpv6() bool {
- return p.Ipv6 != nil
+ return p.Ipv6 != nil
}
func (p *Endpoint) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.I32 {
- if err := p.ReadField1(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 2:
- if fieldTypeId == thrift.I16 {
- if err := p.ReadField2(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 3:
- if fieldTypeId == thrift.STRING {
- if err := p.ReadField3(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 4:
- if fieldTypeId == thrift.STRING {
- if err := p.ReadField4(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- return nil
-}
-
-func (p *Endpoint) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI32(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.Ipv4 = v
-}
- return nil
-}
-
-func (p *Endpoint) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI16(ctx); err != nil {
- return thrift.PrependError("error reading field 2: ", err)
-} else {
- p.Port = v
-}
- return nil
-}
-
-func (p *Endpoint) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadString(ctx); err != nil {
- return thrift.PrependError("error reading field 3: ", err)
-} else {
- p.ServiceName = v
-}
- return nil
-}
-
-func (p *Endpoint) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadBinary(ctx); err != nil {
- return thrift.PrependError("error reading field 4: ", err)
-} else {
- p.Ipv6 = v
-}
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.I32 {
+ if err := p.ReadField1(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 2:
+ if fieldTypeId == thrift.I16 {
+ if err := p.ReadField2(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 3:
+ if fieldTypeId == thrift.STRING {
+ if err := p.ReadField3(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 4:
+ if fieldTypeId == thrift.STRING {
+ if err := p.ReadField4(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ return nil
+}
+
+func (p *Endpoint) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI32(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.Ipv4 = v
+ }
+ return nil
+}
+
+func (p *Endpoint) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI16(ctx); err != nil {
+ return thrift.PrependError("error reading field 2: ", err)
+ } else {
+ p.Port = v
+ }
+ return nil
+}
+
+func (p *Endpoint) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadString(ctx); err != nil {
+ return thrift.PrependError("error reading field 3: ", err)
+ } else {
+ p.ServiceName = v
+ }
+ return nil
+}
+
+func (p *Endpoint) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadBinary(ctx); err != nil {
+ return thrift.PrependError("error reading field 4: ", err)
+ } else {
+ p.Ipv6 = v
+ }
+ return nil
}
func (p *Endpoint) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "Endpoint"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- if err := p.writeField2(ctx, oprot); err != nil { return err }
- if err := p.writeField3(ctx, oprot); err != nil { return err }
- if err := p.writeField4(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "Endpoint"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField2(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField3(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField4(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *Endpoint) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "ipv4", thrift.I32, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ipv4: ", p), err) }
- if err := oprot.WriteI32(ctx, int32(p.Ipv4)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.ipv4 (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ipv4: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "ipv4", thrift.I32, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ipv4: ", p), err)
+ }
+ if err := oprot.WriteI32(ctx, int32(p.Ipv4)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.ipv4 (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ipv4: ", p), err)
+ }
+ return err
}
func (p *Endpoint) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "port", thrift.I16, 2); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:port: ", p), err) }
- if err := oprot.WriteI16(ctx, int16(p.Port)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.port (2) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 2:port: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "port", thrift.I16, 2); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:port: ", p), err)
+ }
+ if err := oprot.WriteI16(ctx, int16(p.Port)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.port (2) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 2:port: ", p), err)
+ }
+ return err
}
func (p *Endpoint) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "service_name", thrift.STRING, 3); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:service_name: ", p), err) }
- if err := oprot.WriteString(ctx, string(p.ServiceName)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.service_name (3) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 3:service_name: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "service_name", thrift.STRING, 3); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:service_name: ", p), err)
+ }
+ if err := oprot.WriteString(ctx, string(p.ServiceName)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.service_name (3) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 3:service_name: ", p), err)
+ }
+ return err
}
func (p *Endpoint) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetIpv6() {
- if err := oprot.WriteFieldBegin(ctx, "ipv6", thrift.STRING, 4); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:ipv6: ", p), err) }
- if err := oprot.WriteBinary(ctx, p.Ipv6); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.ipv6 (4) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 4:ipv6: ", p), err) }
- }
- return err
+ if p.IsSetIpv6() {
+ if err := oprot.WriteFieldBegin(ctx, "ipv6", thrift.STRING, 4); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:ipv6: ", p), err)
+ }
+ if err := oprot.WriteBinary(ctx, p.Ipv6); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.ipv6 (4) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 4:ipv6: ", p), err)
+ }
+ }
+ return err
}
func (p *Endpoint) Equals(other *Endpoint) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.Ipv4 != other.Ipv4 { return false }
- if p.Port != other.Port { return false }
- if p.ServiceName != other.ServiceName { return false }
- if bytes.Compare(p.Ipv6, other.Ipv6) != 0 { return false }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.Ipv4 != other.Ipv4 {
+ return false
+ }
+ if p.Port != other.Port {
+ return false
+ }
+ if p.ServiceName != other.ServiceName {
+ return false
+ }
+ if bytes.Compare(p.Ipv6, other.Ipv6) != 0 {
+ return false
+ }
+ return true
}
func (p *Endpoint) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("Endpoint(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("Endpoint(%+v)", *p)
}
// An annotation is similar to a log statement. It includes a host field which
// allows these events to be attributed properly, and also aggregatable.
-//
+//
// Attributes:
-// - Timestamp: Microseconds from epoch.
-//
+// - Timestamp: Microseconds from epoch.
+//
// This value should use the most precise value possible. For example,
// gettimeofday or syncing nanoTime against a tick of currentTimeMillis.
-// - Value
-// - Host: Always the host that recorded the event. By specifying the host you allow
+// - Value
+// - Host: Always the host that recorded the event. By specifying the host you allow
+//
// rollup of all events (such as client requests to a service) by IP address.
type Annotation struct {
- Timestamp int64 `thrift:"timestamp,1" db:"timestamp" json:"timestamp"`
- Value string `thrift:"value,2" db:"value" json:"value"`
- Host *Endpoint `thrift:"host,3" db:"host" json:"host,omitempty"`
+ Timestamp int64 `thrift:"timestamp,1" db:"timestamp" json:"timestamp"`
+ Value string `thrift:"value,2" db:"value" json:"value"`
+ Host *Endpoint `thrift:"host,3" db:"host" json:"host,omitempty"`
}
func NewAnnotation() *Annotation {
- return &Annotation{}
+ return &Annotation{}
}
-
func (p *Annotation) GetTimestamp() int64 {
- return p.Timestamp
+ return p.Timestamp
}
func (p *Annotation) GetValue() string {
- return p.Value
+ return p.Value
}
+
var Annotation_Host_DEFAULT *Endpoint
+
func (p *Annotation) GetHost() *Endpoint {
- if !p.IsSetHost() {
- return Annotation_Host_DEFAULT
- }
-return p.Host
+ if !p.IsSetHost() {
+ return Annotation_Host_DEFAULT
+ }
+ return p.Host
}
func (p *Annotation) IsSetHost() bool {
- return p.Host != nil
+ return p.Host != nil
}
func (p *Annotation) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.I64 {
- if err := p.ReadField1(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 2:
- if fieldTypeId == thrift.STRING {
- if err := p.ReadField2(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 3:
- if fieldTypeId == thrift.STRUCT {
- if err := p.ReadField3(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- return nil
-}
-
-func (p *Annotation) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.Timestamp = v
-}
- return nil
-}
-
-func (p *Annotation) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadString(ctx); err != nil {
- return thrift.PrependError("error reading field 2: ", err)
-} else {
- p.Value = v
-}
- return nil
-}
-
-func (p *Annotation) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
- p.Host = &Endpoint{}
- if err := p.Host.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Host), err)
- }
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.I64 {
+ if err := p.ReadField1(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 2:
+ if fieldTypeId == thrift.STRING {
+ if err := p.ReadField2(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 3:
+ if fieldTypeId == thrift.STRUCT {
+ if err := p.ReadField3(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ return nil
+}
+
+func (p *Annotation) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.Timestamp = v
+ }
+ return nil
+}
+
+func (p *Annotation) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadString(ctx); err != nil {
+ return thrift.PrependError("error reading field 2: ", err)
+ } else {
+ p.Value = v
+ }
+ return nil
+}
+
+func (p *Annotation) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
+ p.Host = &Endpoint{}
+ if err := p.Host.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Host), err)
+ }
+ return nil
}
func (p *Annotation) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "Annotation"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- if err := p.writeField2(ctx, oprot); err != nil { return err }
- if err := p.writeField3(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "Annotation"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField2(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField3(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *Annotation) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:timestamp: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(p.Timestamp)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.timestamp (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:timestamp: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:timestamp: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(p.Timestamp)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.timestamp (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:timestamp: ", p), err)
+ }
+ return err
}
func (p *Annotation) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRING, 2); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:value: ", p), err) }
- if err := oprot.WriteString(ctx, string(p.Value)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.value (2) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 2:value: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRING, 2); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:value: ", p), err)
+ }
+ if err := oprot.WriteString(ctx, string(p.Value)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.value (2) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 2:value: ", p), err)
+ }
+ return err
}
func (p *Annotation) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetHost() {
- if err := oprot.WriteFieldBegin(ctx, "host", thrift.STRUCT, 3); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:host: ", p), err) }
- if err := p.Host.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Host), err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 3:host: ", p), err) }
- }
- return err
+ if p.IsSetHost() {
+ if err := oprot.WriteFieldBegin(ctx, "host", thrift.STRUCT, 3); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:host: ", p), err)
+ }
+ if err := p.Host.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Host), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 3:host: ", p), err)
+ }
+ }
+ return err
}
func (p *Annotation) Equals(other *Annotation) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.Timestamp != other.Timestamp { return false }
- if p.Value != other.Value { return false }
- if !p.Host.Equals(other.Host) { return false }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.Timestamp != other.Timestamp {
+ return false
+ }
+ if p.Value != other.Value {
+ return false
+ }
+ if !p.Host.Equals(other.Host) {
+ return false
+ }
+ return true
}
func (p *Annotation) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("Annotation(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("Annotation(%+v)", *p)
}
// Binary annotations are tags applied to a Span to give it context. For
// example, a binary annotation of "http.uri" could the path to a resource in a
// RPC call.
-//
+//
// Binary annotations of type STRING are always queryable, though more a
// historical implementation detail than a structural concern.
-//
+//
// Binary annotations can repeat, and vary on the host. Similar to Annotation,
// the host indicates who logged the event. This allows you to tell the
// difference between the client and server side of the same key. For example,
// the key "http.uri" might be different on the client and server side due to
// rewriting, like "/api/v1/myresource" vs "/myresource. Via the host field,
// you can see the different points of view, which often help in debugging.
-//
+//
// Attributes:
-// - Key
-// - Value
-// - AnnotationType
-// - Host: The host that recorded tag, which allows you to differentiate between
+// - Key
+// - Value
+// - AnnotationType
+// - Host: The host that recorded tag, which allows you to differentiate between
+//
// multiple tags with the same key. There are two exceptions to this.
-//
+//
// When the key is CLIENT_ADDR or SERVER_ADDR, host indicates the source or
// destination of an RPC. This exception allows zipkin to display network
// context of uninstrumented services, or clients such as web browsers.
type BinaryAnnotation struct {
- Key string `thrift:"key,1" db:"key" json:"key"`
- Value []byte `thrift:"value,2" db:"value" json:"value"`
- AnnotationType AnnotationType `thrift:"annotation_type,3" db:"annotation_type" json:"annotation_type"`
- Host *Endpoint `thrift:"host,4" db:"host" json:"host,omitempty"`
+ Key string `thrift:"key,1" db:"key" json:"key"`
+ Value []byte `thrift:"value,2" db:"value" json:"value"`
+ AnnotationType AnnotationType `thrift:"annotation_type,3" db:"annotation_type" json:"annotation_type"`
+ Host *Endpoint `thrift:"host,4" db:"host" json:"host,omitempty"`
}
func NewBinaryAnnotation() *BinaryAnnotation {
- return &BinaryAnnotation{}
+ return &BinaryAnnotation{}
}
-
func (p *BinaryAnnotation) GetKey() string {
- return p.Key
+ return p.Key
}
func (p *BinaryAnnotation) GetValue() []byte {
- return p.Value
+ return p.Value
}
func (p *BinaryAnnotation) GetAnnotationType() AnnotationType {
- return p.AnnotationType
+ return p.AnnotationType
}
+
var BinaryAnnotation_Host_DEFAULT *Endpoint
+
func (p *BinaryAnnotation) GetHost() *Endpoint {
- if !p.IsSetHost() {
- return BinaryAnnotation_Host_DEFAULT
- }
-return p.Host
+ if !p.IsSetHost() {
+ return BinaryAnnotation_Host_DEFAULT
+ }
+ return p.Host
}
func (p *BinaryAnnotation) IsSetHost() bool {
- return p.Host != nil
+ return p.Host != nil
}
func (p *BinaryAnnotation) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 2:
- if fieldTypeId == thrift.STRING {
- if err := p.ReadField2(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 3:
- if fieldTypeId == thrift.I32 {
- if err := p.ReadField3(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 4:
- if fieldTypeId == thrift.STRUCT {
- if err := p.ReadField4(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- return nil
-}
-
-func (p *BinaryAnnotation) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadString(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.Key = v
-}
- return nil
-}
-
-func (p *BinaryAnnotation) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadBinary(ctx); err != nil {
- return thrift.PrependError("error reading field 2: ", err)
-} else {
- p.Value = v
-}
- return nil
-}
-
-func (p *BinaryAnnotation) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI32(ctx); err != nil {
- return thrift.PrependError("error reading field 3: ", err)
-} else {
- temp := AnnotationType(v)
- p.AnnotationType = temp
-}
- return nil
-}
-
-func (p *BinaryAnnotation) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
- p.Host = &Endpoint{}
- if err := p.Host.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Host), err)
- }
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 2:
+ if fieldTypeId == thrift.STRING {
+ if err := p.ReadField2(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 3:
+ if fieldTypeId == thrift.I32 {
+ if err := p.ReadField3(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 4:
+ if fieldTypeId == thrift.STRUCT {
+ if err := p.ReadField4(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ return nil
+}
+
+func (p *BinaryAnnotation) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadString(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.Key = v
+ }
+ return nil
+}
+
+func (p *BinaryAnnotation) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadBinary(ctx); err != nil {
+ return thrift.PrependError("error reading field 2: ", err)
+ } else {
+ p.Value = v
+ }
+ return nil
+}
+
+func (p *BinaryAnnotation) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI32(ctx); err != nil {
+ return thrift.PrependError("error reading field 3: ", err)
+ } else {
+ temp := AnnotationType(v)
+ p.AnnotationType = temp
+ }
+ return nil
+}
+
+func (p *BinaryAnnotation) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
+ p.Host = &Endpoint{}
+ if err := p.Host.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Host), err)
+ }
+ return nil
}
func (p *BinaryAnnotation) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "BinaryAnnotation"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- if err := p.writeField2(ctx, oprot); err != nil { return err }
- if err := p.writeField3(ctx, oprot); err != nil { return err }
- if err := p.writeField4(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "BinaryAnnotation"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField2(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField3(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField4(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *BinaryAnnotation) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRING, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) }
- if err := oprot.WriteString(ctx, string(p.Key)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRING, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err)
+ }
+ if err := oprot.WriteString(ctx, string(p.Key)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err)
+ }
+ return err
}
func (p *BinaryAnnotation) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRING, 2); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:value: ", p), err) }
- if err := oprot.WriteBinary(ctx, p.Value); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.value (2) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 2:value: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRING, 2); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:value: ", p), err)
+ }
+ if err := oprot.WriteBinary(ctx, p.Value); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.value (2) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 2:value: ", p), err)
+ }
+ return err
}
func (p *BinaryAnnotation) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "annotation_type", thrift.I32, 3); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:annotation_type: ", p), err) }
- if err := oprot.WriteI32(ctx, int32(p.AnnotationType)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.annotation_type (3) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 3:annotation_type: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "annotation_type", thrift.I32, 3); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:annotation_type: ", p), err)
+ }
+ if err := oprot.WriteI32(ctx, int32(p.AnnotationType)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.annotation_type (3) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 3:annotation_type: ", p), err)
+ }
+ return err
}
func (p *BinaryAnnotation) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetHost() {
- if err := oprot.WriteFieldBegin(ctx, "host", thrift.STRUCT, 4); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:host: ", p), err) }
- if err := p.Host.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Host), err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 4:host: ", p), err) }
- }
- return err
+ if p.IsSetHost() {
+ if err := oprot.WriteFieldBegin(ctx, "host", thrift.STRUCT, 4); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:host: ", p), err)
+ }
+ if err := p.Host.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Host), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 4:host: ", p), err)
+ }
+ }
+ return err
}
func (p *BinaryAnnotation) Equals(other *BinaryAnnotation) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.Key != other.Key { return false }
- if bytes.Compare(p.Value, other.Value) != 0 { return false }
- if p.AnnotationType != other.AnnotationType { return false }
- if !p.Host.Equals(other.Host) { return false }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.Key != other.Key {
+ return false
+ }
+ if bytes.Compare(p.Value, other.Value) != 0 {
+ return false
+ }
+ if p.AnnotationType != other.AnnotationType {
+ return false
+ }
+ if !p.Host.Equals(other.Host) {
+ return false
+ }
+ return true
}
func (p *BinaryAnnotation) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("BinaryAnnotation(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("BinaryAnnotation(%+v)", *p)
}
// A trace is a series of spans (often RPC calls) which form a latency tree.
-//
+//
// The root span is where trace_id = id and parent_id = Nil. The root span is
// usually the longest interval in the trace, starting with a SERVER_RECV
// annotation and ending with a SERVER_SEND.
-//
+//
// Attributes:
-// - TraceID
-// - Name: Span name in lowercase, rpc method for example
-//
+// - TraceID
+// - Name: Span name in lowercase, rpc method for example
+//
// Conventionally, when the span name isn't known, name = "unknown".
-// - ID
-// - ParentID
-// - Annotations
-// - BinaryAnnotations
-// - Debug
-// - Timestamp: Microseconds from epoch of the creation of this span.
-//
+// - ID
+// - ParentID
+// - Annotations
+// - BinaryAnnotations
+// - Debug
+// - Timestamp: Microseconds from epoch of the creation of this span.
+//
// This value should be set directly by instrumentation, using the most
// precise value possible. For example, gettimeofday or syncing nanoTime
// against a tick of currentTimeMillis.
-//
+//
// For compatibility with instrumentation that precede this field, collectors
// or span stores can derive this via Annotation.timestamp.
// For example, SERVER_RECV.timestamp or CLIENT_SEND.timestamp.
-//
+//
// This field is optional for compatibility with old data: first-party span
// stores are expected to support this at time of introduction.
-// - Duration: Measurement of duration in microseconds, used to support queries.
-//
+// - Duration: Measurement of duration in microseconds, used to support queries.
+//
// This value should be set directly, where possible. Doing so encourages
// precise measurement decoupled from problems of clocks, such as skew or NTP
// updates causing time to move backwards.
-//
+//
// For compatibility with instrumentation that precede this field, collectors
// or span stores can derive this by subtracting Annotation.timestamp.
// For example, SERVER_SEND.timestamp - SERVER_RECV.timestamp.
-//
+//
// If this field is persisted as unset, zipkin will continue to work, except
// duration query support will be implementation-specific. Similarly, setting
// this field non-atomically is implementation-specific.
-//
+//
// This field is i64 vs i32 to support spans longer than 35 minutes.
-// - TraceIDHigh: Optional unique 8-byte additional identifier for a trace. If non zero, this
+// - TraceIDHigh: Optional unique 8-byte additional identifier for a trace. If non zero, this
+//
// means the trace uses 128 bit traceIds instead of 64 bit.
type Span struct {
- TraceID int64 `thrift:"trace_id,1" db:"trace_id" json:"trace_id"`
- // unused field # 2
- Name string `thrift:"name,3" db:"name" json:"name"`
- ID int64 `thrift:"id,4" db:"id" json:"id"`
- ParentID *int64 `thrift:"parent_id,5" db:"parent_id" json:"parent_id,omitempty"`
- Annotations []*Annotation `thrift:"annotations,6" db:"annotations" json:"annotations"`
- // unused field # 7
- BinaryAnnotations []*BinaryAnnotation `thrift:"binary_annotations,8" db:"binary_annotations" json:"binary_annotations"`
- Debug bool `thrift:"debug,9" db:"debug" json:"debug"`
- Timestamp *int64 `thrift:"timestamp,10" db:"timestamp" json:"timestamp,omitempty"`
- Duration *int64 `thrift:"duration,11" db:"duration" json:"duration,omitempty"`
- TraceIDHigh *int64 `thrift:"trace_id_high,12" db:"trace_id_high" json:"trace_id_high,omitempty"`
+ TraceID int64 `thrift:"trace_id,1" db:"trace_id" json:"trace_id"`
+ // unused field # 2
+ Name string `thrift:"name,3" db:"name" json:"name"`
+ ID int64 `thrift:"id,4" db:"id" json:"id"`
+ ParentID *int64 `thrift:"parent_id,5" db:"parent_id" json:"parent_id,omitempty"`
+ Annotations []*Annotation `thrift:"annotations,6" db:"annotations" json:"annotations"`
+ // unused field # 7
+ BinaryAnnotations []*BinaryAnnotation `thrift:"binary_annotations,8" db:"binary_annotations" json:"binary_annotations"`
+ Debug bool `thrift:"debug,9" db:"debug" json:"debug"`
+ Timestamp *int64 `thrift:"timestamp,10" db:"timestamp" json:"timestamp,omitempty"`
+ Duration *int64 `thrift:"duration,11" db:"duration" json:"duration,omitempty"`
+ TraceIDHigh *int64 `thrift:"trace_id_high,12" db:"trace_id_high" json:"trace_id_high,omitempty"`
}
func NewSpan() *Span {
- return &Span{}
+ return &Span{}
}
-
func (p *Span) GetTraceID() int64 {
- return p.TraceID
+ return p.TraceID
}
func (p *Span) GetName() string {
- return p.Name
+ return p.Name
}
func (p *Span) GetID() int64 {
- return p.ID
+ return p.ID
}
+
var Span_ParentID_DEFAULT int64
+
func (p *Span) GetParentID() int64 {
- if !p.IsSetParentID() {
- return Span_ParentID_DEFAULT
- }
-return *p.ParentID
+ if !p.IsSetParentID() {
+ return Span_ParentID_DEFAULT
+ }
+ return *p.ParentID
}
func (p *Span) GetAnnotations() []*Annotation {
- return p.Annotations
+ return p.Annotations
}
func (p *Span) GetBinaryAnnotations() []*BinaryAnnotation {
- return p.BinaryAnnotations
+ return p.BinaryAnnotations
}
+
var Span_Debug_DEFAULT bool = false
func (p *Span) GetDebug() bool {
- return p.Debug
+ return p.Debug
}
+
var Span_Timestamp_DEFAULT int64
+
func (p *Span) GetTimestamp() int64 {
- if !p.IsSetTimestamp() {
- return Span_Timestamp_DEFAULT
- }
-return *p.Timestamp
+ if !p.IsSetTimestamp() {
+ return Span_Timestamp_DEFAULT
+ }
+ return *p.Timestamp
}
+
var Span_Duration_DEFAULT int64
+
func (p *Span) GetDuration() int64 {
- if !p.IsSetDuration() {
- return Span_Duration_DEFAULT
- }
-return *p.Duration
+ if !p.IsSetDuration() {
+ return Span_Duration_DEFAULT
+ }
+ return *p.Duration
}
+
var Span_TraceIDHigh_DEFAULT int64
+
func (p *Span) GetTraceIDHigh() int64 {
- if !p.IsSetTraceIDHigh() {
- return Span_TraceIDHigh_DEFAULT
- }
-return *p.TraceIDHigh
+ if !p.IsSetTraceIDHigh() {
+ return Span_TraceIDHigh_DEFAULT
+ }
+ return *p.TraceIDHigh
}
func (p *Span) IsSetParentID() bool {
- return p.ParentID != nil
+ return p.ParentID != nil
}
func (p *Span) IsSetDebug() bool {
- return p.Debug != Span_Debug_DEFAULT
+ return p.Debug != Span_Debug_DEFAULT
}
func (p *Span) IsSetTimestamp() bool {
- return p.Timestamp != nil
+ return p.Timestamp != nil
}
func (p *Span) IsSetDuration() bool {
- return p.Duration != nil
+ return p.Duration != nil
}
func (p *Span) IsSetTraceIDHigh() bool {
- return p.TraceIDHigh != nil
+ return p.TraceIDHigh != nil
}
func (p *Span) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.I64 {
- if err := p.ReadField1(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 3:
- if fieldTypeId == thrift.STRING {
- if err := p.ReadField3(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 4:
- if fieldTypeId == thrift.I64 {
- if err := p.ReadField4(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 5:
- if fieldTypeId == thrift.I64 {
- if err := p.ReadField5(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 6:
- if fieldTypeId == thrift.LIST {
- if err := p.ReadField6(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 8:
- if fieldTypeId == thrift.LIST {
- if err := p.ReadField8(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 9:
- if fieldTypeId == thrift.BOOL {
- if err := p.ReadField9(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 10:
- if fieldTypeId == thrift.I64 {
- if err := p.ReadField10(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 11:
- if fieldTypeId == thrift.I64 {
- if err := p.ReadField11(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- case 12:
- if fieldTypeId == thrift.I64 {
- if err := p.ReadField12(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- return nil
-}
-
-func (p *Span) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.TraceID = v
-}
- return nil
-}
-
-func (p *Span) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadString(ctx); err != nil {
- return thrift.PrependError("error reading field 3: ", err)
-} else {
- p.Name = v
-}
- return nil
-}
-
-func (p *Span) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 4: ", err)
-} else {
- p.ID = v
-}
- return nil
-}
-
-func (p *Span) ReadField5(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 5: ", err)
-} else {
- p.ParentID = &v
-}
- return nil
-}
-
-func (p *Span) ReadField6(ctx context.Context, iprot thrift.TProtocol) error {
- _, size, err := iprot.ReadListBegin(ctx)
- if err != nil {
- return thrift.PrependError("error reading list begin: ", err)
- }
- tSlice := make([]*Annotation, 0, size)
- p.Annotations = tSlice
- for i := 0; i < size; i ++ {
- _elem0 := &Annotation{}
- if err := _elem0.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem0), err)
- }
- p.Annotations = append(p.Annotations, _elem0)
- }
- if err := iprot.ReadListEnd(ctx); err != nil {
- return thrift.PrependError("error reading list end: ", err)
- }
- return nil
-}
-
-func (p *Span) ReadField8(ctx context.Context, iprot thrift.TProtocol) error {
- _, size, err := iprot.ReadListBegin(ctx)
- if err != nil {
- return thrift.PrependError("error reading list begin: ", err)
- }
- tSlice := make([]*BinaryAnnotation, 0, size)
- p.BinaryAnnotations = tSlice
- for i := 0; i < size; i ++ {
- _elem1 := &BinaryAnnotation{}
- if err := _elem1.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem1), err)
- }
- p.BinaryAnnotations = append(p.BinaryAnnotations, _elem1)
- }
- if err := iprot.ReadListEnd(ctx); err != nil {
- return thrift.PrependError("error reading list end: ", err)
- }
- return nil
-}
-
-func (p *Span) ReadField9(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadBool(ctx); err != nil {
- return thrift.PrependError("error reading field 9: ", err)
-} else {
- p.Debug = v
-}
- return nil
-}
-
-func (p *Span) ReadField10(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 10: ", err)
-} else {
- p.Timestamp = &v
-}
- return nil
-}
-
-func (p *Span) ReadField11(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 11: ", err)
-} else {
- p.Duration = &v
-}
- return nil
-}
-
-func (p *Span) ReadField12(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadI64(ctx); err != nil {
- return thrift.PrependError("error reading field 12: ", err)
-} else {
- p.TraceIDHigh = &v
-}
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.I64 {
+ if err := p.ReadField1(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 3:
+ if fieldTypeId == thrift.STRING {
+ if err := p.ReadField3(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 4:
+ if fieldTypeId == thrift.I64 {
+ if err := p.ReadField4(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 5:
+ if fieldTypeId == thrift.I64 {
+ if err := p.ReadField5(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 6:
+ if fieldTypeId == thrift.LIST {
+ if err := p.ReadField6(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 8:
+ if fieldTypeId == thrift.LIST {
+ if err := p.ReadField8(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 9:
+ if fieldTypeId == thrift.BOOL {
+ if err := p.ReadField9(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 10:
+ if fieldTypeId == thrift.I64 {
+ if err := p.ReadField10(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 11:
+ if fieldTypeId == thrift.I64 {
+ if err := p.ReadField11(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ case 12:
+ if fieldTypeId == thrift.I64 {
+ if err := p.ReadField12(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ return nil
+}
+
+func (p *Span) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.TraceID = v
+ }
+ return nil
+}
+
+func (p *Span) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadString(ctx); err != nil {
+ return thrift.PrependError("error reading field 3: ", err)
+ } else {
+ p.Name = v
+ }
+ return nil
+}
+
+func (p *Span) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 4: ", err)
+ } else {
+ p.ID = v
+ }
+ return nil
+}
+
+func (p *Span) ReadField5(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 5: ", err)
+ } else {
+ p.ParentID = &v
+ }
+ return nil
+}
+
+func (p *Span) ReadField6(ctx context.Context, iprot thrift.TProtocol) error {
+ _, size, err := iprot.ReadListBegin(ctx)
+ if err != nil {
+ return thrift.PrependError("error reading list begin: ", err)
+ }
+ tSlice := make([]*Annotation, 0, size)
+ p.Annotations = tSlice
+ for i := 0; i < size; i++ {
+ _elem0 := &Annotation{}
+ if err := _elem0.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem0), err)
+ }
+ p.Annotations = append(p.Annotations, _elem0)
+ }
+ if err := iprot.ReadListEnd(ctx); err != nil {
+ return thrift.PrependError("error reading list end: ", err)
+ }
+ return nil
+}
+
+func (p *Span) ReadField8(ctx context.Context, iprot thrift.TProtocol) error {
+ _, size, err := iprot.ReadListBegin(ctx)
+ if err != nil {
+ return thrift.PrependError("error reading list begin: ", err)
+ }
+ tSlice := make([]*BinaryAnnotation, 0, size)
+ p.BinaryAnnotations = tSlice
+ for i := 0; i < size; i++ {
+ _elem1 := &BinaryAnnotation{}
+ if err := _elem1.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem1), err)
+ }
+ p.BinaryAnnotations = append(p.BinaryAnnotations, _elem1)
+ }
+ if err := iprot.ReadListEnd(ctx); err != nil {
+ return thrift.PrependError("error reading list end: ", err)
+ }
+ return nil
+}
+
+func (p *Span) ReadField9(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadBool(ctx); err != nil {
+ return thrift.PrependError("error reading field 9: ", err)
+ } else {
+ p.Debug = v
+ }
+ return nil
+}
+
+func (p *Span) ReadField10(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 10: ", err)
+ } else {
+ p.Timestamp = &v
+ }
+ return nil
+}
+
+func (p *Span) ReadField11(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 11: ", err)
+ } else {
+ p.Duration = &v
+ }
+ return nil
+}
+
+func (p *Span) ReadField12(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadI64(ctx); err != nil {
+ return thrift.PrependError("error reading field 12: ", err)
+ } else {
+ p.TraceIDHigh = &v
+ }
+ return nil
}
func (p *Span) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "Span"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- if err := p.writeField3(ctx, oprot); err != nil { return err }
- if err := p.writeField4(ctx, oprot); err != nil { return err }
- if err := p.writeField5(ctx, oprot); err != nil { return err }
- if err := p.writeField6(ctx, oprot); err != nil { return err }
- if err := p.writeField8(ctx, oprot); err != nil { return err }
- if err := p.writeField9(ctx, oprot); err != nil { return err }
- if err := p.writeField10(ctx, oprot); err != nil { return err }
- if err := p.writeField11(ctx, oprot); err != nil { return err }
- if err := p.writeField12(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "Span"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField3(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField4(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField5(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField6(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField8(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField9(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField10(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField11(ctx, oprot); err != nil {
+ return err
+ }
+ if err := p.writeField12(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *Span) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "trace_id", thrift.I64, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:trace_id: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(p.TraceID)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.trace_id (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:trace_id: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "trace_id", thrift.I64, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:trace_id: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(p.TraceID)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.trace_id (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:trace_id: ", p), err)
+ }
+ return err
}
func (p *Span) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 3); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:name: ", p), err) }
- if err := oprot.WriteString(ctx, string(p.Name)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.name (3) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 3:name: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 3); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:name: ", p), err)
+ }
+ if err := oprot.WriteString(ctx, string(p.Name)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.name (3) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 3:name: ", p), err)
+ }
+ return err
}
func (p *Span) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "id", thrift.I64, 4); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:id: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(p.ID)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.id (4) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 4:id: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "id", thrift.I64, 4); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:id: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(p.ID)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.id (4) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 4:id: ", p), err)
+ }
+ return err
}
func (p *Span) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetParentID() {
- if err := oprot.WriteFieldBegin(ctx, "parent_id", thrift.I64, 5); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:parent_id: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(*p.ParentID)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.parent_id (5) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 5:parent_id: ", p), err) }
- }
- return err
+ if p.IsSetParentID() {
+ if err := oprot.WriteFieldBegin(ctx, "parent_id", thrift.I64, 5); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:parent_id: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(*p.ParentID)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.parent_id (5) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 5:parent_id: ", p), err)
+ }
+ }
+ return err
}
func (p *Span) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "annotations", thrift.LIST, 6); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:annotations: ", p), err) }
- if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Annotations)); err != nil {
- return thrift.PrependError("error writing list begin: ", err)
- }
- for _, v := range p.Annotations {
- if err := v.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
- }
- }
- if err := oprot.WriteListEnd(ctx); err != nil {
- return thrift.PrependError("error writing list end: ", err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 6:annotations: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "annotations", thrift.LIST, 6); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:annotations: ", p), err)
+ }
+ if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Annotations)); err != nil {
+ return thrift.PrependError("error writing list begin: ", err)
+ }
+ for _, v := range p.Annotations {
+ if err := v.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
+ }
+ }
+ if err := oprot.WriteListEnd(ctx); err != nil {
+ return thrift.PrependError("error writing list end: ", err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 6:annotations: ", p), err)
+ }
+ return err
}
func (p *Span) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "binary_annotations", thrift.LIST, 8); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:binary_annotations: ", p), err) }
- if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.BinaryAnnotations)); err != nil {
- return thrift.PrependError("error writing list begin: ", err)
- }
- for _, v := range p.BinaryAnnotations {
- if err := v.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
- }
- }
- if err := oprot.WriteListEnd(ctx); err != nil {
- return thrift.PrependError("error writing list end: ", err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 8:binary_annotations: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "binary_annotations", thrift.LIST, 8); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:binary_annotations: ", p), err)
+ }
+ if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.BinaryAnnotations)); err != nil {
+ return thrift.PrependError("error writing list begin: ", err)
+ }
+ for _, v := range p.BinaryAnnotations {
+ if err := v.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
+ }
+ }
+ if err := oprot.WriteListEnd(ctx); err != nil {
+ return thrift.PrependError("error writing list end: ", err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 8:binary_annotations: ", p), err)
+ }
+ return err
}
func (p *Span) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetDebug() {
- if err := oprot.WriteFieldBegin(ctx, "debug", thrift.BOOL, 9); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:debug: ", p), err) }
- if err := oprot.WriteBool(ctx, bool(p.Debug)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.debug (9) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 9:debug: ", p), err) }
- }
- return err
+ if p.IsSetDebug() {
+ if err := oprot.WriteFieldBegin(ctx, "debug", thrift.BOOL, 9); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:debug: ", p), err)
+ }
+ if err := oprot.WriteBool(ctx, bool(p.Debug)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.debug (9) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 9:debug: ", p), err)
+ }
+ }
+ return err
}
func (p *Span) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetTimestamp() {
- if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 10); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:timestamp: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(*p.Timestamp)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.timestamp (10) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 10:timestamp: ", p), err) }
- }
- return err
+ if p.IsSetTimestamp() {
+ if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 10); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:timestamp: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(*p.Timestamp)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.timestamp (10) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 10:timestamp: ", p), err)
+ }
+ }
+ return err
}
func (p *Span) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetDuration() {
- if err := oprot.WriteFieldBegin(ctx, "duration", thrift.I64, 11); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:duration: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(*p.Duration)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.duration (11) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 11:duration: ", p), err) }
- }
- return err
+ if p.IsSetDuration() {
+ if err := oprot.WriteFieldBegin(ctx, "duration", thrift.I64, 11); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:duration: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(*p.Duration)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.duration (11) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 11:duration: ", p), err)
+ }
+ }
+ return err
}
func (p *Span) writeField12(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetTraceIDHigh() {
- if err := oprot.WriteFieldBegin(ctx, "trace_id_high", thrift.I64, 12); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 12:trace_id_high: ", p), err) }
- if err := oprot.WriteI64(ctx, int64(*p.TraceIDHigh)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.trace_id_high (12) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 12:trace_id_high: ", p), err) }
- }
- return err
+ if p.IsSetTraceIDHigh() {
+ if err := oprot.WriteFieldBegin(ctx, "trace_id_high", thrift.I64, 12); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 12:trace_id_high: ", p), err)
+ }
+ if err := oprot.WriteI64(ctx, int64(*p.TraceIDHigh)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.trace_id_high (12) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 12:trace_id_high: ", p), err)
+ }
+ }
+ return err
}
func (p *Span) Equals(other *Span) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.TraceID != other.TraceID { return false }
- if p.Name != other.Name { return false }
- if p.ID != other.ID { return false }
- if p.ParentID != other.ParentID {
- if p.ParentID == nil || other.ParentID == nil {
- return false
- }
- if (*p.ParentID) != (*other.ParentID) { return false }
- }
- if len(p.Annotations) != len(other.Annotations) { return false }
- for i, _tgt := range p.Annotations {
- _src2 := other.Annotations[i]
- if !_tgt.Equals(_src2) { return false }
- }
- if len(p.BinaryAnnotations) != len(other.BinaryAnnotations) { return false }
- for i, _tgt := range p.BinaryAnnotations {
- _src3 := other.BinaryAnnotations[i]
- if !_tgt.Equals(_src3) { return false }
- }
- if p.Debug != other.Debug { return false }
- if p.Timestamp != other.Timestamp {
- if p.Timestamp == nil || other.Timestamp == nil {
- return false
- }
- if (*p.Timestamp) != (*other.Timestamp) { return false }
- }
- if p.Duration != other.Duration {
- if p.Duration == nil || other.Duration == nil {
- return false
- }
- if (*p.Duration) != (*other.Duration) { return false }
- }
- if p.TraceIDHigh != other.TraceIDHigh {
- if p.TraceIDHigh == nil || other.TraceIDHigh == nil {
- return false
- }
- if (*p.TraceIDHigh) != (*other.TraceIDHigh) { return false }
- }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.TraceID != other.TraceID {
+ return false
+ }
+ if p.Name != other.Name {
+ return false
+ }
+ if p.ID != other.ID {
+ return false
+ }
+ if p.ParentID != other.ParentID {
+ if p.ParentID == nil || other.ParentID == nil {
+ return false
+ }
+ if (*p.ParentID) != (*other.ParentID) {
+ return false
+ }
+ }
+ if len(p.Annotations) != len(other.Annotations) {
+ return false
+ }
+ for i, _tgt := range p.Annotations {
+ _src2 := other.Annotations[i]
+ if !_tgt.Equals(_src2) {
+ return false
+ }
+ }
+ if len(p.BinaryAnnotations) != len(other.BinaryAnnotations) {
+ return false
+ }
+ for i, _tgt := range p.BinaryAnnotations {
+ _src3 := other.BinaryAnnotations[i]
+ if !_tgt.Equals(_src3) {
+ return false
+ }
+ }
+ if p.Debug != other.Debug {
+ return false
+ }
+ if p.Timestamp != other.Timestamp {
+ if p.Timestamp == nil || other.Timestamp == nil {
+ return false
+ }
+ if (*p.Timestamp) != (*other.Timestamp) {
+ return false
+ }
+ }
+ if p.Duration != other.Duration {
+ if p.Duration == nil || other.Duration == nil {
+ return false
+ }
+ if (*p.Duration) != (*other.Duration) {
+ return false
+ }
+ }
+ if p.TraceIDHigh != other.TraceIDHigh {
+ if p.TraceIDHigh == nil || other.TraceIDHigh == nil {
+ return false
+ }
+ if (*p.TraceIDHigh) != (*other.TraceIDHigh) {
+ return false
+ }
+ }
+ return true
}
func (p *Span) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("Span(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("Span(%+v)", *p)
}
// Attributes:
-// - Ok
+// - Ok
type Response struct {
- Ok bool `thrift:"ok,1,required" db:"ok" json:"ok"`
+ Ok bool `thrift:"ok,1,required" db:"ok" json:"ok"`
}
func NewResponse() *Response {
- return &Response{}
+ return &Response{}
}
-
func (p *Response) GetOk() bool {
- return p.Ok
+ return p.Ok
}
func (p *Response) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
- var issetOk bool = false;
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.BOOL {
- if err := p.ReadField1(ctx, iprot); err != nil {
- return err
- }
- issetOk = true
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- if !issetOk{
- return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Ok is not set"));
- }
- return nil
-}
-
-func (p *Response) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- if v, err := iprot.ReadBool(ctx); err != nil {
- return thrift.PrependError("error reading field 1: ", err)
-} else {
- p.Ok = v
-}
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ var issetOk bool = false
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.BOOL {
+ if err := p.ReadField1(ctx, iprot); err != nil {
+ return err
+ }
+ issetOk = true
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ if !issetOk {
+ return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Ok is not set"))
+ }
+ return nil
+}
+
+func (p *Response) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ if v, err := iprot.ReadBool(ctx); err != nil {
+ return thrift.PrependError("error reading field 1: ", err)
+ } else {
+ p.Ok = v
+ }
+ return nil
}
func (p *Response) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "Response"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "Response"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *Response) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "ok", thrift.BOOL, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ok: ", p), err) }
- if err := oprot.WriteBool(ctx, bool(p.Ok)); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T.ok (1) field write error: ", p), err) }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ok: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "ok", thrift.BOOL, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ok: ", p), err)
+ }
+ if err := oprot.WriteBool(ctx, bool(p.Ok)); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T.ok (1) field write error: ", p), err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ok: ", p), err)
+ }
+ return err
}
func (p *Response) Equals(other *Response) bool {
- if p == other {
- return true
- } else if p == nil || other == nil {
- return false
- }
- if p.Ok != other.Ok { return false }
- return true
+ if p == other {
+ return true
+ } else if p == nil || other == nil {
+ return false
+ }
+ if p.Ok != other.Ok {
+ return false
+ }
+ return true
}
func (p *Response) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("Response(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("Response(%+v)", *p)
}
type ZipkinCollector interface {
- // Parameters:
- // - Spans
- SubmitZipkinBatch(ctx context.Context, spans []*Span) (_r []*Response, _err error)
+ // Parameters:
+ // - Spans
+ SubmitZipkinBatch(ctx context.Context, spans []*Span) (_r []*Response, _err error)
}
type ZipkinCollectorClient struct {
- c thrift.TClient
- meta thrift.ResponseMeta
+ c thrift.TClient
+ meta thrift.ResponseMeta
}
func NewZipkinCollectorClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ZipkinCollectorClient {
- return &ZipkinCollectorClient{
- c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
- }
+ return &ZipkinCollectorClient{
+ c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
+ }
}
func NewZipkinCollectorClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ZipkinCollectorClient {
- return &ZipkinCollectorClient{
- c: thrift.NewTStandardClient(iprot, oprot),
- }
+ return &ZipkinCollectorClient{
+ c: thrift.NewTStandardClient(iprot, oprot),
+ }
}
func NewZipkinCollectorClient(c thrift.TClient) *ZipkinCollectorClient {
- return &ZipkinCollectorClient{
- c: c,
- }
+ return &ZipkinCollectorClient{
+ c: c,
+ }
}
func (p *ZipkinCollectorClient) Client_() thrift.TClient {
- return p.c
+ return p.c
}
func (p *ZipkinCollectorClient) LastResponseMeta_() thrift.ResponseMeta {
- return p.meta
+ return p.meta
}
func (p *ZipkinCollectorClient) SetLastResponseMeta_(meta thrift.ResponseMeta) {
- p.meta = meta
+ p.meta = meta
}
// Parameters:
-// - Spans
+// - Spans
func (p *ZipkinCollectorClient) SubmitZipkinBatch(ctx context.Context, spans []*Span) (_r []*Response, _err error) {
- var _args4 ZipkinCollectorSubmitZipkinBatchArgs
- _args4.Spans = spans
- var _result6 ZipkinCollectorSubmitZipkinBatchResult
- var _meta5 thrift.ResponseMeta
- _meta5, _err = p.Client_().Call(ctx, "submitZipkinBatch", &_args4, &_result6)
- p.SetLastResponseMeta_(_meta5)
- if _err != nil {
- return
- }
- return _result6.GetSuccess(), nil
+ var _args4 ZipkinCollectorSubmitZipkinBatchArgs
+ _args4.Spans = spans
+ var _result6 ZipkinCollectorSubmitZipkinBatchResult
+ var _meta5 thrift.ResponseMeta
+ _meta5, _err = p.Client_().Call(ctx, "submitZipkinBatch", &_args4, &_result6)
+ p.SetLastResponseMeta_(_meta5)
+ if _err != nil {
+ return
+ }
+ return _result6.GetSuccess(), nil
}
type ZipkinCollectorProcessor struct {
- processorMap map[string]thrift.TProcessorFunction
- handler ZipkinCollector
+ processorMap map[string]thrift.TProcessorFunction
+ handler ZipkinCollector
}
func (p *ZipkinCollectorProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
- p.processorMap[key] = processor
+ p.processorMap[key] = processor
}
func (p *ZipkinCollectorProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
- processor, ok = p.processorMap[key]
- return processor, ok
+ processor, ok = p.processorMap[key]
+ return processor, ok
}
func (p *ZipkinCollectorProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
- return p.processorMap
+ return p.processorMap
}
func NewZipkinCollectorProcessor(handler ZipkinCollector) *ZipkinCollectorProcessor {
- self7 := &ZipkinCollectorProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)}
- self7.processorMap["submitZipkinBatch"] = &zipkinCollectorProcessorSubmitZipkinBatch{handler:handler}
-return self7
+ self7 := &ZipkinCollectorProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
+ self7.processorMap["submitZipkinBatch"] = &zipkinCollectorProcessorSubmitZipkinBatch{handler: handler}
+ return self7
}
func (p *ZipkinCollectorProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
- name, _, seqId, err2 := iprot.ReadMessageBegin(ctx)
- if err2 != nil { return false, thrift.WrapTException(err2) }
- if processor, ok := p.GetProcessorFunction(name); ok {
- return processor.Process(ctx, seqId, iprot, oprot)
- }
- iprot.Skip(ctx, thrift.STRUCT)
- iprot.ReadMessageEnd(ctx)
- x8 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name)
- oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId)
- x8.Write(ctx, oprot)
- oprot.WriteMessageEnd(ctx)
- oprot.Flush(ctx)
- return false, x8
+ name, _, seqId, err2 := iprot.ReadMessageBegin(ctx)
+ if err2 != nil {
+ return false, thrift.WrapTException(err2)
+ }
+ if processor, ok := p.GetProcessorFunction(name); ok {
+ return processor.Process(ctx, seqId, iprot, oprot)
+ }
+ iprot.Skip(ctx, thrift.STRUCT)
+ iprot.ReadMessageEnd(ctx)
+ x8 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
+ oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId)
+ x8.Write(ctx, oprot)
+ oprot.WriteMessageEnd(ctx)
+ oprot.Flush(ctx)
+ return false, x8
}
type zipkinCollectorProcessorSubmitZipkinBatch struct {
- handler ZipkinCollector
+ handler ZipkinCollector
}
func (p *zipkinCollectorProcessorSubmitZipkinBatch) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
- args := ZipkinCollectorSubmitZipkinBatchArgs{}
- var err2 error
- if err2 = args.Read(ctx, iprot); err2 != nil {
- iprot.ReadMessageEnd(ctx)
- x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
- oprot.WriteMessageBegin(ctx, "submitZipkinBatch", thrift.EXCEPTION, seqId)
- x.Write(ctx, oprot)
- oprot.WriteMessageEnd(ctx)
- oprot.Flush(ctx)
- return false, thrift.WrapTException(err2)
- }
- iprot.ReadMessageEnd(ctx)
-
- tickerCancel := func() {}
- // Start a goroutine to do server side connectivity check.
- if thrift.ServerConnectivityCheckInterval > 0 {
- var cancel context.CancelFunc
- ctx, cancel = context.WithCancel(ctx)
- defer cancel()
- var tickerCtx context.Context
- tickerCtx, tickerCancel = context.WithCancel(context.Background())
- defer tickerCancel()
- go func(ctx context.Context, cancel context.CancelFunc) {
- ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
- defer ticker.Stop()
- for {
- select {
- case <-ctx.Done():
- return
- case <-ticker.C:
- if !iprot.Transport().IsOpen() {
- cancel()
- return
- }
- }
- }
- }(tickerCtx, cancel)
- }
-
- result := ZipkinCollectorSubmitZipkinBatchResult{}
- var retval []*Response
- if retval, err2 = p.handler.SubmitZipkinBatch(ctx, args.Spans); err2 != nil {
- tickerCancel()
- if err2 == thrift.ErrAbandonRequest {
- return false, thrift.WrapTException(err2)
- }
- x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing submitZipkinBatch: " + err2.Error())
- oprot.WriteMessageBegin(ctx, "submitZipkinBatch", thrift.EXCEPTION, seqId)
- x.Write(ctx, oprot)
- oprot.WriteMessageEnd(ctx)
- oprot.Flush(ctx)
- return true, thrift.WrapTException(err2)
- } else {
- result.Success = retval
- }
- tickerCancel()
- if err2 = oprot.WriteMessageBegin(ctx, "submitZipkinBatch", thrift.REPLY, seqId); err2 != nil {
- err = thrift.WrapTException(err2)
- }
- if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
- err = thrift.WrapTException(err2)
- }
- if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
- err = thrift.WrapTException(err2)
- }
- if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
- err = thrift.WrapTException(err2)
- }
- if err != nil {
- return
- }
- return true, err
+ args := ZipkinCollectorSubmitZipkinBatchArgs{}
+ var err2 error
+ if err2 = args.Read(ctx, iprot); err2 != nil {
+ iprot.ReadMessageEnd(ctx)
+ x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
+ oprot.WriteMessageBegin(ctx, "submitZipkinBatch", thrift.EXCEPTION, seqId)
+ x.Write(ctx, oprot)
+ oprot.WriteMessageEnd(ctx)
+ oprot.Flush(ctx)
+ return false, thrift.WrapTException(err2)
+ }
+ iprot.ReadMessageEnd(ctx)
+
+ tickerCancel := func() {}
+ // Start a goroutine to do server side connectivity check.
+ if thrift.ServerConnectivityCheckInterval > 0 {
+ var cancel context.CancelFunc
+ ctx, cancel = context.WithCancel(ctx)
+ defer cancel()
+ var tickerCtx context.Context
+ tickerCtx, tickerCancel = context.WithCancel(context.Background())
+ defer tickerCancel()
+ go func(ctx context.Context, cancel context.CancelFunc) {
+ ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
+ defer ticker.Stop()
+ for {
+ select {
+ case <-ctx.Done():
+ return
+ case <-ticker.C:
+ if !iprot.Transport().IsOpen() {
+ cancel()
+ return
+ }
+ }
+ }
+ }(tickerCtx, cancel)
+ }
+
+ result := ZipkinCollectorSubmitZipkinBatchResult{}
+ var retval []*Response
+ if retval, err2 = p.handler.SubmitZipkinBatch(ctx, args.Spans); err2 != nil {
+ tickerCancel()
+ if err2 == thrift.ErrAbandonRequest {
+ return false, thrift.WrapTException(err2)
+ }
+ x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing submitZipkinBatch: "+err2.Error())
+ oprot.WriteMessageBegin(ctx, "submitZipkinBatch", thrift.EXCEPTION, seqId)
+ x.Write(ctx, oprot)
+ oprot.WriteMessageEnd(ctx)
+ oprot.Flush(ctx)
+ return true, thrift.WrapTException(err2)
+ } else {
+ result.Success = retval
+ }
+ tickerCancel()
+ if err2 = oprot.WriteMessageBegin(ctx, "submitZipkinBatch", thrift.REPLY, seqId); err2 != nil {
+ err = thrift.WrapTException(err2)
+ }
+ if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
+ err = thrift.WrapTException(err2)
+ }
+ if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
+ err = thrift.WrapTException(err2)
+ }
+ if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
+ err = thrift.WrapTException(err2)
+ }
+ if err != nil {
+ return
+ }
+ return true, err
}
-
// HELPER FUNCTIONS AND STRUCTURES
// Attributes:
-// - Spans
+// - Spans
type ZipkinCollectorSubmitZipkinBatchArgs struct {
- Spans []*Span `thrift:"spans,1" db:"spans" json:"spans"`
+ Spans []*Span `thrift:"spans,1" db:"spans" json:"spans"`
}
func NewZipkinCollectorSubmitZipkinBatchArgs() *ZipkinCollectorSubmitZipkinBatchArgs {
- return &ZipkinCollectorSubmitZipkinBatchArgs{}
+ return &ZipkinCollectorSubmitZipkinBatchArgs{}
}
-
func (p *ZipkinCollectorSubmitZipkinBatchArgs) GetSpans() []*Span {
- return p.Spans
+ return p.Spans
}
func (p *ZipkinCollectorSubmitZipkinBatchArgs) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- return nil
-}
-
-func (p *ZipkinCollectorSubmitZipkinBatchArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
- _, size, err := iprot.ReadListBegin(ctx)
- if err != nil {
- return thrift.PrependError("error reading list begin: ", err)
- }
- tSlice := make([]*Span, 0, size)
- p.Spans = tSlice
- for i := 0; i < size; i ++ {
- _elem9 := &Span{}
- if err := _elem9.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem9), err)
- }
- p.Spans = append(p.Spans, _elem9)
- }
- if err := iprot.ReadListEnd(ctx); err != nil {
- return thrift.PrependError("error reading list end: ", err)
- }
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ return nil
+}
+
+func (p *ZipkinCollectorSubmitZipkinBatchArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
+ _, size, err := iprot.ReadListBegin(ctx)
+ if err != nil {
+ return thrift.PrependError("error reading list begin: ", err)
+ }
+ tSlice := make([]*Span, 0, size)
+ p.Spans = tSlice
+ for i := 0; i < size; i++ {
+ _elem9 := &Span{}
+ if err := _elem9.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem9), err)
+ }
+ p.Spans = append(p.Spans, _elem9)
+ }
+ if err := iprot.ReadListEnd(ctx); err != nil {
+ return thrift.PrependError("error reading list end: ", err)
+ }
+ return nil
}
func (p *ZipkinCollectorSubmitZipkinBatchArgs) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "submitZipkinBatch_args"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField1(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "submitZipkinBatch_args"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField1(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *ZipkinCollectorSubmitZipkinBatchArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin(ctx, "spans", thrift.LIST, 1); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:spans: ", p), err) }
- if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Spans)); err != nil {
- return thrift.PrependError("error writing list begin: ", err)
- }
- for _, v := range p.Spans {
- if err := v.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
- }
- }
- if err := oprot.WriteListEnd(ctx); err != nil {
- return thrift.PrependError("error writing list end: ", err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 1:spans: ", p), err) }
- return err
+ if err := oprot.WriteFieldBegin(ctx, "spans", thrift.LIST, 1); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:spans: ", p), err)
+ }
+ if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Spans)); err != nil {
+ return thrift.PrependError("error writing list begin: ", err)
+ }
+ for _, v := range p.Spans {
+ if err := v.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
+ }
+ }
+ if err := oprot.WriteListEnd(ctx); err != nil {
+ return thrift.PrependError("error writing list end: ", err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 1:spans: ", p), err)
+ }
+ return err
}
func (p *ZipkinCollectorSubmitZipkinBatchArgs) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("ZipkinCollectorSubmitZipkinBatchArgs(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("ZipkinCollectorSubmitZipkinBatchArgs(%+v)", *p)
}
// Attributes:
-// - Success
+// - Success
type ZipkinCollectorSubmitZipkinBatchResult struct {
- Success []*Response `thrift:"success,0" db:"success" json:"success,omitempty"`
+ Success []*Response `thrift:"success,0" db:"success" json:"success,omitempty"`
}
func NewZipkinCollectorSubmitZipkinBatchResult() *ZipkinCollectorSubmitZipkinBatchResult {
- return &ZipkinCollectorSubmitZipkinBatchResult{}
+ return &ZipkinCollectorSubmitZipkinBatchResult{}
}
var ZipkinCollectorSubmitZipkinBatchResult_Success_DEFAULT []*Response
func (p *ZipkinCollectorSubmitZipkinBatchResult) GetSuccess() []*Response {
- return p.Success
+ return p.Success
}
func (p *ZipkinCollectorSubmitZipkinBatchResult) IsSetSuccess() bool {
- return p.Success != nil
+ return p.Success != nil
}
func (p *ZipkinCollectorSubmitZipkinBatchResult) Read(ctx context.Context, iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
- }
-
-
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
- 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.LIST {
- if err := p.ReadField0(ctx, iprot); err != nil {
- return err
- }
- } else {
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- default:
- if err := iprot.Skip(ctx, fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(ctx); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
- }
- return nil
-}
-
-func (p *ZipkinCollectorSubmitZipkinBatchResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
- _, size, err := iprot.ReadListBegin(ctx)
- if err != nil {
- return thrift.PrependError("error reading list begin: ", err)
- }
- tSlice := make([]*Response, 0, size)
- p.Success = tSlice
- for i := 0; i < size; i ++ {
- _elem10 := &Response{}
- if err := _elem10.Read(ctx, iprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem10), err)
- }
- p.Success = append(p.Success, _elem10)
- }
- if err := iprot.ReadListEnd(ctx); err != nil {
- return thrift.PrependError("error reading list end: ", err)
- }
- return nil
+ if _, err := iprot.ReadStructBegin(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
+ }
+
+ for {
+ _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
+ 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.LIST {
+ if err := p.ReadField0(ctx, iprot); err != nil {
+ return err
+ }
+ } else {
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ default:
+ if err := iprot.Skip(ctx, fieldTypeId); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadFieldEnd(ctx); err != nil {
+ return err
+ }
+ }
+ if err := iprot.ReadStructEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
+ }
+ return nil
+}
+
+func (p *ZipkinCollectorSubmitZipkinBatchResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
+ _, size, err := iprot.ReadListBegin(ctx)
+ if err != nil {
+ return thrift.PrependError("error reading list begin: ", err)
+ }
+ tSlice := make([]*Response, 0, size)
+ p.Success = tSlice
+ for i := 0; i < size; i++ {
+ _elem10 := &Response{}
+ if err := _elem10.Read(ctx, iprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem10), err)
+ }
+ p.Success = append(p.Success, _elem10)
+ }
+ if err := iprot.ReadListEnd(ctx); err != nil {
+ return thrift.PrependError("error reading list end: ", err)
+ }
+ return nil
}
func (p *ZipkinCollectorSubmitZipkinBatchResult) Write(ctx context.Context, oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin(ctx, "submitZipkinBatch_result"); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
- if p != nil {
- if err := p.writeField0(ctx, oprot); err != nil { return err }
- }
- if err := oprot.WriteFieldStop(ctx); err != nil {
- return thrift.PrependError("write field stop error: ", err) }
- if err := oprot.WriteStructEnd(ctx); err != nil {
- return thrift.PrependError("write struct stop error: ", err) }
- return nil
+ if err := oprot.WriteStructBegin(ctx, "submitZipkinBatch_result"); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
+ }
+ if p != nil {
+ if err := p.writeField0(ctx, oprot); err != nil {
+ return err
+ }
+ }
+ if err := oprot.WriteFieldStop(ctx); err != nil {
+ return thrift.PrependError("write field stop error: ", err)
+ }
+ if err := oprot.WriteStructEnd(ctx); err != nil {
+ return thrift.PrependError("write struct stop error: ", err)
+ }
+ return nil
}
func (p *ZipkinCollectorSubmitZipkinBatchResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) {
- if p.IsSetSuccess() {
- if err := oprot.WriteFieldBegin(ctx, "success", thrift.LIST, 0); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
- if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Success)); err != nil {
- return thrift.PrependError("error writing list begin: ", err)
- }
- for _, v := range p.Success {
- if err := v.Write(ctx, oprot); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
- }
- }
- if err := oprot.WriteListEnd(ctx); err != nil {
- return thrift.PrependError("error writing list end: ", err)
- }
- if err := oprot.WriteFieldEnd(ctx); err != nil {
- return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
- }
- return err
+ if p.IsSetSuccess() {
+ if err := oprot.WriteFieldBegin(ctx, "success", thrift.LIST, 0); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
+ }
+ if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Success)); err != nil {
+ return thrift.PrependError("error writing list begin: ", err)
+ }
+ for _, v := range p.Success {
+ if err := v.Write(ctx, oprot); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
+ }
+ }
+ if err := oprot.WriteListEnd(ctx); err != nil {
+ return thrift.PrependError("error writing list end: ", err)
+ }
+ if err := oprot.WriteFieldEnd(ctx); err != nil {
+ return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
+ }
+ }
+ return err
}
func (p *ZipkinCollectorSubmitZipkinBatchResult) String() string {
- if p == nil {
- return ""
- }
- return fmt.Sprintf("ZipkinCollectorSubmitZipkinBatchResult(%+v)", *p)
+ if p == nil {
+ return ""
+ }
+ return fmt.Sprintf("ZipkinCollectorSubmitZipkinBatchResult(%+v)", *p)
}
-
-