Skip to content

Commit 67060da

Browse files
committed
fix: manual Clone impl for TronHttpChannel to track provider instance metrics
1 parent 356c09c commit 67060da

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

rust/main/chains/hyperlane-tron/src/provider/http_client.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,27 @@ pub struct TronHttpProvider {
2929
}
3030

3131
/// A single HTTP channel used by the FallbackProvider
32-
#[derive(Clone, Debug)]
32+
#[derive(Debug)]
3333
pub struct TronHttpChannel {
3434
client: Client,
3535
base_url: Url,
3636
metrics: PrometheusClientMetrics,
3737
config: PrometheusConfig,
3838
}
3939

40+
impl Clone for TronHttpChannel {
41+
fn clone(&self) -> Self {
42+
let chain_name = PrometheusConfig::chain_name(&self.config.chain);
43+
self.metrics.increment_provider_instance(chain_name);
44+
Self {
45+
client: self.client.clone(),
46+
base_url: self.base_url.clone(),
47+
metrics: self.metrics.clone(),
48+
config: self.config.clone(),
49+
}
50+
}
51+
}
52+
4053
impl TronHttpChannel {
4154
fn new(
4255
url: &Url,

0 commit comments

Comments
 (0)