Skip to content

Explorer server: Add logs when receiving ledgerClosed messages and log rippled client state every 60 seconds - #1233

Merged
pdp2121 merged 1 commit into
stagingfrom
add-rippled-client-state-and-ledger-closed-message-logs
Aug 30, 2025
Merged

pdp2121 merged 1 commit into
stagingfrom
add-rippled-client-state-and-ledger-closed-message-logs

Conversation

@kuan121

@kuan121 kuan121 commented Aug 27, 2025 •

Copy link
Copy Markdown
Contributor

High Level Overview of Change

Two changes

  1. Log a message each time a ledgerClosed message is received.
  2. Every 60 seconds, log the current state of the rippled client created via xrpl-client.

Context of Change

Although rare, we’ve observed that the Explorer server stops processing new ledger data—specifically, this log line is not printed. As a result, the metrics API endpoint begins serving stale data. The root cause is currently unclear; it could be due to a dropped WebSocket connection to the Clio host or the Clio host not sending any ledgerClosed messages. Importantly, during the incident, the Explorer backend remains up and responsive, continuing to serve API requests such as /health and /metrics (code reference).

The new logs will help us confirm the root cause if either of the above suspicions is correct, or rule them out if not.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Translation Updates
  • Release

Codebase Modernization

  • Updated files to React Hooks
  • Updated files to TypeScript
  • Updated tests to React Testing Library

Before / After

N/A

Test Plan

Manually test the changes by running npm run build && npm start and confirm that logs are printed as expected. An example of state log is

[2025-08-27T19:32:33.456Z]  INFO: rippled/12345 on MacBook:
    Rippled client: {
      state: {
        online: true,
        latencyMs: { last: 80, avg: 81.3, secAgo: 2.181999921798706 },
        server: {
          version: '',
          uptime: 1294403,
          publicKey: '',
          networkId: 0,
          uri: 'wss://s2.ripple.com:51233'
        },
        ledger: { last: 98451664, validated: '32570-98451664', count: 98419094 },
        fee: { last: 12, avg: 12, secAgo: 2.181999921798706 },
        reserve: { base: 1, owner: 0.2 },
        secLastContact: 1.8569998741149902
      }
    }

@kuan121
kuan121 requested review from Patel-Raj11 and pdp2121 August 27, 2025 19:35
@kuan121
kuan121 marked this pull request as ready for review August 27, 2025 19:36
@pdp2121
pdp2121 merged commit 3d7d358 into staging Aug 30, 2025
@pdp2121
pdp2121 deleted the add-rippled-client-state-and-ledger-closed-message-logs branch August 30, 2025 00:01
pdp2121 pushed a commit that referenced this pull request Oct 8, 2025
…g rippled client state every 60 seconds (#1233)

## High Level Overview of Change
Two changes
1. Log a message each time a ledgerClosed message is received.
2. Every 60 seconds, log the current state of the rippled client created
via [xrpl-client](https://github.com/XRPL-Labs/xrpl-client).

### Context of Change
Although rare, we’ve observed that the Explorer server stops processing
new ledger data—specifically, [this log
line](https://github.com/ripple/explorer/blob/staging/server/lib/streams.js#L119)
is not printed. As a result, the [metrics API
endpoint](https://github.com/ripple/explorer/blob/staging/server/routes/v1/index.js#L12)
begins serving stale data. The root cause is currently unclear; it could
be due to a dropped WebSocket connection to the Clio host or the Clio
host not sending any `ledgerClosed` messages. Importantly, during the
incident, the Explorer backend remains up and responsive, continuing to
serve API requests such as /health and /metrics ([code
reference](https://github.com/ripple/explorer/blob/staging/server/routes/v1/index.js#L11-L12)).

The new logs will help us confirm the root cause if either of the above
suspicions is correct, or rule them out if not.


### Type of Change

<!--
Please check relevant options, delete irrelevant ones.
-->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Refactor (non-breaking change that only restructures code)
- [ ] Tests (You added tests for code that already exists, or your new
feature included in this PR)
- [ ] Documentation Updates
- [ ] Translation Updates
- [ ] Release

### Codebase Modernization

<!--
In an effort to modernize the codebase, you should convert the files
that you work with to React Hooks and TypeScript,
and update tests to use the React Testing Library instead of Enzyme. If
this is not possible (e.g. it's too many
changes, touching too many files, etc.) please explain why here.
-->

- [ ] Updated files to React Hooks
- [ ] Updated files to TypeScript
- [ ] Updated tests to React Testing Library

## Before / After
N/A

## Test Plan
Manually test the changes by running `npm run build && npm start` and
confirm that logs are printed as expected. An example of state log is
```
[2025-08-27T19:32:33.456Z]  INFO: rippled/12345 on MacBook:
    Rippled client: {
      state: {
        online: true,
        latencyMs: { last: 80, avg: 81.3, secAgo: 2.181999921798706 },
        server: {
          version: '',
          uptime: 1294403,
          publicKey: '',
          networkId: 0,
          uri: 'wss://s2.ripple.com:51233'
        },
        ledger: { last: 98451664, validated: '32570-98451664', count: 98419094 },
        fee: { last: 12, avg: 12, secAgo: 2.181999921798706 },
        reserve: { base: 1, owner: 0.2 },
        secLastContact: 1.8569998741149902
      }
    }
```
pdp2121 pushed a commit that referenced this pull request Oct 8, 2025
…g rippled client state every 60 seconds (#1233)

## High Level Overview of Change
Two changes
1. Log a message each time a ledgerClosed message is received.
2. Every 60 seconds, log the current state of the rippled client created
via [xrpl-client](https://github.com/XRPL-Labs/xrpl-client).

### Context of Change
Although rare, we’ve observed that the Explorer server stops processing
new ledger data—specifically, [this log
line](https://github.com/ripple/explorer/blob/staging/server/lib/streams.js#L119)
is not printed. As a result, the [metrics API
endpoint](https://github.com/ripple/explorer/blob/staging/server/routes/v1/index.js#L12)
begins serving stale data. The root cause is currently unclear; it could
be due to a dropped WebSocket connection to the Clio host or the Clio
host not sending any `ledgerClosed` messages. Importantly, during the
incident, the Explorer backend remains up and responsive, continuing to
serve API requests such as /health and /metrics ([code
reference](https://github.com/ripple/explorer/blob/staging/server/routes/v1/index.js#L11-L12)).

The new logs will help us confirm the root cause if either of the above
suspicions is correct, or rule them out if not.


### Type of Change

<!--
Please check relevant options, delete irrelevant ones.
-->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Refactor (non-breaking change that only restructures code)
- [ ] Tests (You added tests for code that already exists, or your new
feature included in this PR)
- [ ] Documentation Updates
- [ ] Translation Updates
- [ ] Release

### Codebase Modernization

<!--
In an effort to modernize the codebase, you should convert the files
that you work with to React Hooks and TypeScript,
and update tests to use the React Testing Library instead of Enzyme. If
this is not possible (e.g. it's too many
changes, touching too many files, etc.) please explain why here.
-->

- [ ] Updated files to React Hooks
- [ ] Updated files to TypeScript
- [ ] Updated tests to React Testing Library

## Before / After
N/A

## Test Plan
Manually test the changes by running `npm run build && npm start` and
confirm that logs are printed as expected. An example of state log is
```
[2025-08-27T19:32:33.456Z]  INFO: rippled/12345 on MacBook:
    Rippled client: {
      state: {
        online: true,
        latencyMs: { last: 80, avg: 81.3, secAgo: 2.181999921798706 },
        server: {
          version: '',
          uptime: 1294403,
          publicKey: '',
          networkId: 0,
          uri: 'wss://s2.ripple.com:51233'
        },
        ledger: { last: 98451664, validated: '32570-98451664', count: 98419094 },
        fee: { last: 12, avg: 12, secAgo: 2.181999921798706 },
        reserve: { base: 1, owner: 0.2 },
        secLastContact: 1.8569998741149902
      }
    }
```
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