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

Add support for vs code markers #3399

Merged
merged 8 commits into from
May 20, 2020

Conversation

srdjanjovcic
Copy link
Contributor

@srdjanjovcic srdjanjovcic commented May 19, 2020

Issue

Fixes: https://github.com/NuGet/Client.Engineering/issues/302
Regression: No

Implementation

Implements a new API on INuGetTelemeteryService to log a telemetry marker, which is not sent as a telemetry event. Then, use the new API to emit a start code marker at the start of every activity.

Testing/Validation

Tests Added: Unit tests to execute new code paths.
Reason for not adding tests: N/A
Validation: Validated that correct ETW events are emitted where expected.

Copy link
Member

@nkolev92 nkolev92 left a comment

Choose a reason for hiding this comment

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

Looks good.

Can we add some basic tests please?

I see some stuff inhttps://github.com/NuGet/NuGet.Client/blob/dev/test/NuGet.Clients.Tests/NuGet.PackageManagement.VisualStudio.Test/Telemetry/NuGetTelemetryServiceTests.cs, but maybe there's better places too.

@srdjanjovcic
Copy link
Contributor Author

Can we add some basic tests please?

Will do.

@srdjanjovcic
Copy link
Contributor Author

srdjanjovcic commented May 19, 2020

This is how it looks like in ETW with this change. Events ending with /Start and /Stop are not sent to telemetry:

Microsoft-VisualStudio-Common/vs_nuget_projectinformation
Microsoft-VisualStudio-Common/vs_nuget_projectrestoreinformation/Start
Microsoft-VisualStudio-Common/vs_nuget_restorenoopinformation/Start
Microsoft-VisualStudio-Common/vs_nuget_restorenoopinformation
Microsoft-VisualStudio-Common/vs_nuget_restorenoopinformation/Stop
Microsoft-VisualStudio-Common/vs_nuget_restorelockfileinformation/Start
Microsoft-VisualStudio-Common/vs_nuget_restorelockfileinformation
Microsoft-VisualStudio-Common/vs_nuget_restorelockfileinformation/Stop
Microsoft-VisualStudio-Common/vs_nuget_generaterestoregraph/Start
Microsoft-VisualStudio-Common/vs_nuget_createrestoretargetgraph/Start
Microsoft-VisualStudio-Common/vs_nuget_createrestoretargetgraph
Microsoft-VisualStudio-Common/vs_nuget_createrestoretargetgraph/Stop
Microsoft-VisualStudio-Common/vs_nuget_generaterestoregraph/Stop
Microsoft-VisualStudio-Common/vs_nuget_generaterestoregraph
Microsoft-VisualStudio-Common/vs_nuget_generateassetsfile/Start
Microsoft-VisualStudio-Common/vs_nuget_generateassetsfile
Microsoft-VisualStudio-Common/vs_nuget_generateassetsfile/Stop
Microsoft-VisualStudio-Common/vs_nuget_validaterestoregraphs/Start
Microsoft-VisualStudio-Common/vs_nuget_validaterestoregraphs
Microsoft-VisualStudio-Common/vs_nuget_validaterestoregraphs/Stop
Microsoft-VisualStudio-Common/vs_nuget_createrestoreresult/Start
Microsoft-VisualStudio-Common/vs_nuget_createrestoreresult
Microsoft-VisualStudio-Common/vs_nuget_createrestoreresult/Stop
Microsoft-VisualStudio-Common/vs_nuget_projectrestoreinformation
Microsoft-VisualStudio-Common/vs_nuget_projectrestoreinformation/Stop
Microsoft-VisualStudio-Common/vs_nuget_restoreinformation
Microsoft-VisualStudio-Common/vs_nuget_restorepackagesourcesummary
Microsoft-VisualStudio-Common/vs_nuget_projectrestoreinformation/Start
Microsoft-VisualStudio-Common/vs_nuget_restorenoopinformation/Start
Microsoft-VisualStudio-Common/vs_nuget_restorenoopinformation
Microsoft-VisualStudio-Common/vs_nuget_restorenoopinformation/Stop
Microsoft-VisualStudio-Common/vs_nuget_projectrestoreinformation
Microsoft-VisualStudio-Common/vs_nuget_projectrestoreinformation/Stop
Microsoft-VisualStudio-Common/vs_nuget_restoreinformation
Microsoft-VisualStudio-Common/vs_nuget_restorepackagesourcesummary

@srdjanjovcic
Copy link
Contributor Author

Can we add some basic tests please?

Added unit tests for TelemetryActivity.

@nkolev92
Copy link
Member

You should rebase on top of latest dev because of ce4aa78

@@ -59,3 +59,4 @@
[assembly: SuppressMessage("Build", "CA1062:In externally visible method 'void OutputConsoleLogger.Log(ILogMessage message)', validate parameter 'message' is non-null before using it. If appropriate, throw an ArgumentNullException when the argument is null or add a Code Contract precondition asserting non-null argument.", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.VisualStudio.Common.OutputConsoleLogger.Log(NuGet.Common.ILogMessage)")]
[assembly: SuppressMessage("Build", "CA1823:Unused field 'LogEntrySource'.", Justification = "<Pending>", Scope = "member", Target = "~F:NuGet.VisualStudio.Common.OutputConsoleLogger.LogEntrySource")]
[assembly: SuppressMessage("Build", "CA1063:Provide an overridable implementation of Dispose(bool) on 'OutputConsoleLogger' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources.", Justification = "<Pending>", Scope = "type", Target = "~T:NuGet.VisualStudio.Common.OutputConsoleLogger")]
[assembly: SuppressMessage("Globalization", "CA1308:Normalize strings to uppercase", Justification = "Need to unify event names to be same as ones produced from telemetry.", Scope = "member", Target = "~M:NuGet.VisualStudio.NuGetVSTelemetryService.StartActivity(System.String)~System.IDisposable")]
Copy link
Member

Choose a reason for hiding this comment

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

this rule is getting annoying :)

I get why it's trying to promote and why it's less error prone, but there's so much infrastructure that depends normalizes to lowercase when the culture is known.

Thoughts @NuGet/nuget-client Should we disable this in a future PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think it is a good candidate for repo-wide suppression 🙂

@srdjanjovcic srdjanjovcic force-pushed the dev-srdjanj-Add-support-for-VS-code-markers branch from a331492 to 8ab0002 Compare May 20, 2020 02:36
@srdjanjovcic srdjanjovcic merged commit 85211a7 into dev May 20, 2020
@srdjanjovcic srdjanjovcic deleted the dev-srdjanj-Add-support-for-VS-code-markers branch May 20, 2020 05:52
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