aitelemetry

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2025 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MetadataFile = filepath.Join(os.TempDir(), "azuremetadata.json")

Functions

This section is empty.

Types

type AIConfig

type AIConfig struct {
	AppName                      string
	AppVersion                   string
	BatchSize                    int
	BatchInterval                int
	DisableMetadataRefreshThread bool
	RefreshTimeout               int
	GetEnvRetryCount             int
	GetEnvRetryWaitTimeInSecs    int
	DebugMode                    bool
}

type Event

type Event struct {
	EventName  string
	ResourceID string
	Properties map[string]string
}

Application event structure

type Level added in v1.6.20

type Level = contracts.SeverityLevel
const (
	DebugLevel Level = contracts.Verbose
	InfoLevel  Level = contracts.Information
	WarnLevel  Level = contracts.Warning
	ErrorLevel Level = contracts.Error
	PanicLevel Level = contracts.Critical
	FatalLevel Level = contracts.Critical
)

type Metric

type Metric struct {
	Name             string
	Value            float64
	AppVersion       string
	CustomDimensions map[string]string
}

Application metrics structure

type Report

type Report struct {
	Message          string
	Level            contracts.SeverityLevel
	Context          string
	AppVersion       string
	CustomDimensions map[string]string
}

Application trace/log structure

type TelemetryHandle

type TelemetryHandle interface {
	// TrackLog function sends report (trace) to appinsights resource. It overrides few of the existing columns with app information
	// and for rest it uses custom dimesion
	TrackLog(report Report)
	// TrackMetric function sends metric to appinsights resource. It overrides few of the existing columns with app information
	// and for rest it uses custom dimesion
	TrackMetric(metric Metric)
	// TrackEvent function sends events to appinsights resource. It overrides a few of the existing columns
	// with app information.
	TrackEvent(aiEvent Event)
	// Close - should be called for each NewAITelemetry call. Will release resources acquired
	Close(timeout int)
	// Flush - forces the current queue to be sent
	Flush()
}

Telemetry Interface to send metrics/Logs to appinsights

func NewAITelemetry

func NewAITelemetry(
	azEnvUrl string,
	id string,
	aiConfig AIConfig,
) (TelemetryHandle, error)

NewAITelemetry creates telemetry handle with user specified appinsights id.

func NewWithConnectionString added in v1.7.1

func NewWithConnectionString(connectionString string, aiConfig AIConfig) (TelemetryHandle, error)

NewWithConnectionString creates telemetry handle with user specified appinsights connection string.

Jump to

Keyboard shortcuts

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