Documentation ¶
Index ¶
- Constants
- func ReadFileByLines(filename string) ([]string, error)
- func SendCnsTelemetry(reports chan interface{}, service *restserver.HTTPRestService, ...)
- func SockExists() bool
- func StartTelemetryService(path string, args []string) error
- func WaitForTelemetrySocket(maxAttempt int, waitTimeInMillisecs time.Duration)
- type BridgeInfo
- type CNIReport
- type CNSReport
- type ClusterState
- type DNCReport
- type DiskInfo
- type InterfaceInfo
- type MemInfo
- type Metadata
- type NPMReport
- type OSInfo
- type OrchestratorInfo
- type Payload
- type ReportManager
- func (reportMgr *ReportManager) GetKernelVersion()
- func (reportMgr *ReportManager) GetReportState(telemetryFile string) bool
- func (reportMgr *ReportManager) ReportToBytes() ([]byte, error)
- func (reportMgr *ReportManager) SendReport(tb *TelemetryBuffer) error
- func (reportMgr *ReportManager) SetReportState(telemetryFile string) error
- type SystemInfo
- type TelemetryBuffer
- func (tb *TelemetryBuffer) BufferAndPushData(intervalms time.Duration)
- 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) StartServer() error
- func (tb *TelemetryBuffer) Write(b []byte) (c int, err error)
- type TelemetryConfig
Constants ¶
const ( // NPMTelemetryFile Path. NPMTelemetryFile = platform.NPMRuntimePath + "AzureNPMTelemetry.json" // 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 uint16 = 4096 )
FdName - file descriptor name Delimiter - delimiter for socket reads/writes azureHostReportURL - host net agent url of type payload DefaultInterval - default interval for sending payload to host logName - telemetry log name MaxPayloadSize - max payload size in bytes
const ( TelemetryServiceProcessName = "azure-vnet-telemetry" CniInstallDir = "/opt/cni/bin" )
const ( // CNSTelemetryFile - telemetry file path. CNSTelemetryFile = platform.CNSRuntimePath + "AzureCNSTelemetry.json" )
Variables ¶
This section is empty.
Functions ¶
func ReadFileByLines ¶ added in v1.0.0
ReadFileByLines reads file line by line and return array of lines.
func SendCnsTelemetry ¶ added in v1.0.16
func SendCnsTelemetry(reports chan interface{}, service *restserver.HTTPRestService, telemetryStopProcessing chan bool)
SendCnsTelemetry - handles cns telemetry reports
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 BridgeInfo ¶
CNI Bridge Details structure.
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 OrchestratorDetails OrchestratorInfo OSDetails OSInfo SystemDetails SystemInfo InterfaceDetails InterfaceInfo BridgeDetails BridgeInfo Metadata Metadata `json:"compute"` }
Azure CNI Telemetry Report structure.
func (*CNIReport) GetInterfaceDetails ¶ added in v1.0.9
GetInterfaceDetails creates a report with interface details(ip, mac, name, secondaryca count).
func (*CNIReport) GetOSDetails ¶
func (report *CNIReport) GetOSDetails()
This function creates a report with os details(ostype, version).
func (*CNIReport) GetOrchestratorDetails ¶ added in v1.0.9
func (report *CNIReport) GetOrchestratorDetails()
GetOrchestratorDetails creates a report with orchestrator details(name, 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 CNSReport ¶ added in v1.0.16
type CNSReport struct { IsNewInstance bool CPUUsage string MemoryUsage string Processes string EventMessage string DncPartitionKey string Timestamp string UUID string Errorcode string Metadata Metadata `json:"compute"` }
Azure CNS Telemetry Report structure.
type ClusterState ¶ added in v1.0.9
ClusterState contains the current kubernetes cluster state.
type DNCReport ¶ added in v1.0.15
type DNCReport struct { IsNewInstance bool CPUUsage string MemoryUsage string Processes string EventMessage string PartitionKey string Allocations string Timestamp string UUID string Errorcode string Metadata Metadata `json:"compute"` }
DNCReport structure.
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 Metadata ¶ added in v1.0.12
type Metadata struct { Location string `json:"location"` VMName string `json:"name"` Offer string `json:"offer"` OsType string `json:"osType"` PlacementGroupID string `json:"placementGroupId"` PlatformFaultDomain string `json:"platformFaultDomain"` PlatformUpdateDomain string `json:"platformUpdateDomain"` Publisher string `json:"publisher"` ResourceGroupName string `json:"resourceGroupName"` Sku string `json:"sku"` SubscriptionID string `json:"subscriptionId"` Tags string `json:"tags"` OSVersion string `json:"version"` VMID string `json:"vmId"` VMSize string `json:"vmSize"` KernelVersion string }
Metadata retrieved from wireserver
type NPMReport ¶ added in v1.0.9
type NPMReport struct { IsNewInstance bool ClusterID string NodeName string InstanceName string NpmVersion string KubernetesVersion string ErrorMessage string EventMessage string UpTime string ClusterState ClusterState Metadata Metadata `json:"compute"` }
NPMReport structure.
func (*NPMReport) GetReport ¶ added in v1.0.12
func (report *NPMReport) GetReport(clusterID, nodeName, npmVersion, kubernetesVersion string, clusterState ClusterState)
GetReport retrives npm and kubernetes cluster related info and create a report structure.
type OSInfo ¶
type OSInfo struct { OSType string OSVersion string KernelVersion string OSDistribution string ErrorMessage string }
OS Details structure.
type OrchestratorInfo ¶ added in v1.0.1
type OrchestratorInfo struct { OrchestratorName string OrchestratorVersion string ErrorMessage string }
Orchestrator Details structure.
type Payload ¶ added in v1.0.15
type Payload struct { DNCReports []DNCReport CNIReports []CNIReport NPMReports []NPMReport CNSReports []CNSReport }
Payload object holds the different types of reports
type ReportManager ¶
ReportManager structure.
func (*ReportManager) GetKernelVersion ¶ added in v1.0.12
func (reportMgr *ReportManager) GetKernelVersion()
Get kernel version
func (*ReportManager) GetReportState ¶ added in v1.0.12
func (reportMgr *ReportManager) GetReportState(telemetryFile string) bool
GetReportState will check if report is sent at least once by checking telemetry file.
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.
func (*ReportManager) SetReportState ¶ added in v1.0.12
func (reportMgr *ReportManager) SetReportState(telemetryFile string) error
SetReportState will save the state in file if telemetry report sent successfully.
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(hostReportURL string) *TelemetryBuffer
NewTelemetryBuffer - create a new TelemetryBuffer
func (*TelemetryBuffer) BufferAndPushData ¶ added in v1.0.18
func (tb *TelemetryBuffer) BufferAndPushData(intervalms time.Duration)
BufferAndPushData - BufferAndPushData running an instance if it isn't already being run elsewhere
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) StartServer ¶
func (tb *TelemetryBuffer) StartServer() error
Starts Telemetry server listening on unix domain socket
type TelemetryConfig ¶
type TelemetryConfig struct {
ReportToHostIntervalInSeconds time.Duration `json:"reportToHostIntervalInSeconds"`
}
TelemetryConfig - telemetry config read by telemetry service
func ReadConfigFile ¶
func ReadConfigFile(filePath string) (TelemetryConfig, error)
ReadConfigFile - Read telemetry config file and populate to structure