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

Log telemetry item when parse or compilation options change #48215

Merged

Conversation

davidwengier
Copy link
Contributor

@davidwengier davidwengier commented Oct 1, 2020

Fixes AB#1171932

This logs some basic telemetry about how many parsed trees there are, and whether there was an existing compilation, when compilation options, parse options or assembly name is changed.

This is for @panopticoncentral to identify wasted work during solution load.

@davidwengier davidwengier marked this pull request as ready for review October 12, 2020 00:52
@davidwengier davidwengier requested a review from a team as a code owner October 12, 2020 00:53
@davidwengier
Copy link
Contributor Author

ping @jasonmalinowski this is ready for re-review

…tudioProject.cs

Co-authored-by: Jason Malinowski <jason@jason-m.com>
@ghost
Copy link

ghost commented Oct 26, 2020

Hello @davidwengier!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Auto-approval

Copy link
Member

@sharwell sharwell left a comment

Choose a reason for hiding this comment

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

Still reviewing performance impact

…tudioProject.cs

Co-authored-by: Sam Harwell <sam@tunnelvisionlabs.com>
/// </summary>
private static void TryReportCompilationThrownAway(SolutionState solutionState, ProjectId projectId)
{
// We log the number of syntax trees that have been parsed even if there was no compilation created yet
Copy link
Member

Choose a reason for hiding this comment

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

❔ Why are we gathering this in telemetry instead of just capturing the information as part of ETL traces submitted with performance reports? See #38194 for an example of a related case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess I don't know. I don't know what a "performance report" is. Is that something @panopticoncentral can read? If there is already a system in place for collecting this information then that's great, and I guess its a matter of telling Paul where to get that data?

My understanding was that this telemetry event would be used as part of other telemetry events that come from CPS, VS, possibly Nuget, to get a handle on what possible wasted work might be happening on solution load.

Copy link
Contributor

Choose a reason for hiding this comment

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

The thought was to be able to construct models of solution opens across the telemetry, rather than only being able to do it for explicitly captured traces.

Copy link
Member

@sharwell sharwell Oct 29, 2020

Choose a reason for hiding this comment

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

What steps are in place to ensure this telemetry can be disabled if it is observed to produce large amounts of data and/or have an observable impact on client load times? Roslyn aims for these operations to be efficient (i.e. throwing away a Compilation is part of the normal fast path), so putting a telemetry invocation on the path seems to defeat its goal.

Copy link
Member

Choose a reason for hiding this comment

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

One early option would disabling this telemetry if IsFullyLoadedAsync is true:

Task<bool> IsFullyLoadedAsync(CancellationToken cancellationToken);

This minimizes the impact of telemetry collection to a worst-case scenario of slower solution opening, while allowing us to expand the collection in the future if we both 1) demonstrate that it is not expensive and 2) demonstrate that analysis is in place such that the additional data is likely to directly result in a better future product.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely this is only needed for solution open initially, and I agree, the aim was to add a little bit of telemetry now and add more only if it proves useful. That's why this is limited to changes that don't happen often during "normal" use. I'm fine with adding an explicit check for fully-loaded-ness.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is annoyingly async. Is this pattern acceptable here? I would assume we don't want to block anything here.

Copy link
Member

Choose a reason for hiding this comment

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

Yes that pattern is fine. Also can file a bug for me to just make IsFullyLoadedAsync a synchronous method so this is handled automatically.

@sharwell
Copy link
Member

@davidwengier Two follow-up issues to file:

  1. Consider making IsFullyLoadedAsync a synchronous method
  2. Consider providing a default implementation of IWorkspaceTelemetryService so people don't have to remember that the service could be missing

@davidwengier davidwengier merged commit a6f654b into dotnet:master Nov 1, 2020
@davidwengier davidwengier deleted the CompilationThrownAwayTelemetry branch November 1, 2020 20:59
@ghost ghost added this to the Next milestone Nov 1, 2020
@davidwengier
Copy link
Contributor Author

Thanks all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants