Skip to content

chore: do not record metrics for requests with insufficient cycles#184

Merged
lpahlavi merged 16 commits intomainfrom
lpahlavi/XC-416-no-metrics-with-too-few-cycles
Jul 30, 2025
Merged

chore: do not record metrics for requests with insufficient cycles#184
lpahlavi merged 16 commits intomainfrom
lpahlavi/XC-416-no-metrics-with-too-few-cycles

Conversation

@lpahlavi
Copy link
Contributor

@lpahlavi lpahlavi commented Jul 8, 2025

(XC-416) Do not record metrics for requests with too few cycles. Namely:

  • Never increment solrpc_requests or solrpc_responses metrics for requests with too few cycles.
  • Do not increment solrpc_inconsistent_responsesmetrics for requests where all requests had too few cycles, since in this case it is expected that the results are inconsistent due to the cycles cost of executing JSON-RPC requests depending on the specific providers (due e.g. to the varying target URL length and authentication methods).

@lpahlavi lpahlavi marked this pull request as ready for review July 8, 2025 12:51
@lpahlavi lpahlavi requested a review from a team as a code owner July 8, 2025 12:51
@lpahlavi lpahlavi requested a review from gregorydemay July 8, 2025 12:51
gregorydemay
gregorydemay previously approved these changes Jul 9, 2025
Copy link
Contributor

@gregorydemay gregorydemay left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @lpahlavi ! One small comment but otherwise LGTM.

@lpahlavi lpahlavi requested a review from gregorydemay July 10, 2025 08:01
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add a test covering the case when inconsistencies should be observed (I think we don't have one?). I suspect (didn't test) the current implementation does not work because inconsistent_results is an iterator and so inconsistent_results.all will stop at the first discrepancy, so that the inconsistent_results.for_each will only apply to the remaining elements.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're absolutely right, I missed that! I opted to construct an intermediate vector to get around this. I could also re-filter the results in case of inconsistent results, but I figured it's easier to follow the code as it is now and the performance cost of initializing the vector is probably pretty small for just a couple of references. WDYT?

@lpahlavi lpahlavi requested a review from gregorydemay July 29, 2025 15:06
@lpahlavi lpahlavi changed the title chore: do not record metrics for requests with too few cycles chore: do not record metrics for requests with insufficient cycles Jul 29, 2025
Copy link
Contributor

@gregorydemay gregorydemay left a comment

Choose a reason for hiding this comment

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

Thanks @lpahlavi for the improvements!

@lpahlavi lpahlavi merged commit 3cae012 into main Jul 30, 2025
17 of 18 checks passed
@lpahlavi lpahlavi deleted the lpahlavi/XC-416-no-metrics-with-too-few-cycles branch July 30, 2025 11:33
@github-actions github-actions bot mentioned this pull request Jul 31, 2025
@lpahlavi lpahlavi mentioned this pull request Jul 31, 2025
lpahlavi added a commit that referenced this pull request Jul 31, 2025
## 🤖 New release

* `sol_rpc_types`: 1.0.0 -> 2.0.0 (⚠ API breaking changes)
* `sol_rpc_canister`: 1.0.0 -> 1.1.0 (✓ API compatible changes)
* `sol_rpc_client`: 1.0.0 -> 2.0.0 (⚠ API breaking changes)

### ⚠ `sol_rpc_types` breaking changes

```text
--- failure constructible_struct_adds_field: externally-constructible struct adds field ---

Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field TransactionStatusMeta.cost_units in /tmp/.tmpuppblp/sol-rpc-canister/libs/types/src/solana/transaction/mod.rs:286
```

<details><summary><i><b>Changelog</b></i></summary><p>

## `sol_rpc_types`

<blockquote>

## [2.0.0] - 2025-07-31

### Added

- Add optional `cost_units` to `TransactionStatusMeta`
([#180](#180))
- Add build requirements to READMEs and rustdoc
([#169](#169))
- Add `Cargo.toml` linting to CI pipeline
([#155](#155))

### Changed

- Require HTTP outcall base fee
([#185](#185))
- Select supported providers based on successful responses
([#183](#183))
- Migrate dependencies to `solana-sdk` repository
([#55](#55))
- Improve docs for `InstallArgs`
([#172](#172))

[2.0.0]:
https://github.com/dfinity/sol-rpc-canister/compare/1.0.0..2.0.0
</blockquote>

## `sol_rpc_canister`

<blockquote>

## [1.1.0] - 2025-07-31

### Added

- Add optional `cost_units` to `TransactionStatusMeta` (#180)
- Add more metrics (#144)

### Changed

- Do not record metrics for requests with insufficient cycles (#184)
- Require HTTP outcall base fee (#185)
- Select supported providers based on successful responses (#183)

### Fixed

- Change `nat16` to `nat32` in examples (#151)
</blockquote>

## `sol_rpc_client`

<blockquote>

## [2.0.0] - 2025-07-31

### Added

- Add `try_send` method to SOL RPC client
([#187](#187))
- Add build requirements to READMEs and rustdoc
([#169](#169))
- Add `Cargo.toml` linting to CI pipeline
([#155](#155))

### Changed

- Revert `sol_rpc_client` bump
([#178](#178))
- Migrate dependencies to `solana-sdk` repository
([#55](#55))
- Bump `sol_rpc_client` to `v1.0.1`
([#164](#164))
- Enable `ed25519` feature in docs
([#162](#162))

### Fixed

- Use correct fee for t-sig with local development key
([#160](#160))

[2.0.0]:
https://github.com/dfinity/sol-rpc-canister/compare/1.0.0..2.0.0
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Louis Pahlavi <louis.pahlavi@dfinity.org>
@github-actions github-actions bot mentioned this pull request Aug 29, 2025
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.

2 participants