Skip to content

feat: add rpc_method_name, type and retry_reason to degraded RPC endpoint Segment events#26187

Merged
cryptodev-2s merged 6 commits intomainfrom
add-rpc-method-name-to-degraded-events
Feb 19, 2026
Merged

feat: add rpc_method_name, type and retry_reason to degraded RPC endpoint Segment events#26187
cryptodev-2s merged 6 commits intomainfrom
add-rpc-method-name-to-degraded-events

Conversation

@cryptodev-2s
Copy link
Copy Markdown
Contributor

@cryptodev-2s cryptodev-2s commented Feb 17, 2026

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, #7988).

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/WPC-441

Manual testing steps

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

Before

After

Pre-merge author checklist

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.

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.

Written by Cursor Bugbot for commit a7aacf1. This will update automatically on new commits. Configure here.

@cryptodev-2s cryptodev-2s self-assigned this Feb 17, 2026
@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@cryptodev-2s cryptodev-2s added the team-core-platform Core Platform team label Feb 17, 2026
@cryptodev-2s cryptodev-2s requested a review from mcmire February 17, 2026 19:31
@cryptodev-2s cryptodev-2s force-pushed the add-rpc-method-name-to-degraded-events branch from 2fb9fb4 to b73455a Compare February 17, 2026 19:32
@github-actions github-actions bot added size-S and removed size-XS labels Feb 17, 2026
@socket-security
Copy link
Copy Markdown

socket-security bot commented Feb 17, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​metamask/​controller-utils@​11.18.0 ⏵ 11.19.09910077 +195 +4100
Updatednpm/​@​metamask/​json-rpc-engine@​10.2.1 ⏵ 10.2.29910010091 +2100
Addednpm/​@​metamask/​network-controller@​30.0.0100100100100100

View full report

@cryptodev-2s cryptodev-2s force-pushed the add-rpc-method-name-to-degraded-events branch 2 times, most recently from 693269a to 1ed19e7 Compare February 17, 2026 19:47
@cryptodev-2s cryptodev-2s changed the title feat: add rpcMethodName to degraded and unavailable RPC endpoint Segment events feat: add rpcMethodName to degraded and unavailable RPC endpoint Segment events Feb 17, 2026
@cryptodev-2s cryptodev-2s marked this pull request as ready for review February 17, 2026 20:24
@cryptodev-2s cryptodev-2s changed the title feat: add rpcMethodName to degraded and unavailable RPC endpoint Segment events feat: add rpcMethodName to degraded RPC endpoint Segment events Feb 18, 2026
Copy link
Copy Markdown

@cursor cursor bot left a comment

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 and found 1 potential issue.

Copy link
Copy Markdown
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good when network-controller is released.

Remember that we will need to update the segment-schema repo with the new property before we merge this: https://github.com/Consensys/segment-schema/blob/f961385ccfa021c9588d060fabe3ef3e784ad88f/libraries/events/metamask-network/rpc-service-degraded.yaml

github-merge-queue bot pushed a commit to MetaMask/core that referenced this pull request Feb 18, 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**
> Introduces a breaking type change and modifies degraded-event emission
data in the RPC service layer; low behavioral risk but could break
downstream implementors and any logic that depends on exact event
payloads.
> 
> **Overview**
> `NetworkController:rpcEndpointDegraded` and
`NetworkController:rpcEndpointChainDegraded` events now include a
`rpcMethodName` field so consumers can identify which JSON-RPC method
was executing when degradation (slow request / retry exhaustion)
occurred.
> 
> This threads the method name from `RpcService.request` through
`RpcService.onDegraded` and into `create-network-client`’s published
messenger events, updates the `RpcServiceRequestable.onDegraded`
listener type (**breaking**), and expands test coverage (including
concurrent-request and “first method triggers degraded” scenarios).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c756c02. 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/core that referenced this pull request Feb 18, 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 -->
@cryptodev-2s cryptodev-2s changed the title feat: add rpcMethodName to degraded RPC endpoint Segment events feat: add rpc_method_name, degraded_event_type and retry_reason to degraded RPC endpoint Segment events Feb 19, 2026
@cryptodev-2s cryptodev-2s requested a review from mcmire February 19, 2026 00:09
@cryptodev-2s cryptodev-2s force-pushed the add-rpc-method-name-to-degraded-events branch from ae02d91 to 2f65d10 Compare February 19, 2026 01:06
@cryptodev-2s cryptodev-2s force-pushed the add-rpc-method-name-to-degraded-events branch from f45bc2f to 89a4510 Compare February 19, 2026 20:14
@cryptodev-2s cryptodev-2s changed the title feat: add rpc_method_name, degraded_event_type and retry_reason to degraded RPC endpoint Segment events feat: add rpc_method_name, type and retry_reason to degraded RPC endpoint Segment events Feb 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeConfirmations, SmokeIdentity, SmokeNetworkAbstractions, SmokeNetworkExpansion, SmokeTrade, SmokeWalletPlatform, SmokeCard, SmokePerps, SmokeRamps, SmokeMultiChainAPI, SmokePredictions, FlaskBuildTests
  • Selected Performance tags: @PerformanceAccountList, @PerformanceOnboarding, @PerformanceLogin, @PerformanceSwaps, @PerformanceLaunch, @PerformanceAssetLoading, @PerformancePredict, @PerformancePreps
  • Risk Level: high
  • AI Confidence: 100%
click to see 🤖 AI reasoning details

E2E Test Selection:
Hard rule (controller-version-update): @MetaMask controller package version updated in package.json: @metamask/network-controller. Running all tests.

Performance Test Selection:
Hard rule (controller-version-update): @MetaMask controller package version updated in package.json: @metamask/network-controller. Running all tests.

View GitHub Actions results

Copy link
Copy Markdown
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@sonarqubecloud
Copy link
Copy Markdown

@cryptodev-2s cryptodev-2s added this pull request to the merge queue Feb 19, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 19, 2026
@cryptodev-2s cryptodev-2s added this pull request to the merge queue Feb 19, 2026
Merged via the queue into main with commit dda6324 Feb 19, 2026
193 of 196 checks passed
@cryptodev-2s cryptodev-2s deleted the add-rpc-method-name-to-degraded-events branch February 19, 2026 22:17
@github-actions github-actions bot locked and limited conversation to collaborators Feb 19, 2026
@metamaskbot metamaskbot added the release-7.67.0 Issue or pull request that will be included in release 7.67.0 label Feb 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.67.0 Issue or pull request that will be included in release 7.67.0 size-S team-core-platform Core Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants