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

Fix LSP fetching bug and Emit getServer after each step of LSP fetching #260

Merged
merged 2 commits into from
Nov 21, 2024

Conversation

nborges-aws
Copy link
Contributor

@nborges-aws nborges-aws commented Nov 21, 2024

Description of changes:
This change emits a failure event for when retrieving the LSP from a certain location fails. This is an intermediate failure and the entire step can still succeed, so these cases should don't cause a setupAll event to be emitted. Also made lsp install getter synchronized, as concurrent execution was causing the lsp server to be fetched twice.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@nborges-aws nborges-aws changed the title Emit getServer after each step of LSP fetching Fix LSP fetching bug and Emit getServer after each step of LSP fetching Nov 21, 2024
@nborges-aws nborges-aws merged commit 53c340f into main Nov 21, 2024
1 check passed
@nborges-aws nborges-aws deleted the nickdb/lspTelemetryUpdates branch November 21, 2024 22:45
@@ -52,7 +52,7 @@ public static Builder builder() {
}

@Override
public LspInstallResult getLspInstallation() {
public synchronized LspInstallResult getLspInstallation() {
Copy link
Contributor

Choose a reason for hiding this comment

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

in what scenario are we attempting to make this call twice? I believe this call should only happen during initialization of the language server.

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 discovered a bug where language server initialization process was restarting prior to completion, and confirmed it with @breedloj. GetLspInstallation is being called in the language server setup process, as well as in the set up process of the chat view. It was possible for installResult to still be null by the time chatView was calling the getLspInstallation method, and thus was restarting the fetch process.

@@ -101,6 +101,7 @@ public LspFetchResult fetch(final PluginPlatform platform, final PluginArchitect

// delete invalid local cache
ArtifactUtils.deleteDirectory(downloadDirectory);
emitGetServer(Result.FAILED, serverVersion, LanguageServerLocation.CACHE, null, start);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not a valid state to capture. Because this does not indicate that langauge server fetching failed. There is still logic to get to the fallback lsp which indicates that fetching process still succeeded but could not resolve cache. These intermediate states are just noise. There should only be one metric for each step of the lsp process

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Multiple metrics for each step of the lsp process was specifically requested within the telemetry. However you're correct in this emission being unnecessary regardless; it's been removed.

@@ -36,14 +37,14 @@ public static void emitSetupGetManifest(final Result result, final RecordLspSetu

public static void emitSetupGetServer(final Result result, final RecordLspSetupArgs args) {
emitSetupMetric(result, args, LanguageServerSetupStage.GET_SERVER);
if (result == Result.FAILED) {
if (result == Result.FAILED && args.getLocation() == LanguageServerLocation.UNKNOWN) {
Copy link
Contributor

Choose a reason for hiding this comment

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

when does unknown get emitted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unknown only is emitted when the getServer process has a complete failure. This logic is necessary given the requested change to fire a telemetry event for each piece of the getServer process. If getServer from remote fails but fallback succeeds, we should not be emitting a setupAll failure event. This check ensures that any intermediate failure does not fire the setupAll metric, but a full failure of getServer does.

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