Documentation ¶
Overview ¶
Copyright 2020 The micro-boot Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func SetDefaultBoundarySamplerRate(rate float64)
- func SetDefaultBoundarySamplerSalt(salt int64)
- func SetDefaultCountingSamplerRate(rate float64)
- func SetDefaultModuloSamplerMod(mod uint64)
- func SetDefaultReporterBatchInterval(d time.Duration)
- func SetDefaultReporterBatchSize(num int)
- func SetDefaultReporterFlagsPrefix(prefix string)
- func SetDefaultReporterMaxBacklog(num int)
- func SetDefaultReporterTimeout(d time.Duration)
- func SetDefaultTracerAlwaysSample(b bool)
- func SetDefaultTracerExtractFailurePolicy(policy zipkin.ExtractFailurePolicy)
- func SetDefaultTracerFlagsPrefix(prefix string)
- func SetDefaultTracerGenerator(generator bootflag.ZipkinIDGenerator)
- func SetDefaultTracerNeverSample(b bool)
- func SetDefaultTracerNoop(b bool)
- func SetDefaultTracerNoopSpan(b bool)
- func SetDefaultTracerSharedSpans(b bool)
- func SetDefaultTracerTags(tags map[string]string)
- func SetDefaultZipkinFlagsPrefix(prefix string)
- type BoundarySampler
- type Config
- func (c *Config) BindFlags(fs *bootflag.FlagSet)
- func (c *Config) Parse() (err error)
- func (c Config) StandardReporter() reporter.Reporter
- func (c Config) WithAlwaysSampler() zipkin.TracerOption
- func (c Config) WithBoundarySampler() (zipkin.TracerOption, error)
- func (c Config) WithCountingSampler() (zipkin.TracerOption, error)
- func (c Config) WithExtractFailurePolicy() zipkin.TracerOption
- func (c Config) WithIDGenerator() zipkin.TracerOption
- func (c Config) WithLocalEndpoint() (zipkin.TracerOption, error)
- func (c Config) WithModuloSampler() (zipkin.TracerOption, error)
- func (c Config) WithNeverSampler() zipkin.TracerOption
- func (c Config) WithNoopSpan() zipkin.TracerOption
- func (c Config) WithSharedSpans() zipkin.TracerOption
- type CountingSampler
- type LocalEndpoint
- type ModuloSampler
- type Reporter
- func (r *Reporter) BindFlags(fs *bootflag.FlagSet)
- func (r *Reporter) Parse() (err error)
- func (r Reporter) Standardize() reporter.Reporter
- func (r Reporter) WithBatchInterval() httpreporter.ReporterOption
- func (r Reporter) WithBatchSize() httpreporter.ReporterOption
- func (r Reporter) WithMaxBacklog() httpreporter.ReporterOption
- func (r Reporter) WithTimeout() httpreporter.ReporterOption
- type Sampler
- type Span
- type Tracer
- func (t *Tracer) BindFlags(fs *bootflag.FlagSet)
- func (t *Tracer) Parse() (err error)
- func (t Tracer) WithAlwaysSampler() zipkin.TracerOption
- func (t Tracer) WithBoundarySampler() (zipkin.TracerOption, error)
- func (t Tracer) WithCountingSampler() (zipkin.TracerOption, error)
- func (t Tracer) WithExtractFailurePolicy() zipkin.TracerOption
- func (t Tracer) WithIDGenerator() zipkin.TracerOption
- func (t Tracer) WithLocalEndpoint() (zipkin.TracerOption, error)
- func (t Tracer) WithModuloSampler() (zipkin.TracerOption, error)
- func (t Tracer) WithNeverSampler() zipkin.TracerOption
- func (t Tracer) WithNoopSpan() zipkin.TracerOption
- func (t Tracer) WithSharedSpans() zipkin.TracerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDefaultBoundarySamplerRate ¶
func SetDefaultBoundarySamplerRate(rate float64)
func SetDefaultBoundarySamplerSalt ¶
func SetDefaultBoundarySamplerSalt(salt int64)
func SetDefaultCountingSamplerRate ¶
func SetDefaultCountingSamplerRate(rate float64)
func SetDefaultModuloSamplerMod ¶
func SetDefaultModuloSamplerMod(mod uint64)
func SetDefaultReporterBatchSize ¶
func SetDefaultReporterBatchSize(num int)
func SetDefaultReporterFlagsPrefix ¶
func SetDefaultReporterFlagsPrefix(prefix string)
func SetDefaultReporterMaxBacklog ¶
func SetDefaultReporterMaxBacklog(num int)
func SetDefaultTracerAlwaysSample ¶
func SetDefaultTracerAlwaysSample(b bool)
func SetDefaultTracerExtractFailurePolicy ¶
func SetDefaultTracerExtractFailurePolicy(policy zipkin.ExtractFailurePolicy)
func SetDefaultTracerFlagsPrefix ¶
func SetDefaultTracerFlagsPrefix(prefix string)
func SetDefaultTracerGenerator ¶
func SetDefaultTracerGenerator(generator bootflag.ZipkinIDGenerator)
func SetDefaultTracerNeverSample ¶
func SetDefaultTracerNeverSample(b bool)
func SetDefaultTracerNoop ¶
func SetDefaultTracerNoop(b bool)
func SetDefaultTracerNoopSpan ¶
func SetDefaultTracerNoopSpan(b bool)
func SetDefaultTracerSharedSpans ¶
func SetDefaultTracerSharedSpans(b bool)
func SetDefaultTracerTags ¶
func SetDefaultZipkinFlagsPrefix ¶
func SetDefaultZipkinFlagsPrefix(prefix string)
Types ¶
type BoundarySampler ¶
type BoundarySampler struct { Rate float64 `json:"rate" yaml:"rate"` Salt int64 `json:"salt" yaml:"salt"` }
BoundarySampler is the settings of boundary sampler for creating a standard zipkin boundary sampler
type Config ¶
type Config struct { // Bridge uses Zipkin OpenTracing bridge instead of native implementation Bridge bool `json:"bridge" yaml:"bridge"` // Tracer is the settings for Golang official Zipkin client tracer implementation. Tracer Tracer `json:"tracer" yaml:"tracer"` Reporter Reporter `json:"reporter" yaml:"reporter"` // CustomBindFlagsFunc defines custom bind flags behaviour for structure, if CustomBindFlagsFunc is nil, default bind flags behaviour will be used CustomBindFlagsFunc func(fs *bootflag.FlagSet) `json:"-" yaml:"-"` // CustomParseFunc defines custom parse behaviour for structure, if CustomParseFunc is nil, default parse behaviour will be used CustomParseFunc func() (err error) `json:"-" yaml:"-"` }
func (Config) StandardReporter ¶
func (Config) WithAlwaysSampler ¶
func (c Config) WithAlwaysSampler() zipkin.TracerOption
WithAlwaysSampler is the same as zipkin.WithSampler(zipkin.AlwaysSampler) in official Golang client.
func (Config) WithBoundarySampler ¶
WithBoundarySampler is the same as zipkin.WithSampler(zipkin.NewBoundarySampler(rate, salt)) in official Golang client.
func (Config) WithCountingSampler ¶
WithCountingSampler is the same as zipkin.WithSampler(zipkin.NewModuloSampler(mod)) in official Golang client.
func (Config) WithExtractFailurePolicy ¶
func (c Config) WithExtractFailurePolicy() zipkin.TracerOption
WithExtractFailurePolicy allows one to set the ExtractFailurePolicy.
func (Config) WithIDGenerator ¶
func (c Config) WithIDGenerator() zipkin.TracerOption
WithIDGenerator allows one to set a custom ID Generator
func (Config) WithLocalEndpoint ¶
WithLocalEndpoint sets the local endpoint of the tracer or returns a error if fail to create an Endpoint instance
func (Config) WithModuloSampler ¶
WithModuloSampler is the same as zipkin.WithSampler(zipkin.NewModuloSampler(mod)) in official Golang client.
func (Config) WithNeverSampler ¶
func (c Config) WithNeverSampler() zipkin.TracerOption
WithNeverSampler is the same as zipkin.WithSampler(zipkin.NeverSample) in official Golang client.
func (Config) WithNoopSpan ¶
func (c Config) WithNoopSpan() zipkin.TracerOption
WithNoopSpan if set to true will switch to a NoopSpan implementation if the trace is not sampled.
func (Config) WithSharedSpans ¶
func (c Config) WithSharedSpans() zipkin.TracerOption
WithSharedSpans allows to place client-side and server-side annotations for a RPC call in the same span (Zipkin V1 behavior) or different spans (more in line with other tracing solutions). By default this Tracer uses shared host spans (so client-side and server-side in the same span).
type CountingSampler ¶
type CountingSampler struct {
Rate float64 `json:"rate" yaml:"rate"`
}
CountingSampler is the settings of counting sampler for creating a standard zipkin counting sampler
type LocalEndpoint ¶
type LocalEndpoint struct { // Name is the service name which used to create a local endpoint Name string `json:"name" yaml:"name"` // HostPort is the host port which used to create a local endpoint HostPort string `json:"address" yaml:"address"` }
LocalEndpoint is the settings for creating a standard Zipkin local endpoint
func (LocalEndpoint) Standardize ¶
func (le LocalEndpoint) Standardize() (*model.Endpoint, error)
type ModuloSampler ¶
type ModuloSampler struct {
Mod uint64 `json:"mod" yaml:"mod"`
}
ModuloSampler is the settings of modulo sampler for creating a standard zipkin module sampler
type Reporter ¶
type Reporter struct { // URL enables Zipkin tracing via HTTP reporter URL e.g. http://localhost:9411/api/v2/spans URL string `json:"url" yaml:"url"` // Timeout sets maximum timeout for the http request through its context. Timeout time.Duration `json:"timeout" yaml:"timeout"` // BatchSize sets the maximum batch size, after which a collect will be // triggered. The default batch size is 100 traces. BatchSize int `json:"batch-size" yaml:"batch-size"` // MaxBacklog sets the maximum backlog size. When batch size reaches this // threshold, spans from the beginning of the batch will be disposed. MaxBacklog int `json:"max-backlog" yaml:"max-backlog"` // BatchInterval sets the maximum duration we will buffer traces before // emitting them to the collector. The default batch interval is 1 second. BatchInterval time.Duration `json:"batch-interval" yaml:"batch-interval"` // CustomBindFlagsFunc defines custom bind flags behaviour for structure, if CustomBindFlagsFunc is nil, default bind flags behaviour will be used CustomBindFlagsFunc func(fs *bootflag.FlagSet) `json:"-" yaml:"-"` // CustomParseFunc defines custom parse behaviour for structure, if CustomParseFunc is nil, default parse behaviour will be used CustomParseFunc func() (err error) `json:"-" yaml:"-"` }
Reporter is the settings for official Zipkin Golang client reporter instance.
func (Reporter) Standardize ¶
func (Reporter) WithBatchInterval ¶
func (r Reporter) WithBatchInterval() httpreporter.ReporterOption
BatchInterval sets the maximum duration we will buffer traces before emitting them to the collector. The default batch interval is 1 second.
func (Reporter) WithBatchSize ¶
func (r Reporter) WithBatchSize() httpreporter.ReporterOption
BatchSize sets the maximum batch size, after which a collect will be triggered. The default batch size is 100 traces.
func (Reporter) WithMaxBacklog ¶
func (r Reporter) WithMaxBacklog() httpreporter.ReporterOption
MaxBacklog sets the maximum backlog size. When batch size reaches this threshold, spans from the beginning of the batch will be disposed.
func (Reporter) WithTimeout ¶
func (r Reporter) WithTimeout() httpreporter.ReporterOption
Timeout sets maximum timeout for the http request through its context.
type Sampler ¶
type Sampler struct { // AlwaysSample will always return true. If used by a service it will always start // traces if no upstream trace has been propagated. If an incoming upstream trace // is not sampled the service will adhere to this and only propagate the context. AlwaysSample bool `json:"always" yaml:"always"` // NeverSample will always return false. If used by a service it will not allow // the service to start traces but will still allow the service to participate // in traces started upstream. NeverSample bool `json:"never" yaml:"never"` // BoundarySampler is the settings of boundary sampler for // creating a standard zipkin boundary sampler BoundarySampler BoundarySampler `json:"boundary" yaml:"boundary"` // ModuloSampler is the settings of modulo sampler for creating a standard zipkin // module sampler ModuloSampler ModuloSampler `json:"modulo" yaml:"modulo"` // CountingSampler is the settings of counting sampler for creating a standard zipkin // counting sampler CountingSampler CountingSampler `json:"counting" yaml:"counting"` }
Sampler specifies a sample policy if a Zipkin span should be sampled, based on its traceID.
type Tracer ¶
type Tracer struct { // ExtractFailurePolicy deals with Extraction errors: // // 0 for ExtractFailurePolicyRestart // // 1 for ExtractFailurePolicyError // // 2 for ExtractFailurePolicyTagAndRestart ExtractFailurePolicy zipkin.ExtractFailurePolicy `json:"extract-failure-policy" yaml:"extract-failure-policy"` // LocalEndpoint is the settings for creating a standard Zipkin local endpoint LocalEndpoint LocalEndpoint `json:"endpoint" yaml:"endpoint"` // Generator interface can be used to provide the Zipkin Tracer with custom // implementations to generate Span and Trace IDs. Generator idgenerator.IDGenerator `json:"generator" yaml:"generator"` // Tags allows one to set default tags to be added to each created span Tags map[string]string `json:"tags" yaml:"tags"` // Noop allows one to start the zipkin tracer as noop implementation. Noop bool `json:"noop" yaml:"noop"` // Sampler is the sample policy for a zipkin tracer Sampler Sampler `json:"sampler" yaml:"sampler"` Span Span `json:"span" yaml:"span"` // CustomBindFlagsFunc defines custom bind flags behaviour for structure, if CustomBindFlagsFunc is nil, default bind flags behaviour will be used CustomBindFlagsFunc func(fs *bootflag.FlagSet) `json:"-" yaml:"-"` // CustomParseFunc defines custom parse behaviour for structure, if CustomParseFunc is nil, default parse behaviour will be used CustomParseFunc func() (err error) `json:"-" yaml:"-"` }
Tracer is the settings for Golang official Zipkin client tracer implementation.
func (Tracer) WithAlwaysSampler ¶
func (t Tracer) WithAlwaysSampler() zipkin.TracerOption
WithAlwaysSampler is the same as zipkin.WithSampler(zipkin.AlwaysSampler) in official Golang client.
func (Tracer) WithBoundarySampler ¶
WithBoundarySampler is the same as zipkin.WithSampler(zipkin.NewBoundarySampler(rate, salt)) in official Golang client.
func (Tracer) WithCountingSampler ¶
WithCountingSampler is the same as zipkin.WithSampler(zipkin.NewModuloSampler(mod)) in official Golang client.
func (Tracer) WithExtractFailurePolicy ¶
func (t Tracer) WithExtractFailurePolicy() zipkin.TracerOption
WithExtractFailurePolicy allows one to set the ExtractFailurePolicy.
func (Tracer) WithIDGenerator ¶
func (t Tracer) WithIDGenerator() zipkin.TracerOption
WithIDGenerator allows one to set a custom ID Generator
func (Tracer) WithLocalEndpoint ¶
WithLocalEndpoint sets the local endpoint of the tracer or returns a error if fail to create an Endpoint instance
func (Tracer) WithModuloSampler ¶
WithModuloSampler is the same as zipkin.WithSampler(zipkin.NewModuloSampler(mod)) in official Golang client.
func (Tracer) WithNeverSampler ¶
func (t Tracer) WithNeverSampler() zipkin.TracerOption
WithNeverSampler is the same as zipkin.WithSampler(zipkin.NeverSample) in official Golang client.
func (Tracer) WithNoopSpan ¶
func (t Tracer) WithNoopSpan() zipkin.TracerOption
WithNoopSpan if set to true will switch to a NoopSpan implementation if the trace is not sampled.
func (Tracer) WithSharedSpans ¶
func (t Tracer) WithSharedSpans() zipkin.TracerOption
WithSharedSpans allows to place client-side and server-side annotations for a RPC call in the same span (Zipkin V1 behavior) or different spans (more in line with other tracing solutions). By default this Tracer uses shared host spans (so client-side and server-side in the same span).