Skip to content

Feat/new prometheus metrics#586

Open
dvansari65 wants to merge 7 commits intosolana-foundation:mainfrom
dvansari65:feat/new-prometheus-metrics
Open

Feat/new prometheus metrics#586
dvansari65 wants to merge 7 commits intosolana-foundation:mainfrom
dvansari65:feat/new-prometheus-metrics

Conversation

@dvansari65
Copy link
Copy Markdown
Contributor

@dvansari65 dvansari65 commented Mar 20, 2026

Closes #584

Metrics exposed:

  • surfpool_transactions_total{status} — transaction success/failure rate
  • surfpool_transaction_processing_ms — transaction processing latency histogram
  • surfpool_rpc_requests_total{method} — RPC request rate by method
  • surfpool_rpc_latency_ms{method} — RPC request latency histogram by method
  • surfpool_remote_fetch_latency_ms — mainnet account cloning latency histogram

@MicaiahReid
Copy link
Copy Markdown
Collaborator

Hey @dvansari65, I'm a bit confused by this and seeing #552. Is this building off of #552? The idea was that 552 is laying down the groundwork, then subsequent PRs to complete #584 would just be building off that groundwork

@dvansari65
Copy link
Copy Markdown
Contributor Author

dvansari65 commented Mar 21, 2026

@MicaiahReid I accidentally closed #552 instead of updating it. i deleted simnet events for updating promethius and directly updating from svm file in this #586

@MicaiahReid MicaiahReid force-pushed the main branch 5 times, most recently from 5419677 to 2129ad9 Compare March 23, 2026 19:40
}
Ok(_) => {
let _ = surfnet_svm.simnet_events_tx.send(SimnetEvent::info(format!(
"Metrics available at http://{}/metrics",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should display http://localhost:9000/metrics or http://127.0.0.1:9000/metrics, not http://0.0.0.0:9000/metrics


#[cfg(feature = "prometheus")]
crate::telemetry::metrics()
.record_rpc_request("getAccountInfo", rpc_start.elapsed().as_secs_f64() * 1000.0);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is it possible to just do as_miliseconds to avoid the floating point math?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also is this fetch before get_account accidental/redundant? Do we just need one after?

//!
//! Feature `prometheus` enables a `/metrics` HTTP endpoint

#[cfg(feature = "prometheus")]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Rather than having #[cfg(feature = "prometheus")] a few times in this file, we should just have it once in the core/src/lib.rs file for the telemetry mod:

#[cfg(feature = "prometheus")]
pub mod telemtry;

let remote_account = client.get_account(pubkey, commitment_config).await?;
// Record how long mainnet fetch took
#[cfg(feature = "prometheus")]
crate::telemetry::metrics()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There might be other places we call client.get_account and client.get_multiple_accounts - should we instead put these in the remote.rs file in these actual fn definitions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes we can do , this is better


match self.inner.send_transaction(tx.clone()) {
Ok(res) => Ok(res),
Ok(res) => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The send_transaction RPC method is already recording transactions. Those will already be routed through this endpoint, so this is going to lead to duplicate transaction tracking. We should be good to remove the metrics calls from this file.

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.

Add more interesting prometheus metrics

2 participants