Documentation ¶
Index ¶
- Constants
- func GetEnvironmentProperties() map[string]string
- func GetK8SApiserverURLFromKubeConfig() (string, error)
- func InitAppInsights(appinsightsId, appVersion string)
- func KernelVersion(ctx context.Context) (string, error)
- func ShutdownAppInsights()
- func TrackPanic()
- type NoopTelemetry
- func (m NoopTelemetry) Heartbeat(ctx context.Context, heartbeatInterval time.Duration)
- func (m NoopTelemetry) StartPerf(functionName string) *PerformanceCounter
- func (m NoopTelemetry) StopPerf(counter *PerformanceCounter)
- func (m NoopTelemetry) TrackEvent(name string, properties map[string]string)
- func (m NoopTelemetry) TrackMetric(name string, value float64, properties map[string]string)
- func (m NoopTelemetry) TrackTrace(name string, severity contracts.SeverityLevel, properties map[string]string)
- type PerformanceCounter
- type Telemetry
- type TelemetryClient
- func (t *TelemetryClient) Heartbeat(ctx context.Context, heartbeatInterval time.Duration)
- func (t *TelemetryClient) StartPerf(functionName string) *PerformanceCounter
- func (t *TelemetryClient) StopPerf(counter *PerformanceCounter)
- func (t *TelemetryClient) TrackEvent(name string, properties map[string]string)
- func (t *TelemetryClient) TrackException(exception *appinsights.ExceptionTelemetry)
- func (t *TelemetryClient) TrackMetric(metricname string, value float64, properties map[string]string)
- func (t *TelemetryClient) TrackTrace(name string, severity contracts.SeverityLevel, properties map[string]string)
Constants ¶
const (
EnvPodName = "POD_NAME"
)
const ( // PropertyApiVersion is the property name of the telemetry item that contains the APIServer endpoint. // apiserver is used to distinguish the telemetry items from different Kubernetes clusters and should be uniformed // across all the telemetry items from the same cluster with the format http(s)://<host>:<port>. // For example "https://retina-test-c4528d-zn0ugsna.hcp.southeastasia.azmk8s.io:443 PropertyApiserver = "apiserver" )
Variables ¶
This section is empty.
Functions ¶
func GetK8SApiserverURLFromKubeConfig ¶
GetK8SApiserverURLFromKubeConfig returns apiserver URL from kubeconfig. The apiserver URL is expected to be publicly unique identifier of the Kubernetes cluster. In case the kubeconfig does not exists, this identifier can be obtained for pods from kube-system namespace. Kubelet will populate env KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT for Pods deployed in kube-system namespace, which can be used to generate apiserver URL from `GetConfig()`.
func InitAppInsights ¶
func InitAppInsights(appinsightsId, appVersion string)
func ShutdownAppInsights ¶
func ShutdownAppInsights()
func TrackPanic ¶
func TrackPanic()
TrackPanic function sends the stacktrace and flushes logs only in a goroutine where its call is deferred. Panics in other goroutines will not be caught by this recover function.
Types ¶
type NoopTelemetry ¶
type NoopTelemetry struct{}
func NewNoopTelemetry ¶
func NewNoopTelemetry() *NoopTelemetry
func (NoopTelemetry) Heartbeat ¶
func (m NoopTelemetry) Heartbeat(ctx context.Context, heartbeatInterval time.Duration)
func (NoopTelemetry) StartPerf ¶
func (m NoopTelemetry) StartPerf(functionName string) *PerformanceCounter
func (NoopTelemetry) StopPerf ¶
func (m NoopTelemetry) StopPerf(counter *PerformanceCounter)
func (NoopTelemetry) TrackEvent ¶
func (m NoopTelemetry) TrackEvent(name string, properties map[string]string)
func (NoopTelemetry) TrackMetric ¶
func (m NoopTelemetry) TrackMetric(name string, value float64, properties map[string]string)
func (NoopTelemetry) TrackTrace ¶
func (m NoopTelemetry) TrackTrace(name string, severity contracts.SeverityLevel, properties map[string]string)
type PerformanceCounter ¶
type PerformanceCounter struct {
// contains filtered or unexported fields
}
type Telemetry ¶
type Telemetry interface { StartPerf(name string) *PerformanceCounter StopPerf(counter *PerformanceCounter) Heartbeat(ctx context.Context, heartbeatInterval time.Duration) TrackEvent(name string, properties map[string]string) TrackMetric(name string, value float64, properties map[string]string) TrackTrace(name string, severity contracts.SeverityLevel, properties map[string]string) }
type TelemetryClient ¶
func NewAppInsightsTelemetryClient ¶
func NewAppInsightsTelemetryClient(processName string, additionalproperties map[string]string) *TelemetryClient
func (*TelemetryClient) Heartbeat ¶
func (t *TelemetryClient) Heartbeat(ctx context.Context, heartbeatInterval time.Duration)
func (*TelemetryClient) StartPerf ¶
func (t *TelemetryClient) StartPerf(functionName string) *PerformanceCounter
Used with start to measure the execution time of a function usage defer telemetry.StopPerf(telemetry.StartPerf("functionName")) start perf will be evaluated on defer line, and then stop perf will be evaluated on return
func (*TelemetryClient) StopPerf ¶
func (t *TelemetryClient) StopPerf(counter *PerformanceCounter)
func (*TelemetryClient) TrackEvent ¶
func (t *TelemetryClient) TrackEvent(name string, properties map[string]string)
func (*TelemetryClient) TrackException ¶
func (t *TelemetryClient) TrackException(exception *appinsights.ExceptionTelemetry)
func (*TelemetryClient) TrackMetric ¶
func (t *TelemetryClient) TrackMetric(metricname string, value float64, properties map[string]string)
func (*TelemetryClient) TrackTrace ¶
func (t *TelemetryClient) TrackTrace(name string, severity contracts.SeverityLevel, properties map[string]string)