Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Use general middleware to report telemetry#571

Closed
vinistock wants to merge 1 commit intomainfrom
vs/use_general_middleware_for_telemetry
Closed

Use general middleware to report telemetry#571
vinistock wants to merge 1 commit intomainfrom
vs/use_general_middleware_for_telemetry

Conversation

@vinistock
Copy link
Copy Markdown
Member

Motivation

Closes Shopify/ruby-lsp#1498

Related to Shopify/ruby-lsp#650.

Use the new general middleware to benchmark requests and report telemetry entirely from the client side. This allows us to remove telemetry events from the server and cut the amount of IO it does in half.

Implementation

Added the new middleware and used perf_hooks to measure the performance of executing the requests. If a request fails, the server returns extra information about the errors in the response which we use to report.

Added a function to recursively sanitize URIs that are inside parameters so that it doesn't include the HOME part of the directory.

Added a function to figure out the version of the ruby-lsp gem.

I'd love to get some feedback on these three points. I'm especially not crazy about how we're figuring out the server version.

Note: we may want to hold back until there's a stable release of the languageclient package.

Manual Tests

  1. Start the LSP in development mode on this branch and using Remove server telemetry ruby-lsp#650
  2. Play around with the LSP
  3. Look at the debug console and verify that events are being printed properly

Comment thread src/client.ts
Perf.mark(`${type}.end`);

// Insert benchmarked response time into telemetry data
const bench = Perf.measure(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just to check here, can there be a case where there are multiple {type}.start being performed at once? Would this benefit from an additional unique identifier to ensure that they don't collide?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh, that's a great catch. If for any reason the server gets backlogged, we may indeed end up creating another start mark for the same request type.

@andyw8
Copy link
Copy Markdown
Contributor

andyw8 commented Jun 13, 2023

Moving to backlog as discussed at team meeting on 2023-06-12.

@vinistock vinistock modified the milestones: 2023-Q2, 2023-Q3 Jul 10, 2023
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 9, 2023

This pull request is being marked as stale because there was no activity in the last 2 months

@github-actions github-actions Bot added the Stale label Sep 9, 2023
@vinistock vinistock added pinned This issue or pull request is pinned and won't be marked as stale and removed Stale labels Sep 11, 2023
@greatscotty greatscotty deleted the vs/use_general_middleware_for_telemetry branch February 9, 2024 21:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request pinned This issue or pull request is pinned and won't be marked as stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explore end-to-end performance telemetry

3 participants