Commit Graph

268 Commits

Author SHA1 Message Date
Antonio Scandurra
a04adbcac1 Don't trace message payload 2022-06-24 09:27:22 +02:00
Antonio Scandurra
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 Scandurra
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 Brunsfeld
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 Brunsfeld
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 Brunsfeld
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 Brunsfeld
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
Max Brunsfeld
24aafde1e8 Avoid persisting project's state before it has been initialized 2022-06-03 16:40:16 -07:00
Max Brunsfeld
e18bc24989 Rename project's 'public'/'private' flag to 'online'/'offline' 2022-06-03 14:39:06 -07:00
Max Brunsfeld
b2aa831017 Store a FakeFs on TestClient 2022-06-03 13:49:47 -07:00
Max Brunsfeld
8bd4a0ab81 Don't store Project on TestClient in integration tests 2022-06-03 13:00:56 -07:00
Max Brunsfeld
db97dcd76f Don't update contacts when a project is first registered
Until the host has sent an UpdateProject message to populate the project's
metadata, there is no reason to update contacts.
2022-06-02 17:41:21 -07:00
Max Brunsfeld
f7e7a7c6a7 Use rocksdb to store project paths' public/private state 2022-06-02 17:38:33 -07:00
Max Brunsfeld
724affc442 Upgrade deps to avoid multiple versions of transitive deps
* env_logger
* prost-build
* bindgen
2022-06-02 17:38:33 -07:00
Max Brunsfeld
d11beb3c02 Change project registration RPC APIs to smooth out UI updates
* Make `UnregisterProject` a request. This way the client-side project can wait
  to clear out its remote id until the request has completed, so that the
  contacts panel can avoid showing duplicate private/public projects in the
  brief time after unregistering a project, before the next UpdateCollaborators
  message is received.
* Remove the `RegisterWorktree` and `UnregisterWorktree` methods and replace
  them with a single `UpdateProject` method that idempotently updates the
  Project's list of worktrees.
2022-06-02 17:32:43 -07:00
Max Brunsfeld
4d4ec793e2 Remove stray println 2022-06-02 17:32:43 -07:00
Max Brunsfeld
3ea061a11e Allow making projects private 2022-06-02 17:32:42 -07:00
Max Brunsfeld
8f676e76b3 Fix mismatched client/context in integration test 2022-06-02 17:29:11 -07:00
Max Brunsfeld
7ef9de32b1 Show private projects in the contacts panel
Introduce a ProjectStore that lets you iterate through all open projects.
Allow projects to be made public by clicking the lock.
2022-06-02 17:29:11 -07:00
Max Brunsfeld
a60fef52c4 Start work on private projects 2022-06-02 17:29:11 -07:00
Antonio Scandurra
6baf8b033b Don't reuse the same diagnostic group id across buffers
This lets us use the group id as the key for an `ElementState`, which
fixes a panic that would occur in project diagnostics when opening it
while there were multiple diagnostic groups with the same id.
2022-06-02 12:05:28 +02:00
Antonio Scandurra
1ce8682b94 Clear language server and worktree statuses when unsharing on server 2022-05-31 11:22:41 +02:00
Antonio Scandurra
339069b1d3 Cap MessageStream buffer size to 1MB
We temporarily let it grow when the message size exceed the limit,
but restore the buffer's capacity shortly after. This ensures that,
for each connection in its entire lifetime, we only ever use 1MB.
2022-05-31 11:16:32 +02:00
Antonio Scandurra
da46d78ea5
Merge pull request #1081 from zed-industries/project-panel-with-new-mouse-events
Introduce context menu to project panel
2022-05-31 10:40:42 +02:00
Antonio Scandurra
354488ebdf Don't eagerly populate copied subdirectory
This can race anyway with snapshot updates, so we just eagerly refresh
the root entry and wait for updates to come in to populate it.
2022-05-31 08:11:07 +02:00
Max Brunsfeld
365cda0fab Remove opentelemetry tracing subscriber
We'll see if this stops the server from leaking memory. We still
have spans in our logs.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-05-30 09:58:25 -07:00
Antonio Scandurra
20e1044d49 Merge branch 'main' into project-panel-with-new-mouse-events 2022-05-30 18:29:46 +02:00
Antonio Scandurra
51adc6517e WIP: start on an integration test for copy_entry 2022-05-30 14:53:10 +02:00
Antonio Scandurra
3336bc6ab3 Implement copy paste for ProjectPanel 2022-05-30 14:52:34 +02:00
Max Brunsfeld
bc6f8da029 Move integration tests into their own file 2022-05-27 17:20:05 -07:00
Max Brunsfeld
8393ae88b7 Clean up integration tests
* Use 'build_local_project' helper to reduce boilerplate
* Peform the setup steps in a consistent order
2022-05-27 17:10:45 -07:00
Max Brunsfeld
b2adff63e7
Merge pull request #1073 from zed-industries/window-menu
Add a Window application menu
2022-05-27 11:22:13 -07:00
Max Brunsfeld
23cd948b5f Adjust test to flush effects between splitting pane and following
Panes now emit an event when adding the first item, so we need to flush
effects between splitting and following in order to avoid accidentally
cancelling the follow.
2022-05-27 10:53:14 -07:00
Max Brunsfeld
a1a4c70845 Emit an event when adding a worktree to a project 2022-05-27 10:48:47 -07:00
Keith Simmons
125d83b3ec Fix failing seed bin build and add bin builds to ci pipeline 2022-05-26 15:41:24 -07:00
Antonio Scandurra
f403d87eff WIP 2022-05-26 09:59:25 +02:00
Antonio Scandurra
3ac6fc89c1 Pretty-print JSON of server snapshot 2022-05-26 09:34:39 +02:00
Nathan Sobo
742dd75041 Implement /rpc_server_snapshot endpoint
This returns a JSON snapshot of the state of the server
2022-05-25 17:42:25 -06:00
Antonio Scandurra
5c4bd9393f
Merge pull request #1050 from zed-industries/ignored-files
Show ignored entries in project panel
2022-05-24 10:57:16 +02:00
Antonio Scandurra
85f228dade Fix logic error when streaming ignored entries
We were calling `next` twice, which led us to skip every other entry.
This commit also enhances the `test_share_project` integration test
to exercise this new streaming logic.
2022-05-24 09:03:05 +02:00
Nathan Sobo
6ed503fe6e Implement get_invite_code_for_user on test db 2022-05-23 18:07:23 -06:00
Nathan Sobo
5c2fdc01ff Update foreign key constraints to allow users to be deleted
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-23 17:46:06 -06:00
Nathan Sobo
51a61cc485 Don't assign invite code when updating count from 0 to 0
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-23 17:28:05 -06:00
Nathan Sobo
4b8f24c84e Set INVITE_LINK_PREFIX in K8s 2022-05-23 15:49:51 -06:00
Nathan Sobo
d8dbbf1c05 Merge remote-tracking branch 'origin/main' into invite-codes-2 2022-05-23 15:46:39 -06:00
Antonio Scandurra
2af4bdef42 Broadcast proto::UnregisterProject when host closes a project 2022-05-23 15:38:01 +02:00
Nathan Sobo
7a8ff5abd7 Accept an optional email address when creating new users 2022-05-20 20:25:21 -06:00
Antonio Scandurra
b751156cd7 Rename first_connection to connected_once
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-05-20 17:35:00 +02:00
Antonio Scandurra
d8ee4378c9 Send a ShowContacts message the first time a user connects to collab 2022-05-20 15:47:14 +02:00
Antonio Scandurra
6f2c3f1e37 Update users and invite count after an invite gets redeemed 2022-05-20 12:02:31 +02:00
Nathan Sobo
eedb8ba59f Add affordance to copy user's invite link if they have a code
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-05-19 17:57:46 -06:00
Max Brunsfeld
c4554c1720 Replace build_workspace fn with an initialize function that takes a workspace
This makes it clearer that the function is not providing necessary
dependencies to a workspace, but rather configuring it with all of
the panels and widgets which are defined in downstream crates.
2022-05-19 16:50:22 -07:00
Max Brunsfeld
ef0b584532 Remove AppState from workspace actions
This allows those actions to be bound to keystrokes in the keymap.
Also, remove the WorkspaceParams struct, simplify how Workspaces are
constructed.
2022-05-19 14:37:26 -07:00
Nathan Sobo
a3bbabaaac Add ability to get the user for an invite code in collab API
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-05-19 12:35:07 -06:00
Nathan Sobo
3d7e912c6b Enable descriptive HTTP errors to be returned from DB layer
For now, we only use this when redeeming an invite code.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-05-19 11:55:55 -06:00
Nathan Sobo
d1b7a249b4 WIP 2022-05-19 11:09:44 -06:00
Nathan Sobo
51f9b915a0 WIP 2022-05-18 16:14:58 -06:00
Nathan Sobo
37fcfeab8d WIP 2022-05-18 11:51:47 -06:00
Nathan Sobo
b3038c2de9 Return 404 from API if no user is found
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-05-18 10:32:58 -06:00
Nathan Sobo
7e2d1fefc4 Add ability to update invite count to collab API
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-05-18 10:23:08 -06:00
Nathan Sobo
cfb31067a5 Add invite codes / counts to users table
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-05-18 09:56:37 -06:00
Nathan Sobo
fb246ac343 Log JSON in Kubernetes
If you set LOG_JSON=true, we'll output JSON from the tracing subscriber instead of pretty-printing trace output.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-05-17 11:05:22 -06:00
Antonio Scandurra
225536accc Merge branch 'main' into request-to-join-project 2022-05-17 14:55:20 +02:00
Antonio Scandurra
8393bfe032 Ensure join request reaches the server before disconnecting host in test 2022-05-17 14:50:28 +02:00
Antonio Scandurra
a828282771 Fix Store::remove_connection not removing guests from projects 2022-05-17 14:50:00 +02:00
Antonio Scandurra
7b161b81b5 WIP: accept to join requests if user is already participating
There's a panic caused by `Store::check_invariants` that we still
need to figure out.
2022-05-17 13:21:20 +02:00
Nathan Sobo
d821e7a4c1 Cancel join requests when the requester closes the window 2022-05-16 20:29:36 -06:00
Antonio Scandurra
ed6ed99d8f Show the reason why a join request was declined
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-05-16 19:57:50 +02:00