Documentation
¶
Index ¶
- Constants
- func New(opts ...Option) *trace.TracerProvider
- type Option
- func WithBatcher(e trace.SpanExporter, opts ...trace.BatchSpanProcessorOption) Option
- func WithIDGenerator(g trace.IDGenerator) Option
- func WithRawSpanLimits(limits trace.SpanLimits) Option
- func WithResource(r *resource.Resource) Option
- func WithSampler(s trace.Sampler) Option
- func WithSpanLimits(sl trace.SpanLimits) Optiondeprecated
- func WithSpanProcessor(sp trace.SpanProcessor) Option
- func WithSyncer(e trace.SpanExporter) Option
Constants ¶
const (
InstrumentationName = "go.microcore.dev/framework/telemetry/trace"
)
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(opts ...Option) *trace.TracerProvider
Types ¶
type Option ¶
type Option func(*[]trace.TracerProviderOption)
func WithBatcher ¶
func WithBatcher(e trace.SpanExporter, opts ...trace.BatchSpanProcessorOption) Option
WithBatcher registers the exporter with the TracerProvider using a BatchSpanProcessor configured with the passed opts.
func WithIDGenerator ¶
func WithIDGenerator(g trace.IDGenerator) Option
WithIDGenerator returns a TracerProviderOption that will configure the IDGenerator g as a TracerProvider's IDGenerator. The configured IDGenerator is used by the Tracers the TracerProvider creates to generate new Span and Trace IDs.
If this option is not used, the TracerProvider will use a random number IDGenerator by default.
func WithRawSpanLimits ¶
func WithRawSpanLimits(limits trace.SpanLimits) Option
WithRawSpanLimits returns a TracerProviderOption that configures a TracerProvider to use these limits. These limits bound any Span created by a Tracer from the TracerProvider.
The limits will be used as-is. Zero or negative values will not be changed to the default value like WithSpanLimits does. Setting a limit to zero will effectively disable the related resource it limits and setting to a negative value will mean that resource is unlimited. Consequentially, this means that the zero-value SpanLimits will disable all span resources. Because of this, limits should be constructed using NewSpanLimits and updated accordingly.
If this or WithSpanLimits are not provided, the TracerProvider will use the limits defined by environment variables, or the defaults if unset. Refer to the NewSpanLimits documentation for information about this relationship.
func WithResource ¶
WithResource returns a TracerProviderOption that will configure the Resource r as a TracerProvider's Resource. The configured Resource is referenced by all the Tracers the TracerProvider creates. It represents the entity producing telemetry.
If this option is not used, the TracerProvider will use the resource.Default() Resource by default.
func WithSampler ¶
WithSampler returns a TracerProviderOption that will configure the Sampler s as a TracerProvider's Sampler. The configured Sampler is used by the Tracers the TracerProvider creates to make their sampling decisions for the Spans they create.
This option overrides the Sampler configured through the OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG environment variables. If this option is not used and the sampler is not configured through environment variables or the environment contains invalid/unsupported configuration, the TracerProvider will use a ParentBased(AlwaysSample) Sampler by default.
func WithSpanLimits
deprecated
func WithSpanLimits(sl trace.SpanLimits) Option
WithSpanLimits returns a TracerProviderOption that configures a TracerProvider to use the SpanLimits sl. These SpanLimits bound any Span created by a Tracer from the TracerProvider.
If any field of sl is zero or negative it will be replaced with the default value for that field.
If this or WithRawSpanLimits are not provided, the TracerProvider will use the limits defined by environment variables, or the defaults if unset. Refer to the NewSpanLimits documentation for information about this relationship.
Deprecated: Use WithRawSpanLimits instead which allows setting unlimited and zero limits. This option will be kept until the next major version incremented release.
func WithSpanProcessor ¶
func WithSpanProcessor(sp trace.SpanProcessor) Option
WithSpanProcessor registers the SpanProcessor with a TracerProvider.
func WithSyncer ¶
func WithSyncer(e trace.SpanExporter) Option
WithSyncer registers the exporter with the TracerProvider using a SimpleSpanProcessor.
This is not recommended for production use. The synchronous nature of the SimpleSpanProcessor that will wrap the exporter make it good for testing, debugging, or showing examples of other feature, but it will be slow and have a high computation resource usage overhead. The WithBatcher option is recommended for production use instead.