-
Notifications
You must be signed in to change notification settings - Fork 4k
Client-side telemetry is opt-in by default #4396
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
Conversation
@@ -52,6 +53,31 @@ public class MetricHelper | |||
/// </summary> | |||
private readonly object _lock = new object(); | |||
|
|||
private static string _hashMacAddress = string.Empty; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not initialize to null
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted null
to represent that there was no valid NIC found. I used string.Empty
to represent that we haven't tried to initialize the value of _hashMacAddress
yet
_hashMacAddress = GenerateSha256HashString(macAddress).Replace("-", string.Empty).ToLowerInvariant(); | ||
break; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole thing could be reduced to
var physicalAddress = nics.FirstOrDefault(nic => nic.OperationalStatus == OperationalStatus.Up)?.GetPhysicalAddress();
if(physicalAddress != null)
_hashMacAddress = GenerateSha256HashString(macAddress.ToString()).Replace("-", string.Empty).ToLowerInvariant();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, not the whole thing...the loopy part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll clean that up. I always forget about Linq
😄
To enable data collection: PS > Enable-AzureDataCollection | ||
|
||
Select Y to enable data collection [Y/N]:</value> | ||
Use the Disable-AzureRmDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the AzureRM.Profile module. To disable data collection: PS &gt; Disable-AzureRmDataCollection. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want the PS >
?
@azuresdkci test this please |
InitializeDataCollectionProfile(); | ||
|
||
if (!_dataCollectionProfile.EnableAzureDataCollection.HasValue && CheckIfInteractive()) | ||
if (_dataCollectionProfile.EnableAzureDataCollection.HasValue || !CheckIfInteractive()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should no longer need this (and in fact, we should remove this method if it is not used elsewhere (except tests)
|
||
private static string HashMacAddress | ||
{ | ||
get |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this an instance value instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved offline - let's not test the value of _hashMacAddress in the code that sets the value.
{ | ||
var macAddress = NetworkInterface.GetAllNetworkInterfaces() | ||
.FirstOrDefault(nic => nic.OperationalStatus == OperationalStatus.Up)? | ||
.GetPhysicalAddress().ToString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You actually need an elvis operator preceding the ToString()
since the preceding code can evaluate to null
.
var macAddress = NetworkInterface.GetAllNetworkInterfaces()
.FirstOrDefault(nic => nic.OperationalStatus == OperationalStatus.Up)?
.GetPhysicalAddress()?.ToString();
@@ -52,6 +54,24 @@ public class MetricHelper | |||
/// </summary> | |||
private readonly object _lock = new object(); | |||
|
|||
private string _hashMacAddress = string.Empty; | |||
|
|||
private string HashMacAddress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be static
👍 |
Description
Fix for issue #4179 and #4330
AzureDataCollectionProfile.json
file will be removed and replaced byAzurePSDataCollectionProfile.json
HashMacAddress
to telemetryThis checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.
General Guidelines
Testing Guidelines
Cmdlet Signature Guidelines
ShouldProcess
and haveSupportShouldProcess=true
specified in the cmdlet attribute. You can find more information onShouldProcess
here.OutputType
attribute if any output is produced - if the cmdlet produces no output, it should implement aPassThru
parameter.Cmdlet Parameter Guidelines