Skip to content

Commit 565a37f

Browse files
committed
fix: use lower-cardinality prometheus metrics in signer
1 parent 1a87f5b commit 565a37f

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
@@ -450,7 +450,10 @@ impl StacksClient {
450450
"last_sortition" => %last_sortition,
451451
);
452452
let path = self.tenure_forking_info_path(chosen_parent, last_sortition);
453-
let timer = crate::monitoring::new_rpc_call_timer(&path, &self.http_origin);
453+
let timer = crate::monitoring::new_rpc_call_timer(
454+
"/v3/tenures/fork_info/:start/:stop",
455+
&self.http_origin,
456+
);
454457
let send_request = || {
455458
self.stacks_node_client
456459
.get(&path)
@@ -491,7 +494,8 @@ impl StacksClient {
491494
pub fn get_sortition(&self, ch: &ConsensusHash) -> Result<SortitionInfo, ClientError> {
492495
debug!("stacks_node_client: Getting sortition with consensus hash {ch}...");
493496
let path = format!("{}/consensus/{}", self.sortition_info_path(), ch.to_hex());
494-
let timer = crate::monitoring::new_rpc_call_timer(&path, &self.http_origin);
497+
let timer_label = format!("{}/consensus/:consensus_hash", self.sortition_info_path());
498+
let timer = crate::monitoring::new_rpc_call_timer(&timer_label, &self.http_origin);
495499
let send_request = || {
496500
self.stacks_node_client.get(&path).send().map_err(|e| {
497501
warn!("Signer failed to request sortition"; "consensus_hash" => %ch, "err" => ?e);
@@ -561,7 +565,7 @@ impl StacksClient {
561565
) -> Result<Option<Vec<NakamotoSignerEntry>>, ClientError> {
562566
debug!("stacks_node_client: Getting reward set signers for reward cycle {reward_cycle}...");
563567
let timer = crate::monitoring::new_rpc_call_timer(
564-
&self.reward_set_path(reward_cycle),
568+
&format!("{}/v3/stacker_set/:reward_cycle", self.http_origin),
565569
&self.http_origin,
566570
);
567571
let send_request = || {
@@ -644,8 +648,8 @@ impl StacksClient {
644648
address: &StacksAddress,
645649
) -> Result<AccountEntryResponse, ClientError> {
646650
debug!("stacks_node_client: Getting account info...");
647-
let timer =
648-
crate::monitoring::new_rpc_call_timer(&self.accounts_path(address), &self.http_origin);
651+
let timer_label = format!("{}/v2/accounts/:stacks_address", self.http_origin);
652+
let timer = crate::monitoring::new_rpc_call_timer(&timer_label, &self.http_origin);
649653
let send_request = || {
650654
self.stacks_node_client
651655
.get(self.accounts_path(address))
@@ -797,7 +801,11 @@ impl StacksClient {
797801
let body =
798802
json!({"sender": self.stacks_address.to_string(), "arguments": args}).to_string();
799803
let path = self.read_only_path(contract_addr, contract_name, function_name);
800-
let timer = crate::monitoring::new_rpc_call_timer(&path, &self.http_origin);
804+
let timer_label = format!(
805+
"{}/v2/contracts/call-read/:principal/{contract_name}/{function_name}",
806+
self.http_origin
807+
);
808+
let timer = crate::monitoring::new_rpc_call_timer(&timer_label, &self.http_origin);
801809
let response = self
802810
.stacks_node_client
803811
.post(path)

0 commit comments

Comments
 (0)