Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

* NEW: Add --disable-telemetry argument to disable telemetry collection #975

Merged
merged 11 commits into from
Jan 10, 2024

Conversation

shaopeng-gh
Copy link
Collaborator

If you have the telemetry connection string set,
you can use this new setting to quickly disable it without actually remove the setting,
so that your detail scan results will not be send.

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link

@scottoneil-ms scottoneil-ms Dec 1, 2023

Choose a reason for hiding this comment

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

I do not know how to review this, you might need a second set of eyes for it. #Resolved

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the .net resource file is auto gen,
the only thing that is worth looking is the DefaultTelemetryConnectionString at the end.

@@ -172,6 +173,11 @@ public override int Run(AnalyzeOptions analyzeOptions)
{
Stopwatch stopwatch = null;

if (analyzeOptions.DisableTelemetry == true)
{
this.Telemetry = null;
Copy link

@scottoneil-ms scottoneil-ms Dec 1, 2023

Choose a reason for hiding this comment

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

This worries me a bit. I see that if it's null, we just don't add a certain logger to an aggregate logger. That looks great.

But then a little bit later, we pass this thing into a method. Does that call flow lead to uses? Is it already nullchecked? #Resolved

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes it is,
in fact our application is checking if it is null to see enabled or not,
if null, no Telemetry will be performed.

Copy link
Member

Choose a reason for hiding this comment

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

Scott's right, you haven't gotten this change quite right, which is to enable telemetry collection by default but allow someone to override that via this argument.

Where is the code that makes telemetry work out of box with no special configuration?

@@ -70,5 +70,40 @@ public void MostlyFunctionlessCommandlineTest()
builder.Length.Should().Be(0,
$"all test cases should pass, but the following test cases failed:\n{builder}");
}

[Fact]
public void DisableTelemetryCommandlineTest()
Copy link

@scottoneil-ms scottoneil-ms Dec 1, 2023

Choose a reason for hiding this comment

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

I don't know what the rest of this suite looks like, and I'm not 100% sure I'm following this test. So tell me if this is here and I'm not seeing it. But: I think you need a test that disables telemetry, runs a scan against a well-known file (I see this much) and then verifies that the scan results are the same as if you had not passed in disable-telemetry (I don't see this part.)
#Resolved

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good input. Added another test.

@stacywray
Copy link

@shaopeng-gh Release history looks good.

Copy link

@stacywray stacywray left a comment

Choose a reason for hiding this comment

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

:shipit:

@@ -70,5 +70,40 @@ public void MostlyFunctionlessCommandlineTest()
builder.Length.Should().Be(0,
$"all test cases should pass, but the following test cases failed:\n{builder}");
}

[Fact]
public void DisableTelemetryCommandlineTest()
Copy link
Member

Choose a reason for hiding this comment

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

DisableTelemetryCommandlineTest

i don't see any tests that prove that telemetry isn't collected in a tool run where this setting is specified. how do we know it works?

@michaelcfanning michaelcfanning enabled auto-merge (squash) January 9, 2024 17:42
Copy link
Member

@michaelcfanning michaelcfanning left a comment

Choose a reason for hiding this comment

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

:shipit:

@michaelcfanning michaelcfanning merged commit ead922c into main Jan 10, 2024
6 checks passed
@michaelcfanning michaelcfanning deleted the users/shaopeng-gh/DefaultTelemetry branch January 10, 2024 17:13
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.

4 participants