telemetry

package
v0.116.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRecord

func NewRecord() *xray.TelemetryRecord

NewRecord creates a new xray.TelemetryRecord with all of its fields initialized and set to 0.

Types

type Config

type Config struct {
	// Enabled determines whether any telemetry should be recorded.
	Enabled bool `mapstructure:"enabled"`
	// IncludeMetadata determines whether metadata (instance ID, hostname, resourceARN)
	// should be included in the telemetry.
	IncludeMetadata bool `mapstructure:"include_metadata"`
	// Contributors can be used to explicitly define which X-Ray components are contributing to the telemetry.
	// If omitted, only X-Ray components with the same component.ID as the setup component will have access.
	Contributors []component.ID `mapstructure:"contributors,omitempty"`
	// Hostname can be used to explicitly define the hostname associated with the telemetry.
	Hostname string `mapstructure:"hostname,omitempty"`
	// InstanceID can be used to explicitly define the instance ID associated with the telemetry.
	InstanceID string `mapstructure:"instance_id,omitempty"`
	// ResourceARN can be used to explicitly define the resource ARN associated with the telemetry.
	ResourceARN string `mapstructure:"resource_arn,omitempty"`
}

type Option

type Option interface {
	// contains filtered or unexported methods
}

func ToOptions

func ToOptions(cfg Config, sess *session.Session, settings *awsutil.AWSSessionSettings) []Option

ToOptions returns the metadata options if enabled by the config.

func WithBatchSize

func WithBatchSize(batchSize int) Option

func WithHostname

func WithHostname(hostname string) Option

func WithInstanceID

func WithInstanceID(instanceID string) Option

func WithInterval

func WithInterval(interval time.Duration) Option

func WithLogger

func WithLogger(logger *zap.Logger) Option

func WithQueueSize

func WithQueueSize(queueSize int) Option

func WithResourceARN

func WithResourceARN(resourceARN string) Option

type Recorder

type Recorder interface {
	// Rotate the current record by swapping it out with a new one. Returns
	// the rotated record.
	Rotate() *xray.TelemetryRecord
	// HasRecording indicates whether any of the record functions were called
	// with the current record.
	HasRecording() bool
	// RecordSegmentsReceived adds the count to the current record.
	RecordSegmentsReceived(count int)
	// RecordSegmentsSent adds the count to the current record.
	RecordSegmentsSent(count int)
	// RecordSegmentsSpillover adds the count to the current record.
	RecordSegmentsSpillover(count int)
	// RecordSegmentsRejected adds the count to the current record.
	RecordSegmentsRejected(count int)
	// RecordConnectionError categorizes the error and increments the count by one
	// for the current record.
	RecordConnectionError(err error)
}

func NewRecorder

func NewRecorder() Recorder

NewRecorder creates a new Recorder with a default interval and queue size.

type Registry

type Registry interface {
	// Load the Sender for the ID.
	Load(id component.ID) Sender
	// LoadOrNop gets the Sender for the ID. If it doesn't exist, returns
	// the NopSender.
	LoadOrNop(id component.ID) Sender
	// LoadOrStore the Sender for the ID.
	LoadOrStore(id component.ID, sender Sender) (Sender, bool)
	// Register configures and registers a new Sender for the ID. If one
	// already exists for the ID, then returns that one instead.
	Register(id component.ID, cfg Config, client awsxray.XRayClient, opts ...Option) Sender
}

func GlobalRegistry

func GlobalRegistry() Registry

GlobalRegistry returns the global Registry.

func NewRegistry

func NewRegistry() Registry

NewRegistry returns a new empty Registry.

type Sender

type Sender interface {
	Recorder
	// Start send loop.
	Start()
	// Stop send loop.
	Stop()
}

Sender wraps a Recorder and periodically sends the records.

func NewNopSender

func NewNopSender() Sender

NewNopSender returns a Sender that drops all data.

func NewSender

func NewSender(client awsxray.XRayClient, opts ...Option) Sender

NewSender creates a new Sender with a default interval and queue size.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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