Commit Graph
229 Commits
Author SHA1 Message Date
Antonio Scandurra 4d3c708387 Add simulate_random_delay to every implemented method in FakeDb 2022-07-01 12:05:29 +02:00
Antonio Scandurra d36a4888db Ensure worktrees have been sent before responding with definitions
Changing the frequency at which we update worktrees highlighted a
problem in the randomized tests that was causing clients to receive
a definition to a worktree *before* observing the registration of
the worktree itself. This was most likely caused by #1224 because
the scenario that pull request enabled was the following:

- Guest requests a definition pointing to a non-existant worktree
- Server forwards the request to the host
- Host sends an `UpdateProject` message
- Host sends a response to the definition request
- Server observes the `UpdateProject` message and tries to acquire
  the store
- Given that we're waiting, the server goes ahead to process the
  response for the definition request, responding *before*
  `UpdateProject` is forwarded
- Server finally forwards `UpdateProject` to the guest

This commit ensures that, after forwarding a project request and getting a
response, we acquire a lock to the store again to ensure the project still
exists. This has the effect of ordering the forwarded request *after* any
message that was received prior to the response and for which we are still
waiting to acquire a lock to the store.
2022-07-01 11:45:30 +02:00
Max Brunsfeld c5351a1276 Ensure that usernames, user ids, and client ids match in random collaboration test
This makes the logs easier to interpret
2022-06-30 14:51:22 -07:00
Antonio Scandurra 484af8c7c4 Split worktree updates when a peer joins an already-shared project 2022-06-30 16:49:56 +02:00
Antonio Scandurra 09bb3ddeb8 Split worktree updates and only send 256 entries at a time 2022-06-30 14:06:41 +02:00
Antonio Scandurra ca1d0a6e59 Ignore tokens that were not created via WorkDoneProgressCreate
With the new version of rust-analyzer, we were seeing stray `WorkDoneProgress::End`
messages that create an imbalance in the `pending_diagnostic_updates` that never
resolves. This was causing the diagnostic status bar item to never update because
we wouldn't emit `DiskBasedDiagnosticsStarted` nor `DiskBasedDiagnosticsFinished`.

This commit fixes the above situation by only acknowledging progress report for tokens
that have explicitly been created via the `WorkDoneProgressCreate` request, as stated
by the protocol.

In addition to that, we are replacing the `pending_diagnostic_updates: isize` with
a `has_pending_diagnostic_updates: bool`. We added it at some point to prevent a similar
issue where we would observe begin/end reports in a seemingly random order, which would cause
us to permanently display a `checking...` message in the status bar. I believe this commit
fixes that as well because the `isize` was just a less general solution for the same
underlying issue. As the protocol states: "the token provided in the create request should
only be used once (e.g. only one begin, many report and one end notification should be sent
to it)."
2022-06-28 10:08:43 +02:00
Keith Simmons bc82d98ae5 Merge pull request #1237 from zed-industries/jump-to-definition
Mouse jump to definition
2022-06-27 15:20:07 -07:00
Keith Simmons 848445455d Working underline based on symbol origin 2022-06-24 15:05:35 -07:00
Nathan Sobo 4da3005b5c Allow users with no invites to be fetched from the API 2022-06-24 09:57:52 -06:00
Antonio Scandurra b0eb692760 WIP 2022-06-24 17:21:58 +02:00
Antonio Scandurra fc5517b6be Gather metrics only when /metrics endpoint is retrieved 2022-06-24 09:28:52 +02:00
Antonio Scandurra a04adbcac1 Don't trace message payload 2022-06-24 09:27:22 +02:00
Antonio ScandurraandNathan Sobo 555847449b Use BTreeMap in Server so we release memory when maps are cleared
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-06-23 18:02:17 +02:00
Antonio Scandurra f2d134917e Remove non-determinism from Peer caused by smol's timeout helper 2022-06-22 18:39:12 +02:00
Antonio Scandurra 071d940a88 Ensure receive timeout is triggered before waiting on disconnection 2022-06-22 18:02:42 +02:00
Antonio Scandurra 9b521d6097 Use Arc<Deterministic> to understand which await points are parking 2022-06-22 17:39:34 +02:00
Antonio Scandurra 62521531a6 💄 2022-06-22 15:06:22 +02:00
Antonio Scandurra fb2590d913 Use a FuturesUnordered to process foreground messages
This prevents deadlocks when e.g., client A performs a request to client B and
client B performs a request to client A. If both clients stop processing further
messages until their respective request completes, they won't have a chance to
respond to the other client's request and cause a deadlock.

This arrangement ensures we will attempt to process earlier messages first, but fall
back to processing messages arrived later in the spirit of making progress.
2022-06-22 15:04:17 +02:00
Antonio Scandurra 6eb3e72c36 Add test demonstrating hang when peers wait on each other's response 2022-06-22 14:41:14 +02:00
Antonio ScandurraandMax Brunsfeld 69aa3d848e Report running language servers when sharing project for the first time
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-06-21 20:39:54 +02:00
Max BrunsfeldandAntonio Scandurra e9d19457d6 Add failing test for replication of lsp statuses
Co-authored-by: Antonio Scandurra <me@as-cii.com>
2022-06-21 11:27:08 -07:00
Max BrunsfeldandAntonio Scandurra 30d75620f1 Fix error when worktree has no file extensions
Co-authored-by: Antonio Scandurra <me@as-cii.com>
2022-06-21 11:02:13 -07:00
Antonio Scandurra db77601aa2 Expose project metadata via GET /project_metadata 2022-06-21 18:06:31 +02:00
Antonio Scandurra ebaf3224fd Exclude staff from activity recording 2022-06-21 16:07:59 +02:00
Antonio Scandurra c90e8c08a6 Accept a datetime range when querying project activity 2022-06-21 14:03:10 +02:00
Antonio Scandurra 95a629d200 Unregister project from db when user disconnects or manually does so 2022-06-21 10:37:34 +02:00
Antonio Scandurra 7acebc4eb8 Register projects in the database and record worktree extensions 2022-06-21 10:29:26 +02:00
Max Brunsfeld 44160869eb Add an API that returns the most active users and the projects where they've been active 2022-06-20 19:46:37 -07:00
Antonio Scandurra 6f7a893ec9 Determine Buffer::is_dirty based on the rope's fingerprint 2022-06-17 12:38:25 +02:00
Antonio Scandurra 197a4342d0 Fix tests 2022-06-15 11:16:26 +02:00
Antonio Scandurra a85f9e74b1 Harvest the latest metrics when /metrics is requested
Now that we track active projects, if nothing happens to the store
during the activity timeout we would still serve some old metrics
that may not account for the staleness of a project.

This commit changes it so that we grab a mutable reference to the store
before serving the metrics, which has the side effect of updating
all the metrics.
2022-06-15 10:54:51 +02:00
Antonio Scandurra e373e05d27 🎨 2022-06-15 10:42:37 +02:00
Antonio Scandurra 3a1d0dd692 Track active projects in metrics
An active project is defined as a project where there has been at
least a buffer edit, a join request/response, or a follow update
in the last minute.
2022-06-15 10:33:20 +02:00
Antonio Scandurra 6d93a41f40 Exclude admins from collected metrics 2022-06-14 16:26:00 +02:00
Antonio Scandurra 68093342e7 Broadcast only visible worktree root names 2022-06-14 15:15:23 +02:00
Antonio Scandurra 76da93d260 Merge branch 'main' into users-api 2022-06-14 11:14:16 +02:00
Antonio Scandurra 49d7b4bc12 Allow specifying query, limit and page when hitting /api/users
This is needed to introduce pagination and search in our admin panel.
2022-06-13 17:30:01 +02:00
Antonio Scandurra fe1a861bf3 Expose a new POST /api/bulk_users API to create many users at once
This API will accept a vector of JSON entries containing the GitHub login,
the email address and the invite count. If that user already exist, the
invite count will be updated to the new one.
2022-06-13 15:18:18 +02:00
Antonio Scandurra b1e8e81513 Merge pull request #1172 from zed-industries/more-logs
Add more logging to `collab` to better understand user behavior
2022-06-13 09:22:37 +02:00
Antonio Scandurra 502625c570 Exclude ignored files from the logged extension count 2022-06-13 09:16:16 +02:00
Antonio Scandurra dcdc6311df Don't retain message payloads in span, just log the payload instead 2022-06-13 09:06:58 +02:00
Antonio Scandurra 3b8388dcdd Log extension counts when worktree is updated 2022-06-13 08:57:21 +02:00
Max Brunsfeld e2935100db Move prometheus annotations from deployment to pod spec 2022-06-10 14:32:36 -07:00
Max BrunsfeldandAntonio Scandurra 2311534c3c Add DataDog OpenMetrics annotations to collab k8s deployment
Co-authored-by: Antonio Scandurra <me@as-cii.com>
2022-06-10 13:35:52 -07:00
Max BrunsfeldandAntonio Scandurra 2e6fa889ea Add OpenMetrics endpoint exposing the basic RPC store metrics as guages
Co-authored-by: Antonio Scandurra <me@as-cii.com>
2022-06-10 13:32:56 -07:00
Antonio Scandurra 63fdf1398a WIP: Start adding more logs 2022-06-10 18:17:02 +02:00
Antonio Scandurra 494a1b332f Reduce log level on collab
This is generating way too much data and doesn't seem very cost-effective
to investigate the issues we've had with the stale contacts panel.
2022-06-08 09:06:13 +02:00
Keith Simmons 1b66e1e185 Add integration test and fix hovering over the wire 2022-06-07 14:22:02 -07:00
Max Brunsfeld ce080e9520 Update connected users' invite info when they are granted invite codes 2022-06-06 11:14:01 -07:00
Max Brunsfeld ed14fd6e0d Add setting to make projects online/offline by default 2022-06-03 17:01:15 -07:00