[graphql-stream-metrics] Add per-subscriber subscription metrics [22/n] - #27756
Merged
tpham-mysten merged 1 commit intoAug 26, 2026
Conversation
tpham-mysten
temporarily deployed
to
sui-typescript-aws-kms-test-env
August 19, 2026 04:10 — with
GitHub Actions
Inactive
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
tpham-mysten
marked this pull request as ready for review
August 19, 2026 04:11
tpham-mysten
requested review from
amnn,
evan-wall-mysten,
nickvikeras and
wlmyng
August 19, 2026 04:11
tpham-mysten
temporarily deployed
to
sui-typescript-aws-kms-test-env
August 19, 2026 04:11 — with
GitHub Actions
Inactive
tpham-mysten
force-pushed
the
tpham-mysten/subscription-lifecycle-metrics
branch
from
August 19, 2026 18:41
14910a1 to
21efcf7
Compare
tpham-mysten
temporarily deployed
to
sui-typescript-aws-kms-test-env
August 19, 2026 18:41 — with
GitHub Actions
Inactive
tpham-mysten
force-pushed
the
tpham-mysten/subscription-lifecycle-metrics
branch
from
August 20, 2026 15:54
21efcf7 to
c82da0f
Compare
tpham-mysten
temporarily deployed
to
sui-typescript-aws-kms-test-env
August 20, 2026 15:54 — with
GitHub Actions
Inactive
tpham-mysten
force-pushed
the
tpham-mysten/subscription-lifecycle-metrics
branch
from
August 21, 2026 02:08
c82da0f to
b7b7e31
Compare
tpham-mysten
temporarily deployed
to
sui-typescript-aws-kms-test-env
August 21, 2026 02:08 — with
GitHub Actions
Inactive
tpham-mysten
force-pushed
the
tpham-mysten/subscription-lifecycle-metrics
branch
from
August 24, 2026 20:27
b7b7e31 to
c7edcd9
Compare
amnn
approved these changes
Aug 25, 2026
amnn
left a comment
Contributor
There was a problem hiding this comment.
Could look into removing the dependency on strum, but looks good.
8 tasks
tpham-mysten
force-pushed
the
tpham-mysten/subscription-lifecycle-metrics
branch
from
August 26, 2026 16:34
c7edcd9 to
b1d7850
Compare
tpham-mysten
commented
Aug 26, 2026
tpham-mysten
left a comment
Contributor
Author
There was a problem hiding this comment.
Thanks @amnn! I have dropped strum and moved SubscriptionMetrics into the broadcast.
tpham-mysten
temporarily deployed
to
sui-typescript-aws-kms-test-env
August 26, 2026 16:47 — with
GitHub Actions
Inactive
tpham-mysten
force-pushed
the
tpham-mysten/subscription-lifecycle-metrics
branch
from
August 26, 2026 18:44
b1d7850 to
88695e2
Compare
tpham-mysten
temporarily deployed
to
sui-typescript-aws-kms-test-env
August 26, 2026 18:44 — with
GitHub Actions
Inactive
tpham-mysten
force-pushed
the
tpham-mysten/subscription-lifecycle-metrics
branch
from
August 26, 2026 18:46
88695e2 to
e26da3b
Compare
tpham-mysten
temporarily deployed
to
sui-typescript-aws-kms-test-env
August 26, 2026 18:46 — with
GitHub Actions
Inactive
tpham-mysten
added a commit
that referenced
this pull request
Aug 26, 2026
…_subscribers limit [23/n] (#27787) ## Description Subscriptions currently open without any aggregate limit, so a burst of subscribers can drive server CPU and memory unbounded. This adds a configurable `max_subscribers` (default 1024): each subscription claims a slot from a shared semaphore held for its lifetime by the lifecycle guard, and a subscription opened while all slots are taken is refused with a `resource_exhausted` error so the client can retry later. Refusals are counted by `graphql_subscription_rejected{type, reason}`. Guard creation moves out of the driver `stream!` bodies up to the resolver, so admission happens once at connect time before any work begins. ## Test plan New `rejects_at_capacity` unit test covers admission, the at-capacity refusal and its metric, and slot release on drop. Existing subscription lib tests cover the guard threaded through the drivers. ## Stack - #26019 - #26094 - #26117 - #26170 - #26194 - #26202 - #26414 - #26453 - #26476 - #26487 - #26425 - #26495 - #26731 - #26714 - #27140 - #27537 - #27564 - #27580 - #27635 - #27709 - #27669 - #27756 - #27787 ## Release notes Check each box that your change affects. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API:
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Builds on the upstream-stream metrics from #27669 (1/n) with the per-subscriber view. A
SubscriptionLifecycleGuard(RAII, held for the lifetime of each subscription stream) records, by subscription type, how many are active, how many opened, how long they live, and how and why they end. It also records per-payload delivery: a delivered counter and a server-side delivery-lag histogram, observed once per payload in the live loop after each yield (so the lag reflects that payload's own throttle pacing).Metrics added, all labelled by subscription type:
graphql_subscription_active_subscriptions(gauge)graphql_subscription_opened(counter)graphql_subscription_terminations(counter, by reason)graphql_subscription_duration_seconds(histogram)graphql_subscription_payloads_delivered(counter)graphql_subscription_payload_delivery_checkpoint_timestamp_lag(histogram)Test plan
Unit tests for the guard: the active gauge and opened counter on construction, and on drop the gauge decrement, a duration sample, and a
client_closedtermination when no reason was set; a set reason overriding that default; and per-payload delivery counting plus one lag observation per call.Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.