Skip to content

[Neki] Support reading live router connections in CLI - #1473

Merged
eileencodes merged 1 commit into
mainfrom
neki-live-connections
Oct 20, 2026
Merged

eileencodes merged 1 commit into
mainfrom
neki-live-connections

Conversation

@eileencodes

Copy link
Copy Markdown
Contributor

Adds CLI support for read-only router connections for Neki. Killing connections are not yet supported, nor are backend postgres connections.

This functionality is currently behind a feature flag and may not yet be available on your Neki database. Example error if this is the case:

Error: live connections are not enabled for branch <branch> in database
<database> (organization: <org-name>)

Usage examples:

$ pscale branch connections show <database> <branch>

captured_at: 2026-10-19T19:02:05Z
*************************** 1. row ***************************
pid:             53
router:          default
zone:            us-east-1a
state:           idle
duration:        1m22.022s
user:            <redacted>
database:        postgres
application:     psql
client_addr:     <redacted>
backend_start:   2026-10-19T18:56:33Z
shard_backends:  0
query:
<redacted>

If there are no queries running on a shard backend, the connections will return shard_backends: 0, otherwise it will return information about the shard backend, including the query running.

$ pscale branch connections show <database> <branch>

captured_at: 2026-10-19T19:07:47Z
*************************** 1. row ***************************
pid:             35
router:          default
zone:            us-east-1b
state:           active
duration:        6.811s
user:            <redacted>
database:        postgres
application:     psql
client_addr:     <redacted>
backend_start:   2026-10-19T19:07:38Z
shard_backends:  1
shard:           global
shard_uid:       <redacted>
sidecar:         <redacted>
backend_pid:     328942
xact_start:      2026-10-19T19:07:41Z
query_start:     2026-10-19T19:07:41Z
backend_query:   <redated>
query:
<redacted>

@eileencodes
eileencodes requested a review from a team as a code owner October 19, 2026 19:57

@cursor cursor Bot left a comment

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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 81fa62b. Configure here.

Comment thread internal/connections/connection_list.go
@eileencodes
eileencodes force-pushed the neki-live-connections branch from 81fa62b to 2654e8f Compare October 19, 2026 20:08
Adds CLI support for read-only router connections for Neki. Killing
connections are not yet supported, nor are backend postgres connections.

This functionality is currently behind a feature flag and may not yet be
available on your Neki database. Example error if this is the case:

```
Error: live connections are not enabled for branch <branch> in database
<database> (organization: <org-name>)
```

Usage examples:

```
$ pscale branch connections show <database> <branch>

captured_at: 2026-10-19T19:02:05Z
*************************** 1. row ***************************
pid:             53
router:          default
zone:            us-east-1a
state:           idle
duration:        1m22.022s
user:            <redacted>
database:        postgres
application:     psql
client_addr:     <redacted>
backend_start:   2026-10-19T18:56:33Z
shard_backends:  0
query:
<redacted>
```

If there are no queries running on a shard backend, the connections will
return `shard_backends: 0`, otherwise it will return information about
the shard backend, including the query running.

```
$ pscale branch connections show <database> <branch>

captured_at: 2026-10-19T19:07:47Z
*************************** 1. row ***************************
pid:             35
router:          default
zone:            us-east-1b
state:           active
duration:        6.811s
user:            <redacted>
database:        postgres
application:     psql
client_addr:     <redacted>
backend_start:   2026-10-19T19:07:38Z
shard_backends:  1
shard:           global
shard_uid:       <redacted>
sidecar:         <redacted>
backend_pid:     328942
xact_start:      2026-10-19T19:07:41Z
query_start:     2026-10-19T19:07:41Z
backend_query:   <redated>
query:
<redacted>
```
@eileencodes
eileencodes force-pushed the neki-live-connections branch from 2654e8f to c32ef65 Compare October 19, 2026 20:11
@eileencodes
eileencodes merged commit f54c048 into main Oct 20, 2026
4 checks passed
@eileencodes
eileencodes deleted the neki-live-connections branch October 20, 2026 13:08
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