appinsights

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2017 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package appinsights provides an interface to submit telemetry to Application Insights. See more at https://azure.microsoft.com/en-us/services/application-insights/

Index

Constants

View Source
const (
	ApplicationVersion         ContextTagKeys = "ai.application.ver"
	ApplicationBuild                          = "ai.application.build"
	CloudRole                                 = "ai.cloud.role"
	CloudRoleInstance                         = "ai.cloud.roleInstance"
	DeviceId                                  = "ai.device.id"
	DeviceIp                                  = "ai.device.ip"
	DeviceLanguage                            = "ai.device.language"
	DeviceLocale                              = "ai.device.locale"
	DeviceModel                               = "ai.device.model"
	DeviceNetwork                             = "ai.device.network"
	DeviceOEMName                             = "ai.device.oemName"
	DeviceOS                                  = "ai.device.os"
	DeviceOSVersion                           = "ai.device.osVersion"
	DeviceRoleInstance                        = "ai.device.roleInstance"
	DeviceRoleName                            = "ai.device.roleName"
	DeviceScreenResolution                    = "ai.device.screenResolution"
	DeviceType                                = "ai.device.type"
	DeviceMachineName                         = "ai.device.machineName"
	LocationIp                                = "ai.location.ip"
	OperationCorrelationVector                = "ai.operation.correlationVector"
	OperationId                               = "ai.operation.id"
	OperationName                             = "ai.operation.name"
	OperationParentId                         = "ai.operation.parentId"
	OperationRootId                           = "ai.operation.rootId"
	OperationSyntheticSource                  = "ai.operation.syntheticSource"
	OperationIsSynthetic                      = "ai.operation.isSynthetic"
	SessionId                                 = "ai.session.id"
	SessionIsFirst                            = "ai.session.isFirst"
	SessionIsNew                              = "ai.session.isNew"
	UserAccountAcquisitionDate                = "ai.user.accountAcquisitionDate"
	UserAccountId                             = "ai.user.accountId"
	UserAgent                                 = "ai.user.userAgent"
	UserAuthUserId                            = "ai.user.authUserId"
	UserId                                    = "ai.user.id"
	UserStoreRegion                           = "ai.user.storeRegion"
	SampleRate                                = "ai.sample.sampleRate"
	InternalSdkVersion                        = "ai.internal.sdkVersion"
	InternalAgentVersion                      = "ai.internal.agentVersion"
)
View Source
const (
	Version = "0.3.1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseTelemetry

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

type CloudContext

type CloudContext interface {
	GetRoleName() string
	SetRoleName(string)
	GetRoleInstance() string
	SetRoleInstance(string)
}

type ComponentContext

type ComponentContext interface {
	GetVersion() string
	SetVersion(string)
}

type ContextTagKeys

type ContextTagKeys string

type DataPoint

type DataPoint struct {
	Name  string        `json:"name"`
	Kind  DataPointType `json:"kind"`
	Value float32       `json:"value"`
	Count int           `json:"count"`
	// contains filtered or unexported fields
}

type DataPointType

type DataPointType int
const (
	Measurement DataPointType = iota
	Aggregation
)

type DeviceContext

type DeviceContext interface {
	GetType() string
	SetType(string)
	GetId() string
	SetId(string)
	GetOperatingSystem() string
	SetOperatingSystem(string)
	GetOemName() string
	SetOemName(string)
	GetModel() string
	SetModel(string)
	GetNetworkType() string
	SetNetworkType(string)
	GetScreenResolution() string
	SetScreenResolution(string)
	GetLanguage() string
	SetLanguage(string)
}

type DiagnosticsMessageListener

type DiagnosticsMessageListener interface {
	ProcessMessages(DiagnosticsMessageProcessor)
}

func NewDiagnosticsMessageListener

func NewDiagnosticsMessageListener() DiagnosticsMessageListener

type DiagnosticsMessageProcessor

type DiagnosticsMessageProcessor func(string)

type DiagnosticsMessageWriter

type DiagnosticsMessageWriter interface {
	Write(string)
	// contains filtered or unexported methods
}

type Domain

type Domain interface {
}

type EventTelemetry

type EventTelemetry struct {
	BaseTelemetry
	// contains filtered or unexported fields
}

func NewEventTelemetry

func NewEventTelemetry(name string) *EventTelemetry

func (*EventTelemetry) Context

func (item *EventTelemetry) Context() TelemetryContext

func (*EventTelemetry) SetProperty

func (item *EventTelemetry) SetProperty(key, value string)

func (*EventTelemetry) Timestamp

func (item *EventTelemetry) Timestamp() time.Time

type InMemoryChannel

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

func NewInMemoryChannel

func NewInMemoryChannel(config *TelemetryConfiguration) *InMemoryChannel

func (*InMemoryChannel) Close

func (channel *InMemoryChannel) Close(timeout ...time.Duration) <-chan struct{}

func (*InMemoryChannel) EndpointAddress

func (channel *InMemoryChannel) EndpointAddress() string

func (*InMemoryChannel) Flush

func (channel *InMemoryChannel) Flush()

func (*InMemoryChannel) IsThrottled

func (channel *InMemoryChannel) IsThrottled() bool

func (*InMemoryChannel) Send

func (channel *InMemoryChannel) Send(item Telemetry)

func (*InMemoryChannel) Stop

func (channel *InMemoryChannel) Stop()

type LocationContext

type LocationContext interface {
	GetIp() string
	SetIp(string)
}

type MetricTelemetry

type MetricTelemetry struct {
	BaseTelemetry
	// contains filtered or unexported fields
}

func NewMetricTelemetry

func NewMetricTelemetry(name string, value float32) *MetricTelemetry

func (*MetricTelemetry) Context

func (item *MetricTelemetry) Context() TelemetryContext

func (*MetricTelemetry) SetProperty

func (item *MetricTelemetry) SetProperty(key, value string)

func (*MetricTelemetry) Timestamp

func (item *MetricTelemetry) Timestamp() time.Time

type OperationContext

type OperationContext interface {
	GetId() string
	SetId(string)
	GetParentId() string
	SetParentId(string)
	GetCorrelationVector() string
	SetCorrelationVector(string)
	GetName() string
	SetName(string)
	GetSyntheticSource() string
	SetSyntheticSource(string)
}

type RequestTelemetry

type RequestTelemetry struct {
	BaseTelemetry
	// contains filtered or unexported fields
}

func NewRequestTelemetry

func NewRequestTelemetry(name, httpMethod, url string, timestamp time.Time, duration time.Duration, responseCode string, success bool) *RequestTelemetry

func (*RequestTelemetry) Context

func (item *RequestTelemetry) Context() TelemetryContext

func (*RequestTelemetry) SetProperty

func (item *RequestTelemetry) SetProperty(key, value string)

func (*RequestTelemetry) Timestamp

func (item *RequestTelemetry) Timestamp() time.Time

type SessionContext

type SessionContext interface {
	GetId() string
	SetId(string)
	GetIsFirst() bool
	SetIsFirst(bool)
}

type SeverityLevel

type SeverityLevel int
const (
	Verbose SeverityLevel = iota
	Information
	Warning
	Error
	Critical
)

type Telemetry

type Telemetry interface {
	Timestamp() time.Time
	Context() TelemetryContext

	SetProperty(string, string)
	// contains filtered or unexported methods
}

type TelemetryBufferItems

type TelemetryBufferItems []Telemetry

type TelemetryChannel

type TelemetryChannel interface {
	// The address of the endpoint to which telemetry is sent
	EndpointAddress() string

	// Queues a single telemetry item
	Send(Telemetry)

	// Forces the current queue to be sent
	Flush()

	// Tears down the submission goroutines, closes internal channels.
	// Any telemetry waiting to be sent is discarded.  Further calls to
	// Send() have undefined behavior.  This is a more abrupt version of
	// Close().
	Stop()

	// Returns true if this channel has been throttled by the data
	// collector.
	IsThrottled() bool

	// Flushes and tears down the submission goroutine and closes
	// internal channels.  Returns a channel that is closed when all
	// pending telemetry items have been submitted and it is safe to
	// shut down without losing telemetry.
	//
	// If retryTimeout is specified and non-zero, then failed
	// submissions will be retried until one succeeds or the timeout
	// expires, whichever occurs first.  A retryTimeout of zero
	// indicates that failed submissions will be retried as usual.  An
	// omitted retryTimeout indicates that submissions should not be
	// retried if they fail.
	//
	// Note that the returned channel may not be closed before
	// retryTimeout even if it is specified.  This is because
	// retryTimeout only applies to the latest telemetry buffer.  This
	// may be typical for applications that submit a large amount of
	// telemetry or are prone to being throttled.  When exiting, you
	// should select on the result channel and your own timer to avoid
	// long delays.
	Close(retryTimeout ...time.Duration) <-chan struct{}
}

Implementations of TelemetryChannel are responsible for queueing and periodically submitting telemetry items.

type TelemetryClient

type TelemetryClient interface {
	Context() TelemetryContext
	InstrumentationKey() string
	Channel() TelemetryChannel
	IsEnabled() bool
	SetIsEnabled(bool)
	Track(Telemetry)
	TrackEvent(string)
	TrackEventTelemetry(*EventTelemetry)
	TrackMetric(string, float32)
	TrackMetricTelemetry(*MetricTelemetry)
	TrackTrace(string)
	TrackTraceTelemetry(*TraceTelemetry)
	TrackRequest(string, string, string, time.Time, time.Duration, string, bool)
	TrackRequestTelemetry(*RequestTelemetry)
}

func NewTelemetryClient

func NewTelemetryClient(iKey string) TelemetryClient

func NewTelemetryClientFromConfig

func NewTelemetryClientFromConfig(config *TelemetryConfiguration) TelemetryClient

type TelemetryConfiguration

type TelemetryConfiguration struct {
	InstrumentationKey string
	EndpointUrl        string
	MaxBatchSize       int
	MaxBatchInterval   time.Duration
}

func NewTelemetryConfiguration

func NewTelemetryConfiguration(instrumentationKey string) *TelemetryConfiguration

type TelemetryContext

type TelemetryContext interface {
	InstrumentationKey() string

	Component() ComponentContext
	Device() DeviceContext
	Cloud() CloudContext
	Session() SessionContext
	User() UserContext
	Operation() OperationContext
	Location() LocationContext
	// contains filtered or unexported methods
}

func NewClientTelemetryContext

func NewClientTelemetryContext() TelemetryContext

func NewItemTelemetryContext

func NewItemTelemetryContext() TelemetryContext

type TraceTelemetry

type TraceTelemetry struct {
	BaseTelemetry
	// contains filtered or unexported fields
}

func NewTraceTelemetry

func NewTraceTelemetry(message string, severityLevel SeverityLevel) *TraceTelemetry

func (*TraceTelemetry) Context

func (item *TraceTelemetry) Context() TelemetryContext

func (*TraceTelemetry) SetProperty

func (item *TraceTelemetry) SetProperty(key, value string)

func (*TraceTelemetry) Timestamp

func (item *TraceTelemetry) Timestamp() time.Time

type UserContext

type UserContext interface {
	GetId() string
	SetId(string)
	GetAccountId() string
	SetAccountId(string)
	GetUserAgent() string
	SetUserAgent(string)
	GetAuthenticatedUserId() string
	SetAuthenticatedUserId(string)
}

Jump to

Keyboard shortcuts

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