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

Implement support in the LSIF generator for logging to stderr #70067

Merged

Conversation

jasonmalinowski
Copy link
Member

LSIF tools can implement an optional logging format which is written to stderr; this implements that format.

Addresses part of #69610; there isn't telemetry yet.

@jasonmalinowski jasonmalinowski requested a review from a team as a code owner September 22, 2023 03:32
@jasonmalinowski jasonmalinowski self-assigned this Sep 22, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Sep 22, 2023
Previously we were just passing around a TextWriter which wasn't great.
@gundermanc
Copy link
Member

IIRC @noellelc had a wish-list for "guard-rail" metrics returned in telemetry. I don't recall the specifics... maybe it was "DocumentCount" and "ProjectCount".

there isn't telemetry yet.

This is intentionally open ended in hopes you have ideas for what would be most useful for optimizing the generator. Some ideas that come to mind for me are:

  • Accumulated time spent on each result type.
  • Document count
  • Project count
  • Average and Max for things like 'documents per project', 'hover length', 'semantic tokens' length. (e.g.: I've seen examples of semantic tokens vertices that were 5MB+ in size).


var solution = await openAsync(msbuildWorkspace, cancellationToken);

var options = GeneratorOptions.Default;

await logFile.WriteLineAsync($"Load completed in {solutionLoadStopwatch.Elapsed.ToDisplayString()}.");
var lsifGenerator = Generator.CreateAndWriteCapabilitiesVertex(lsifWriter, logFile);
logger.LogInformation($"Load completed in {solutionLoadStopwatch.Elapsed.ToDisplayString()}.");
Copy link
Member

Choose a reason for hiding this comment

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

Are any of these stopwatch times things that we want to be aggregated? If so, they could be passed as telemetry also/instead.

Perhaps a future improvement.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, we will, but for this was just step 1.

@jasonmalinowski jasonmalinowski force-pushed the implement-lsif-logging-format branch from 1586fab to 4bc3379 Compare September 28, 2023 20:53
LSIF tools can implement an optional logging format which is written
to stderr; this implements that format.
@jasonmalinowski jasonmalinowski force-pushed the implement-lsif-logging-format branch from 4bc3379 to 3f27bc1 Compare September 28, 2023 21:27
}
}

private sealed record CommandWithParameters(string Command, object Parameters);
Copy link
Member

Choose a reason for hiding this comment

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

Is this a standard format from somewhere? Or are we creating our own logging protocol?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a new format for LSIF generators specifically; @gundermanc can comment more on that. There's a part I haven't implemented yet here where it also can contain data points like "number of documents processed" which we can also use to monitor system health.


ILogger logger;
if (logFile is not null)
logger = new PlainTextLogger(logFile);
Copy link
Member

Choose a reason for hiding this comment

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

do we never want to write the lsif format log to a file?

Copy link
Member Author

Choose a reason for hiding this comment

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

@gundermanc do you want that?

Copy link
Member

Choose a reason for hiding this comment

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

If the standard error stream works, I don't intend on using the log file.

@jasonmalinowski jasonmalinowski merged commit 18de4b9 into dotnet:main Oct 2, 2023
@jasonmalinowski jasonmalinowski deleted the implement-lsif-logging-format branch October 2, 2023 21:16
@ghost ghost added this to the Next milestone Oct 2, 2023
@jjonescz jjonescz modified the milestones: Next, 17.9 P1 Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants