Documentation ¶
Overview ¶
Package telemetry provides functionality for emitting telemetry in azd.
Index ¶
- func FirstNotice() string
- func IsTelemetryEnabled() bool
- func SetupFirstRun() error
- type Exporter
- type Queue
- type StorageQueue
- func (stg *StorageQueue) Cleanup(ctx context.Context, done chan (struct{}))
- func (stg *StorageQueue) Enqueue(message []byte) error
- func (stg *StorageQueue) EnqueueWithDelay(message []byte, delayDuration time.Duration, retryCount int) error
- func (stg *StorageQueue) Peek() (*StoredItem, error)
- func (stg *StorageQueue) Remove(item *StoredItem) error
- type StoredItem
- type TelemetrySystem
- func (ts *TelemetrySystem) EmittedAnyTelemetry() bool
- func (ts *TelemetrySystem) GetTelemetryQueue() Queue
- func (ts *TelemetrySystem) NewUploader(enableDebugLogging bool) Uploader
- func (ts *TelemetrySystem) RunBackgroundUpload(ctx context.Context, enableDebugLogging bool) error
- func (ts *TelemetrySystem) Shutdown(ctx context.Context) error
- type TelemetryUploader
- type Uploader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FirstNotice ¶
func FirstNotice() string
func IsTelemetryEnabled ¶
func IsTelemetryEnabled() bool
func SetupFirstRun ¶
func SetupFirstRun() error
Types ¶
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter is an implementation of trace.SpanExporter that writes spans into a storage queue in ApplicationInsights format.
func NewExporter ¶
func (*Exporter) ExportSpans ¶
ExportSpans writes spans to the storage queue in AppInsights format.
func (*Exporter) ExportedAny ¶
func (*Exporter) MarshalLog ¶
func (e *Exporter) MarshalLog() interface{}
MarshalLog is the marshaling function used by the logging system to represent this exporter.
type StorageQueue ¶
type StorageQueue struct {
// contains filtered or unexported fields
}
StorageQueue is a FIFO-based queue backed by disk storage, with items stored as individual files. The current implementation allows for multiple producers, single consumer.
Items can be queued by Enqueue or EnqueueWithDelay. QueueWithDelay allows for producers to queue items that should not be picked up by consumers until after the specified duration has passed. This is useful for retry delay scheduling.
Items can be read by Peek, which will read the next available item. Once the item is processed, consumers are responsible for calling Remove to remove the item from the queue.
func NewStorageQueue ¶
func NewStorageQueue( folder string, itemFileExtension string, itemFileMaxTimeKept time.Duration) (*StorageQueue, error)
Creates the storage-based queue.
func (*StorageQueue) Cleanup ¶
func (stg *StorageQueue) Cleanup(ctx context.Context, done chan (struct{}))
Scans the storage directory for any obsoleted items or temp files.
func (*StorageQueue) Enqueue ¶
func (stg *StorageQueue) Enqueue(message []byte) error
Queues a message.
func (*StorageQueue) EnqueueWithDelay ¶
func (stg *StorageQueue) EnqueueWithDelay(message []byte, delayDuration time.Duration, retryCount int) error
Queues a message with delay.
func (*StorageQueue) Peek ¶
func (stg *StorageQueue) Peek() (*StoredItem, error)
Gets the next available item for processing. Returns nil if no items exist. Returns error if an error occurs while reading storage.
func (*StorageQueue) Remove ¶
func (stg *StorageQueue) Remove(item *StoredItem) error
Removes the stored item from queue. Does not return an error if the item is already removed.
type StoredItem ¶
type StoredItem struct {
// contains filtered or unexported fields
}
func (*StoredItem) Message ¶
func (itm *StoredItem) Message() []byte
func (*StoredItem) RetryCount ¶
func (itm *StoredItem) RetryCount() int
type TelemetrySystem ¶
type TelemetrySystem struct {
// contains filtered or unexported fields
}
func GetTelemetrySystem ¶
func GetTelemetrySystem() *TelemetrySystem
Returns the singleton TelemetrySystem instance. Returns nil if telemetry failed to initialize, or user has disabled telemetry.
func (*TelemetrySystem) EmittedAnyTelemetry ¶
func (ts *TelemetrySystem) EmittedAnyTelemetry() bool
Returns true if any telemetry was emitted.
func (*TelemetrySystem) GetTelemetryQueue ¶
func (ts *TelemetrySystem) GetTelemetryQueue() Queue
Returns the telemetry queue instance.
func (*TelemetrySystem) NewUploader ¶
func (ts *TelemetrySystem) NewUploader(enableDebugLogging bool) Uploader
func (*TelemetrySystem) RunBackgroundUpload ¶
func (ts *TelemetrySystem) RunBackgroundUpload(ctx context.Context, enableDebugLogging bool) error
type TelemetryUploader ¶
type TelemetryUploader struct {
// contains filtered or unexported fields
}
func NewUploader ¶
func NewUploader( telemetryQueue Queue, transmitter appinsightsexporter.Transmitter, clock clock.Clock, isDebugMode bool, ) *TelemetryUploader
func (*TelemetryUploader) Upload ¶
func (u *TelemetryUploader) Upload(ctx context.Context, result chan (error))
Uploads all items that are currently in the telemetry queue. This function returns when no items remain in the queue. An error is only returned if there is a fatal, persistent error with reading the queue.