Skip to content

Conversation

@tamilmani1989
Copy link
Member

@tamilmani1989 tamilmani1989 commented Dec 13, 2019

What this PR does / why we need it:
This PR adds AI telemetry support for CNI via telemetry service. The CNI will send telemetry data to telemetry service and telemetry service in turn will send data to AppInsight.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Special notes for your reviewer:

Release note:

var (
aiMetadata string
th aitelemetry.TelemetryHandle
gDisableAll bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the g prefix for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

g for global..already using disableAll in CreateAITelemetryHandle..added this to prevent conflict

return k8sPodName, k8sNamespace, nil
}

func setCustomDimensions(cniMetric *telemetry.CNIReport, nwCfg *cni.NetworkConfig, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if you need to check if the other pointers are nil here

Copy link
Member Author

@tamilmani1989 tamilmani1989 Dec 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed..nothing can be nil..

tb.ConnectToTelemetryService(telemetryNumRetries, telemetryWaitTimeInMilliseconds)
defer tb.Close()

netPlugin.SetCNIReport(cniReport, tb)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is tb declared?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tb := telemetry.NewTelemetryBuffer("")

// TelemetryConfig - telemetry config read by telemetry service
type TelemetryConfig struct {
ReportToHostIntervalInSeconds time.Duration `json:"reportToHostIntervalInSeconds"`
DisableAll bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this getting used?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used by telemetry service

return report, err
}

func SendCNIMetric(cniReport *CNIReport, tb *TelemetryBuffer) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of creating different functions for CNS, such as SendCNSMetric, can this be just one function like SendMetric and takes the type / *Report.
Can it take *Report to reuse the func signature between CNI, CNS ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope. CNI uses telemetry service but not cns

@saiyan86 saiyan86 changed the title AITelemetry support for CNI AppInsightTelemetry support for CNI Dec 19, 2019
ashvindeodhar
ashvindeodhar previously approved these changes Jan 3, 2020
@jaer-tsun jaer-tsun changed the title AppInsightTelemetry support for CNI [DO-NOT-MERGE] AppInsightTelemetry support for CNI Jan 3, 2020
id string,
aiConfig AIConfig,
) TelemetryHandle {
env, _ := os.LookupEnv("AZACN_TESTENV")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does it say TESTENV ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it supposed to say AZACN_CLOUDENV ? or just ENV ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is for uni test..just for making sure not conflicting with any other env variable

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No what I mean is why does the variable name says TESTENV. I thought it's a test environment - which is not the case here. I think it can be a bit misleading

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is for unit test to pass...unit test can't make call to metadata server..let me check if i can do with mockagent by passing url

enableSnatForDns bool
nwDNSInfo network.DNSInfo
cniMetric telemetry.CNIReport
cniMetric telemetry.AIMetric
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this changed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont want to change existing CNIReport structure as this schema used by hostnetagent


var payloadSize uint16 = 0
var (
payloadSize uint16 = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don;t think you need to set this to 0. GO inits variables ( like bool below ). You can choose to keep it / remove it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i didnt add this..i just moved this

@jaer-tsun jaer-tsun changed the title [DO-NOT-MERGE] AppInsightTelemetry support for CNI AppInsightTelemetry support for CNI Jan 13, 2020
@tamilmani1989
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tamilmani1989 tamilmani1989 merged commit 2d619b7 into Azure:master Jan 14, 2020
ashutoshishere04 pushed a commit to ashutoshishere04/azure-container-networking that referenced this pull request Jan 23, 2020
* Added AITelemetry support for CNI

* added new files

* added other configs in config file

* fixed ut

* updated disableall similar to cns

* added container name to report

* addressed review comments

* addressed review comments

* added check for azure environment

* added log

* close log handle in unit test

* addressed review comments

* addressed review comments

* fixed a condition

* keep the netagent channel for logs

* fixed error

* addressed review comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants