Skip to content

Commit f8907be

Browse files
authored
Merge pull request #5196 from stacks-network/fix/signer-prom-cardinality
fix: use lower-cardinality prometheus metrics in signer
2 parents ddd3001 + dc454e1 commit f8907be

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

stacks-signer/src/client/stacks_client.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,10 @@ impl StacksClient {
464464
"last_sortition" => %last_sortition,
465465
);
466466
let path = self.tenure_forking_info_path(chosen_parent, last_sortition);
467-
let timer = crate::monitoring::new_rpc_call_timer(&path, &self.http_origin);
467+
let timer = crate::monitoring::new_rpc_call_timer(
468+
"/v3/tenures/fork_info/:start/:stop",
469+
&self.http_origin,
470+
);
468471
let send_request = || {
469472
self.stacks_node_client
470473
.get(&path)
@@ -505,7 +508,8 @@ impl StacksClient {
505508
pub fn get_sortition(&self, ch: &ConsensusHash) -> Result<SortitionInfo, ClientError> {
506509
debug!("stacks_node_client: Getting sortition with consensus hash {ch}...");
507510
let path = format!("{}/consensus/{}", self.sortition_info_path(), ch.to_hex());
508-
let timer = crate::monitoring::new_rpc_call_timer(&path, &self.http_origin);
511+
let timer_label = format!("{}/consensus/:consensus_hash", self.sortition_info_path());
512+
let timer = crate::monitoring::new_rpc_call_timer(&timer_label, &self.http_origin);
509513
let send_request = || {
510514
self.stacks_node_client.get(&path).send().map_err(|e| {
511515
warn!("Signer failed to request sortition"; "consensus_hash" => %ch, "err" => ?e);
@@ -575,7 +579,7 @@ impl StacksClient {
575579
) -> Result<Option<Vec<NakamotoSignerEntry>>, ClientError> {
576580
debug!("stacks_node_client: Getting reward set signers for reward cycle {reward_cycle}...");
577581
let timer = crate::monitoring::new_rpc_call_timer(
578-
&self.reward_set_path(reward_cycle),
582+
&format!("{}/v3/stacker_set/:reward_cycle", self.http_origin),
579583
&self.http_origin,
580584
);
581585
let send_request = || {
@@ -658,8 +662,8 @@ impl StacksClient {
658662
address: &StacksAddress,
659663
) -> Result<AccountEntryResponse, ClientError> {
660664
debug!("stacks_node_client: Getting account info...");
661-
let timer =
662-
crate::monitoring::new_rpc_call_timer(&self.accounts_path(address), &self.http_origin);
665+
let timer_label = format!("{}/v2/accounts/:principal", self.http_origin);
666+
let timer = crate::monitoring::new_rpc_call_timer(&timer_label, &self.http_origin);
663667
let send_request = || {
664668
self.stacks_node_client
665669
.get(self.accounts_path(address))
@@ -811,7 +815,11 @@ impl StacksClient {
811815
let body =
812816
json!({"sender": self.stacks_address.to_string(), "arguments": args}).to_string();
813817
let path = self.read_only_path(contract_addr, contract_name, function_name);
814-
let timer = crate::monitoring::new_rpc_call_timer(&path, &self.http_origin);
818+
let timer_label = format!(
819+
"{}/v2/contracts/call-read/:principal/{contract_name}/{function_name}",
820+
self.http_origin
821+
);
822+
let timer = crate::monitoring::new_rpc_call_timer(&timer_label, &self.http_origin);
815823
let response = self
816824
.stacks_node_client
817825
.post(path)

0 commit comments

Comments
 (0)