batchspanprocessor

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

README

Modified Batch Span Processor

Since the original BatchSpanProcessor does not send metrics for spans received and spans dropped, the modified BatchSpanProcessor creates and populates those metrics so the user can track whether there are spans being dropped.

We have kept track of the original files modified so it's easier to figure out the changes we added. When upgrading, copy the newer files into their go.original counterparts and then do a diff with the modified.go files to figure out what changes to make in order to upgrade the modified files.

The paths of the files modified:

Since we cannot use the internal logger, we have adapted it at logger.go.

Documentation

Index

Constants

View Source
const (
	DefaultMaxQueueSize       = 2048
	DefaultScheduleDelay      = 5000
	DefaultExportTimeout      = 30000
	DefaultMaxExportBatchSize = 512
)

Defaults for BatchSpanProcessorOptions.

View Source
const (
	// BatchSpanProcessorScheduleDelayKey is the delay interval between two
	// consecutive exports (i.e. 5000).
	BatchSpanProcessorScheduleDelayKey = "OTEL_BSP_SCHEDULE_DELAY"
	// BatchSpanProcessorExportTimeoutKey is the maximum allowed time to
	// export data (i.e. 3000).
	BatchSpanProcessorExportTimeoutKey = "OTEL_BSP_EXPORT_TIMEOUT"
	// BatchSpanProcessorMaxQueueSizeKey is the maximum queue size (i.e. 2048).
	BatchSpanProcessorMaxQueueSizeKey = "OTEL_BSP_MAX_QUEUE_SIZE"
	// BatchSpanProcessorMaxExportBatchSizeKey is the maximum batch size (i.e.
	// 512). Note: it must be less than or equal to
	// EnvBatchSpanProcessorMaxQueueSize.
	BatchSpanProcessorMaxExportBatchSizeKey = "OTEL_BSP_MAX_EXPORT_BATCH_SIZE"

	// AttributeValueLengthKey is the maximum allowed attribute value size.
	AttributeValueLengthKey = "OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT"

	// AttributeCountKey is the maximum allowed span attribute count.
	AttributeCountKey = "OTEL_ATTRIBUTE_COUNT_LIMIT"

	// SpanAttributeValueLengthKey is the maximum allowed attribute value size
	// for a span.
	SpanAttributeValueLengthKey = "OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT"

	// SpanAttributeCountKey is the maximum allowed span attribute count for a
	// span.
	SpanAttributeCountKey = "OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT"

	// SpanEventCountKey is the maximum allowed span event count.
	SpanEventCountKey = "OTEL_SPAN_EVENT_COUNT_LIMIT"

	// SpanEventAttributeCountKey is the maximum allowed attribute per span
	// event count.
	SpanEventAttributeCountKey = "OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT"

	// SpanLinkCountKey is the maximum allowed span link count.
	SpanLinkCountKey = "OTEL_SPAN_LINK_COUNT_LIMIT"

	// SpanLinkAttributeCountKey is the maximum allowed attribute per span
	// link count.
	SpanLinkAttributeCountKey = "OTEL_LINK_ATTRIBUTE_COUNT_LIMIT"
)

Environment variable names.

Variables

This section is empty.

Functions

func BatchSpanProcessorExportTimeout

func BatchSpanProcessorExportTimeout(defaultValue int) int

BatchSpanProcessorExportTimeout returns the environment variable value for the OTEL_BSP_EXPORT_TIMEOUT key if it exists, otherwise defaultValue is returned.

func BatchSpanProcessorMaxExportBatchSize

func BatchSpanProcessorMaxExportBatchSize(defaultValue int) int

BatchSpanProcessorMaxExportBatchSize returns the environment variable value for the OTEL_BSP_MAX_EXPORT_BATCH_SIZE key if it exists, otherwise defaultValue is returned.

func BatchSpanProcessorMaxQueueSize

func BatchSpanProcessorMaxQueueSize(defaultValue int) int

BatchSpanProcessorMaxQueueSize returns the environment variable value for the OTEL_BSP_MAX_QUEUE_SIZE key if it exists, otherwise defaultValue is returned.

func BatchSpanProcessorScheduleDelay

func BatchSpanProcessorScheduleDelay(defaultValue int) int

BatchSpanProcessorScheduleDelay returns the environment variable value for the OTEL_BSP_SCHEDULE_DELAY key if it exists, otherwise defaultValue is returned.

func CreateBatchSpanProcessor

func CreateBatchSpanProcessor(useModified bool, exporter sdktrace.SpanExporter,
	options ...sdktrace.BatchSpanProcessorOption) sdktrace.SpanProcessor

func Debug

func Debug(msg string, keysAndValues ...interface{})

Debug prints messages about all internal changes in the API or SDK.

func Error

func Error(err error, msg string, keysAndValues ...interface{})

Error prints messages about exceptional states of the API or SDK.

func Info

func Info(msg string, keysAndValues ...interface{})

Info prints messages about the general state of the API or SDK. This should usually be less then 5 messages a minute.

func IntEnvOr

func IntEnvOr(key string, defaultValue int) int

IntEnvOr returns the int value of the environment variable with name key if it exists, it is not empty, and the value is an int. Otherwise, defaultValue is returned.

func NewBatchSpanProcessor

func NewBatchSpanProcessor(exporter sdktrace.SpanExporter, options ...sdktrace.BatchSpanProcessorOption) sdktrace.SpanProcessor

NewBatchSpanProcessor creates a new SpanProcessor that will send completed span batches to the exporter with the supplied options.

If the exporter is nil, the span processor will perform no action.

func SpanAttributeCount

func SpanAttributeCount(defaultValue int) int

SpanAttributeCount returns the environment variable value for the OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT key if it exists. Otherwise, the environment variable value for OTEL_ATTRIBUTE_COUNT_LIMIT is returned or defaultValue if that is not set.

func SpanAttributeValueLength

func SpanAttributeValueLength(defaultValue int) int

SpanAttributeValueLength returns the environment variable value for the OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT key if it exists. Otherwise, the environment variable value for OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT is returned or defaultValue if that is not set.

func SpanEventAttributeCount

func SpanEventAttributeCount(defaultValue int) int

SpanEventAttributeCount returns the environment variable value for the OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT key if it exists, otherwise defaultValue is returned.

func SpanEventCount

func SpanEventCount(defaultValue int) int

SpanEventCount returns the environment variable value for the OTEL_SPAN_EVENT_COUNT_LIMIT key if it exists, otherwise defaultValue is returned.

func SpanLinkAttributeCount

func SpanLinkAttributeCount(defaultValue int) int

SpanLinkAttributeCount returns the environment variable value for the OTEL_LINK_ATTRIBUTE_COUNT_LIMIT key if it exists, otherwise defaultValue is returned.

func SpanLinkCount

func SpanLinkCount(defaultValue int) int

SpanLinkCount returns the environment variable value for the OTEL_SPAN_LINK_COUNT_LIMIT key if it exists, otherwise defaultValue is returned.

func Warn added in v0.15.0

func Warn(msg string, keysAndValues ...interface{})

Warn prints messages about warnings in the API or SDK. Not an error but is likely more important than an informational event.

func WithBatchTimeout

func WithBatchTimeout(delay time.Duration) sdktrace.BatchSpanProcessorOption

WithBatchTimeout returns a BatchSpanProcessorOption that configures the maximum delay allowed for a BatchSpanProcessor before it will export any held span (whether the queue is full or not).

func WithBlocking

func WithBlocking() sdktrace.BatchSpanProcessorOption

WithBlocking returns a BatchSpanProcessorOption that configures a BatchSpanProcessor to wait for enqueue operations to succeed instead of dropping data when the queue is full.

func WithExportTimeout

func WithExportTimeout(timeout time.Duration) sdktrace.BatchSpanProcessorOption

WithExportTimeout returns a BatchSpanProcessorOption that configures the amount of time a BatchSpanProcessor waits for an exporter to export before abandoning the export.

func WithMaxExportBatchSize

func WithMaxExportBatchSize(size int) sdktrace.BatchSpanProcessorOption

WithMaxExportBatchSize returns a BatchSpanProcessorOption that configures the maximum export batch size allowed for a BatchSpanProcessor.

func WithMaxQueueSize

func WithMaxQueueSize(size int) sdktrace.BatchSpanProcessorOption

WithMaxQueueSize returns a BatchSpanProcessorOption that configures the maximum queue size allowed for a BatchSpanProcessor.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL