telemetry

package
v1.0.42 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: GPL-3.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// OperationIDKeyContextKey is the key used to store the operation ID in context
	OperationIDKeyContextKey OperationIDKey = "operationID"

	// TelemetryContextKey represents the key type for the telemetry object in context
	TelemetryContextKey TelemetryObj = "telemetry"

	// Service name key
	ServiceNameKey = "ServiceName"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OperationIDKey

type OperationIDKey string

OperationIDKey represents the key type for the operation ID in context

type TelemetryObj

type TelemetryObj string

type XField added in v1.0.22

type XField struct {
	Key   string
	Value interface{}
}

func Bool added in v1.0.27

func Bool(key string, val bool) XField

func Int added in v1.0.27

func Int(key string, val int) XField

func String added in v1.0.8

func String(key string, val string) XField

type XTelemetryConfig added in v1.0.22

type XTelemetryConfig interface {
	GetInstrumentationKey() string
	GetServiceName() string
	GetLogLevel() string
	GetCallerSkip() int
	SetInstrumentationKey(string)
	SetServiceName(string)
	SetLogLevel(string)
	SetCallerSkip(int)
}

func NewXTelemetryConfig added in v1.0.23

func NewXTelemetryConfig(instrumentationKey string, serviceName string, logLevel string, callerSkip int) XTelemetryConfig

type XTelemetryObject added in v1.0.25

type XTelemetryObject interface {
	Debug(ctx context.Context, message string, fields ...XField)
	Info(ctx context.Context, message string, fields ...XField)
	Warn(ctx context.Context, message string, fields ...XField)
	Error(ctx context.Context, message string, fields ...XField)
	Dependency(ctx context.Context, dependencyType string, target string, success bool, startTime time.Time, endTime time.Time, message string, fields ...XField)
	Request(ctx context.Context, method string, url string, duration time.Duration, responseCode string, success bool, source string, message string, fields ...XField)
}

type XTelemetryObjectImpl added in v1.0.26

type XTelemetryObjectImpl struct {
	// contains filtered or unexported fields
}

XTelemetryObjectImpl will store the logger, the app insights client and the service name

func GetXTelemetryClient added in v1.0.34

func GetXTelemetryClient(ctx context.Context) *XTelemetryObjectImpl

Helper function to retrieve the telemetry client from the context

func NewXTelemetry added in v1.0.22

func NewXTelemetry(cc XTelemetryConfig) (*XTelemetryObjectImpl, error)

Initialize the telemetry object

func (*XTelemetryObjectImpl) Debug added in v1.0.26

func (t *XTelemetryObjectImpl) Debug(ctx context.Context, message string, fields ...XField)

Debug will log the message using xTelemetry (no trace to App Insights)

func (*XTelemetryObjectImpl) Dependency added in v1.0.37

func (t *XTelemetryObjectImpl) Dependency(ctx context.Context, dependencyType string, target string, success bool, startTime time.Time, endTime time.Time, message string, fields ...XField)

Dependency will log the dependency using xTelemetry and also send a dependency to App Insights

func (*XTelemetryObjectImpl) Error added in v1.0.26

func (t *XTelemetryObjectImpl) Error(ctx context.Context, message string, fields ...XField)

Error will log the message using xTelemetry and also send an exception to App Insights

func (*XTelemetryObjectImpl) Info added in v1.0.26

func (t *XTelemetryObjectImpl) Info(ctx context.Context, message string, fields ...XField)

Info will log the message using xTelemetry and also send a trace to App Insights

func (*XTelemetryObjectImpl) Request added in v1.0.37

func (t *XTelemetryObjectImpl) Request(ctx context.Context, method string, url string, duration time.Duration, responseCode string, success bool, source string, message string, fields ...XField)

Request will log the request using xTelemetry and also send a request to App Insights

func (*XTelemetryObjectImpl) Warn added in v1.0.26

func (t *XTelemetryObjectImpl) Warn(ctx context.Context, message string, fields ...XField)

Warn will log the message using xTelemetry and also send a trace to App Insights TODO

Jump to

Keyboard shortcuts

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