feat: add rpcMethodName to degraded events#7954
Merged
cryptodev-2s merged 9 commits intomainfrom Feb 18, 2026
Merged
Conversation
b71652f to
b548d8d
Compare
rpcMethodName to degraded and unavailable events
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
c5e4118 to
c7b7522
Compare
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
mcmire
reviewed
Feb 17, 2026
packages/network-controller/src/rpc-service/rpc-service.test.ts
Outdated
Show resolved
Hide resolved
packages/network-controller/src/rpc-service/rpc-service-chain.ts
Outdated
Show resolved
Hide resolved
e1aae33 to
454981e
Compare
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
rpcMethodName to degraded and unavailable eventsrpcMethodName to degraded events
mcmire
reviewed
Feb 18, 2026
packages/network-controller/src/rpc-service/rpc-service.test.ts
Outdated
Show resolved
Hide resolved
c756c02 to
4f6e17a
Compare
4 tasks
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 19, 2026
## Explanation Degraded events fire when an RPC endpoint is slow or its retries are exhausted, but we can't distinguish between these two cases in Segment analytics. This adds two new fields to degraded events: - **`type`** (`'slow_success' | 'retries_exhausted'`) — why degradation happened - **`retryReason`** (`'connection_failed' | 'response_not_json' | 'non_successful_http_status' | 'timed_out' | 'connection_reset' | undefined`) — when retries are exhausted, what kind of error was retried ## References - Follows up on #7954 (`rpcMethodName` on degraded events) ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [x] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes expand event payload contracts and error classification used in network reliability telemetry; risk is mainly to downstream consumers expecting the old event shape and to misclassification affecting analytics, not core request behavior. > > **Overview** > Degraded RPC events (`NetworkController:rpcEndpointDegraded` and `NetworkController:rpcEndpointChainDegraded`) now include a `type` (`'slow_success'` vs `'retries_exhausted'`) and an optional `retryReason` that classifies the final retried error when retries are exhausted. > > This introduces `DegradedEventType`/`RetryReason` plus a new `classifyRetryReason` helper, refactors retryable-error checks in `rpc-service.ts` into exported predicates, updates event publishing to populate the new fields, and expands the test suite to validate the new payloads and classification logic (with changelog updates). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit f75d349. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
github-merge-queue bot
pushed a commit
to MetaMask/metamask-extension
that referenced
this pull request
Feb 19, 2026
…RPC endpoint Segment events (#40176) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Add `rpc_method_name`, `type` and `retry_reason` to the `RPC Service Degraded` Segment events. This lets us identify which JSON-RPC methods produce the most slow requests or retry exhaustions, enabling better debugging of RPC endpoint health issues. Consumes the new `rpcMethodName`, `type` and `retryReason` field added to `NetworkController:rpcEndpointDegraded` events in `@metamask/network-controller` (core PR [#7954](MetaMask/core#7954), [#7988](MetaMask/core#7988)). <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [](https://codespaces.new/MetaMask/metamask-extension/pull/40176?quickstart=1) ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/WPC-441 ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Primarily telemetry/schema changes, but the `@metamask/network-controller` major-version bump plus LavaMoat policy updates could affect runtime behavior or bundling if any dependency allowances are incorrect. > > **Overview** > `NetworkController:rpcEndpointDegraded` handling is updated to consume new event fields and emit richer `RPC Service Degraded` Segment properties: `rpc_method_name`, degradation `type` (e.g. slow success vs retries exhausted), and optional `retry_reason`. > > This bumps `@metamask/network-controller` to `^30.0.0` (with related lockfile updates) and updates LavaMoat policies to reflect the new dependency graph/package nesting; tests are adjusted to assert the new telemetry properties. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 1861770. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
github-merge-queue bot
pushed a commit
to MetaMask/metamask-extension
that referenced
this pull request
Feb 19, 2026
…RPC endpoint Segment events (#40176) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Add `rpc_method_name`, `type` and `retry_reason` to the `RPC Service Degraded` Segment events. This lets us identify which JSON-RPC methods produce the most slow requests or retry exhaustions, enabling better debugging of RPC endpoint health issues. Consumes the new `rpcMethodName`, `type` and `retryReason` field added to `NetworkController:rpcEndpointDegraded` events in `@metamask/network-controller` (core PR [#7954](MetaMask/core#7954), [#7988](MetaMask/core#7988)). <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [](https://codespaces.new/MetaMask/metamask-extension/pull/40176?quickstart=1) ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/WPC-441 ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Primarily telemetry/schema changes, but the `@metamask/network-controller` major-version bump plus LavaMoat policy updates could affect runtime behavior or bundling if any dependency allowances are incorrect. > > **Overview** > `NetworkController:rpcEndpointDegraded` handling is updated to consume new event fields and emit richer `RPC Service Degraded` Segment properties: `rpc_method_name`, degradation `type` (e.g. slow success vs retries exhausted), and optional `retry_reason`. > > This bumps `@metamask/network-controller` to `^30.0.0` (with related lockfile updates) and updates LavaMoat policies to reflect the new dependency graph/package nesting; tests are adjusted to assert the new telemetry properties. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 1861770. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
github-merge-queue bot
pushed a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Feb 19, 2026
…RPC endpoint Segment events (#26187) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Add `rpc_method_name`, `type` and `retry_reason` to the `RPC Service Degraded` Segment events. This lets us identify which JSON-RPC methods produce the most slow requests or retry exhaustions, enabling better debugging of RPC endpoint health issues. Consumes the new `rpcMethodName`, `type` and `retryReason` field added to `NetworkController:rpcEndpointDegraded` events in `@metamask/network-controller` (core PR [#7954](MetaMask/core#7954), [#7988](MetaMask/core#7988)). <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/WPC-441 ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I've included tests if applicable - [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: changes are limited to analytics payload enrichment and dependency upgrades, with updated unit tests to validate new properties. > > **Overview** > **Enhances `RPC Service Degraded` Segment telemetry** by propagating new fields from `NetworkController:rpcEndpointDegraded` into analytics events: `rpc_method_name`, degraded `type`, and (when applicable) `retry_reason`. > > Updates `onRpcEndpointDegraded`/`trackRpcEndpointEvent` to accept these typed inputs (from `@metamask/network-controller`) and conditionally include them in tracked properties, with corresponding unit test updates. Also bumps `@metamask/network-controller` to `^30.0.0` (and lockfile deps) to consume the new event payload. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit a7aacf1. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
khanti42
pushed a commit
that referenced
this pull request
Feb 20, 2026
## Explanation RPC endpoint degraded events (`NetworkController:rpcEndpointDegraded` and it's chain-level variant) now include `rpcMethodName` in their payloads. This identifies which JSON-RPC method was being executed when the endpoint became degraded, enabling better debugging of RPC health issues. The method name is captured in `RpcService` via `#currentRpcMethodName`, set in the `finally` block of the Cockatiel policy's `execute` callback to minimise the race window between the write and Cockatiel's synchronous event dispatch. ## References Fixes: https://consensyssoftware.atlassian.net/browse/WPC-441 * Extension consumer PR: MetaMask/metamask-extension#40176 * Mobile consumer PR: MetaMask/metamask-mobile#26187 <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Moderate risk because it changes a public TypeScript listener signature (breaking) and adjusts degraded-event emission timing to handle concurrency; runtime behavior should otherwise be unchanged. > > **Overview** > Adds `rpcMethodName` to degraded telemetry: `NetworkController:rpcEndpointDegraded` and `NetworkController:rpcEndpointChainDegraded` payloads now include the JSON-RPC method that was executing when degradation was detected. > > This is implemented by having `RpcService` track the last-completed request’s method and attach it to `onDegraded` emissions, with `create-network-client` forwarding it through to messenger events; types and tests are updated accordingly, and the `RpcServiceRequestable.onDegraded` listener signature is **breaking** due to the new required field. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 4f6e17a. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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.
Explanation
RPC endpoint degraded events (
NetworkController:rpcEndpointDegradedand it's chain-level variant) now includerpcMethodNamein their payloads. This identifies which JSON-RPC method was being executed when the endpoint became degraded, enabling better debugging of RPC health issues.The method name is captured in
RpcServicevia#currentRpcMethodName, set in thefinallyblock of the Cockatiel policy'sexecutecallback to minimise the race window between the write and Cockatiel's synchronous event dispatch.References
Fixes: https://consensyssoftware.atlassian.net/browse/WPC-441
rpc_method_name,typeandretry_reasontodegradedRPC endpoint Segment events metamask-extension#40176rpc_method_name,typeandretry_reasontodegradedRPC endpoint Segment events metamask-mobile#26187Checklist
Note
Medium Risk
Adds a breaking TypeScript signature change and modifies how degraded events are populated, which could impact downstream consumers and event-based monitoring/alerting behavior.
Overview
NetworkController:rpcEndpointDegradedandNetworkController:rpcEndpointChainDegradedevents now include a newrpcMethodNamefield so consumers can see which JSON-RPC method was in-flight when a slow request or retry exhaustion triggered degradation.This is wired through
RpcService/RpcServiceChainby tracking the last completed request’s method name (to reduce concurrency races) and updating theRpcServiceRequestable.onDegradedlistener type accordingly, with extensive test updates/additions and a changelog entry calling out the breaking type change.Written by Cursor Bugbot for commit 4f6e17a. This will update automatically on new commits. Configure here.