Documentation ¶
Overview ¶
Copyright Microsoft. All rights reserved.
Index ¶
- Constants
- func CloseAITelemetryHandle()
- func CreateAITelemetryHandle(aiConfig aitelemetry.AIConfig, disableAll, disableMetric, disableTrace bool) error
- func LogAndSendEvent(tb *TelemetryBuffer, msg string)
- func SendAIMetric(aiMetric AIMetric)
- func SendAITelemetry(cnireport CNIReport)
- func SendCNIEvent(tb *TelemetryBuffer, msg string)
- func SendCNIMetric(cniMetric *AIMetric, tb *TelemetryBuffer) error
- func SockExists() bool
- func StartTelemetryService(path string, args []string) error
- func WaitForTelemetrySocket(maxAttempt int, waitTimeInMillisecs time.Duration)
- type AIMetric
- type BridgeInfo
- type Buffer
- type CNIReport
- type DiskInfo
- type InterfaceInfo
- type MemInfo
- type OSInfo
- type ReportManager
- type SystemInfo
- type TelemetryBuffer
- func (tb *TelemetryBuffer) Cancel()
- func (tb *TelemetryBuffer) Cleanup(name string) error
- func (tb *TelemetryBuffer) Close()
- func (tb *TelemetryBuffer) Connect() error
- func (tb *TelemetryBuffer) ConnectToTelemetryService(telemetryNumRetries, telemetryWaitTimeInMilliseconds int)
- func (tb *TelemetryBuffer) Dial(name string) (err error)
- func (tb *TelemetryBuffer) Listen(name string) (err error)
- func (tb *TelemetryBuffer) PushData()
- func (tb *TelemetryBuffer) StartServer() error
- func (tb *TelemetryBuffer) Write(b []byte) (c int, err error)
- type TelemetryConfig
Constants ¶
const ( // Metric Names CNIAddTimeMetricStr = "CNIAddTimeMs" CNIDelTimeMetricStr = "CNIDelTimeMs" CNIUpdateTimeMetricStr = "CNIUpdateTimeMs" CNILockTimeoutStr = "CNILockTimeoutError" // Dimension Names ContextStr = "Context" SubContextStr = "SubContext" VMUptimeStr = "VMUptime" OperationTypeStr = "OperationType" VersionStr = "Version" StatusStr = "Status" CNIModeStr = "CNIMode" CNINetworkModeStr = "CNINetworkMode" OSTypeStr = "OSType" // Values SucceededStr = "Succeeded" FailedStr = "Failed" SingleTenancyStr = "SingleTenancy" MultiTenancyStr = "MultiTenancy" )
const ( // CNITelemetryFile Path. CNITelemetryFile = platform.CNIRuntimePath + "AzureCNITelemetry.json" // ContentType of JSON ContentType = "application/json" )
const ( MB = 1048576 KB = 1024 )
const ( FdName = "azure-vnet-telemetry" Delimiter = '\n' MaxPayloadSize = 4096 MaxNumReports = 1000 )
FdName - file descriptor name Delimiter - delimiter for socket reads/writes MaxPayloadSize - max buffer size in bytes
const ( TelemetryServiceProcessName = "azure-vnet-telemetry" CniInstallDir = "/opt/cni/bin" )
Variables ¶
This section is empty.
Functions ¶
func CloseAITelemetryHandle ¶
func CloseAITelemetryHandle()
func CreateAITelemetryHandle ¶ added in v1.0.32
func CreateAITelemetryHandle(aiConfig aitelemetry.AIConfig, disableAll, disableMetric, disableTrace bool) error
func LogAndSendEvent ¶ added in v1.4.17
func LogAndSendEvent(tb *TelemetryBuffer, msg string)
This function for sending CNI metrics to telemetry service
func SendAIMetric ¶
func SendAIMetric(aiMetric AIMetric)
func SendAITelemetry ¶
func SendAITelemetry(cnireport CNIReport)
func SendCNIEvent ¶
func SendCNIEvent(tb *TelemetryBuffer, msg string)
func SendCNIMetric ¶
func SendCNIMetric(cniMetric *AIMetric, tb *TelemetryBuffer) error
This function for sending CNI metrics to telemetry service
func SockExists ¶
func SockExists() bool
func StartTelemetryService ¶ added in v1.0.18
StartTelemetryService - Kills if any telemetry service runs and start new telemetry service
func WaitForTelemetrySocket ¶
WaitForTelemetrySocket - Block still pipe/sock created or until max attempts retried
Types ¶
type AIMetric ¶
type AIMetric struct {
Metric aitelemetry.Metric
}
type BridgeInfo ¶
CNI Bridge Details structure.
type Buffer ¶
type Buffer struct {
CNIReports []CNIReport
}
Buffer object holds the different types of reports
type CNIReport ¶
type CNIReport struct { IsNewInstance bool CniSucceeded bool Name string Version string ErrorMessage string EventMessage string OperationType string OperationDuration int Context string SubContext string VMUptime string Timestamp string ContainerName string InfraVnetID string VnetAddressSpace []string OSDetails OSInfo SystemDetails SystemInfo InterfaceDetails InterfaceInfo BridgeDetails BridgeInfo Metadata common.Metadata `json:"compute"` }
Azure CNI Telemetry Report structure.
func (*CNIReport) GetOSDetails ¶
func (report *CNIReport) GetOSDetails()
This function creates a report with os details(ostype, version).
func (*CNIReport) GetReport ¶
GetReport retrieves orchestrator, system, OS and Interface details and create a report structure.
func (*CNIReport) GetSystemDetails ¶
func (report *CNIReport) GetSystemDetails()
This function creates a report with system details(memory, disk, cpu).
type InterfaceInfo ¶
type InterfaceInfo struct { InterfaceType string Subnet string PrimaryCA string MAC string Name string SecondaryCATotalCount int SecondaryCAUsedCount int ErrorMessage string }
Interface Details structure.
type OSInfo ¶
type OSInfo struct { OSType string OSVersion string KernelVersion string OSDistribution string ErrorMessage string }
OS Details structure.
type ReportManager ¶
ReportManager structure.
func (*ReportManager) ReportToBytes ¶
func (reportMgr *ReportManager) ReportToBytes() ([]byte, error)
ReportToBytes - returns the report bytes
func (*ReportManager) SendReport ¶
func (reportMgr *ReportManager) SendReport(tb *TelemetryBuffer) error
SendReport will send telemetry report to HostNetAgent.
type SystemInfo ¶
type SystemInfo struct { MemVMTotal uint64 MemVMFree uint64 MemUsedByProcess uint64 DiskVMTotal uint64 DiskVMFree uint64 CPUCount int ErrorMessage string }
System Details structure.
type TelemetryBuffer ¶
type TelemetryBuffer struct { FdExists bool Connected bool // contains filtered or unexported fields }
TelemetryBuffer object
func NewTelemetryBuffer ¶
func NewTelemetryBuffer() *TelemetryBuffer
NewTelemetryBuffer - create a new TelemetryBuffer
func (*TelemetryBuffer) Cancel ¶
func (tb *TelemetryBuffer) Cancel()
Cancel - signal to tear down telemetry buffer
func (*TelemetryBuffer) Cleanup ¶
func (tb *TelemetryBuffer) Cleanup(name string) error
cleanup - manually remove socket
func (*TelemetryBuffer) Connect ¶
func (tb *TelemetryBuffer) Connect() error
func (*TelemetryBuffer) ConnectToTelemetryService ¶
func (tb *TelemetryBuffer) ConnectToTelemetryService(telemetryNumRetries, telemetryWaitTimeInMilliseconds int)
ConnectToTelemetryService - Attempt to spawn telemetry process if it's not already running.
func (*TelemetryBuffer) Dial ¶
func (tb *TelemetryBuffer) Dial(name string) (err error)
Dial - try to connect to/create a socket with 'name'
func (*TelemetryBuffer) Listen ¶
func (tb *TelemetryBuffer) Listen(name string) (err error)
Listen - try to create and listen on socket with 'name'
func (*TelemetryBuffer) PushData ¶
func (tb *TelemetryBuffer) PushData()
PushData - PushData running an instance if it isn't already being run elsewhere
func (*TelemetryBuffer) StartServer ¶
func (tb *TelemetryBuffer) StartServer() error
Starts Telemetry server listening on unix domain socket
type TelemetryConfig ¶
type TelemetryConfig struct { ReportToHostIntervalInSeconds time.Duration `json:"reportToHostIntervalInSeconds"` DisableAll bool DisableTrace bool DisableMetric bool DisableMetadataThread bool DebugMode bool DisableTelemetryToNetAgent bool RefreshTimeoutInSecs int BatchIntervalInSecs int BatchSizeInBytes int GetEnvRetryCount int GetEnvRetryWaitTimeInSecs int }
TelemetryConfig - telemetry config read by telemetry service
func ReadConfigFile ¶
func ReadConfigFile(filePath string) (TelemetryConfig, error)
ReadConfigFile - Read telemetry config file and populate to structure