added new fields for telemetry

This commit is contained in:
Tamilmani Manoharan 2019-01-23 17:10:29 -08:00
Родитель 63a4d0f469
Коммит d04d6bd9ed
4 изменённых файлов: 19 добавлений и 12 удалений

Просмотреть файл

@ -189,9 +189,9 @@ func (plugin *netPlugin) Add(args *cniSkel.CmdArgs) error {
log.Printf("[cni-net] Read network configuration %+v.", nwCfg)
report := plugin.reportManager.Report.(*telemetry.CNIReport)
report.Context = "CNI ADD"
report.OperationType = "CNI ADD"
if nwCfg.MultiTenancy {
report.SubContext = "Multitenancy"
report.Context = "Multitenancy"
}
defer func() {
@ -480,7 +480,7 @@ func (plugin *netPlugin) Add(args *cniSkel.CmdArgs) error {
return err
}
msg := fmt.Sprintf("CNI ADD succeeded : allocated ipaddress %v podname %v namespace %v", epInfo.IPAddresses[0].IP.String(), k8sPodName, k8sNamespace)
msg := fmt.Sprintf("CNI ADD succeeded : allocated ipaddress %+v podname %v namespace %v", result, k8sPodName, k8sNamespace)
report.EventMessage = msg
return nil
}
@ -598,9 +598,9 @@ func (plugin *netPlugin) Delete(args *cniSkel.CmdArgs) error {
log.Printf("[cni-net] Read network configuration %+v.", nwCfg)
report := plugin.reportManager.Report.(*telemetry.CNIReport)
report.Context = "CNI DEL"
report.OperationType = "CNI DEL"
if nwCfg.MultiTenancy {
report.SubContext = "Multitenancy"
report.Context = "Multitenancy"
}
// Parse Pod arguments.

Просмотреть файл

@ -9,6 +9,7 @@ import (
"io/ioutil"
"os"
"reflect"
"time"
"github.com/Azure/azure-container-networking/cni"
"github.com/Azure/azure-container-networking/cni/network"
@ -182,6 +183,9 @@ func main() {
reportManager.Report.(*telemetry.CNIReport).GetReport(pluginName, version, ipamQueryURL)
t := time.Now()
reportManager.Report.(*telemetry.CNIReport).Timestamp = t.String()
if !reportManager.GetReportState(telemetry.CNITelemetryFile) {
log.Printf("GetReport state file didn't exist. Setting flag to true")

Просмотреть файл

@ -109,10 +109,14 @@ type CNIReport struct {
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

Просмотреть файл

@ -28,10 +28,9 @@ import (
// DefaultNpmReportsSize - default NPM report slice size
// DefaultInterval - default interval for sending payload to host
const (
FdName = "azure-telemetry"
Delimiter = '\n'
//HostNetAgentURL = "http://169.254.169.254/machine/plugins?comp=netagent&type=payload"
HostNetAgentURL = "http://localhost:8019/hostnetagent?container/1234/payload"
FdName = "azure-telemetry"
Delimiter = '\n'
HostNetAgentURL = "http://169.254.169.254/machine/plugins?comp=netagent&type=payload"
telemetryMgrProcessName = "azuretelemetrymgr"
DefaultInterval = 1 * time.Minute
)
@ -245,7 +244,7 @@ func (pl *Payload) push(x interface{}) {
case DNCReport:
dncReport := x.(DNCReport)
dncReport.Metadata = metadata
pl.DNCReports = append(pl.DNCReports, x.(DNCReport))
pl.DNCReports = append(pl.DNCReports, dncReport)
case CNIReport:
cniReport := x.(CNIReport)
metadata.Tags = metadata.Tags + ";" + cniReport.Version
@ -255,11 +254,11 @@ func (pl *Payload) push(x interface{}) {
case NPMReport:
npmReport := x.(NPMReport)
npmReport.Metadata = metadata
pl.NPMReports = append(pl.NPMReports, x.(NPMReport))
pl.NPMReports = append(pl.NPMReports, npmReport)
case CNSReport:
cnsReport := x.(CNSReport)
cnsReport.Metadata = metadata
pl.CNSReports = append(pl.CNSReports, x.(CNSReport))
pl.CNSReports = append(pl.CNSReports, cnsReport)
}
}