rpc/rpc_helper.rs: Ported to opentelemetry 0.18.

This commit is contained in:
Jonathan Davies 2023-01-27 16:45:52 +00:00
parent 3131052678
commit 0a3d332966

View file

@ -136,7 +136,10 @@ impl RpcHelper {
KeyValue::new("to", format!("{:?}", to)),
];
self.0.metrics.rpc_counter.add(1, &metric_tags);
self.0
.metrics
.rpc_counter
.add(&Context::current(), 1, &metric_tags);
let node_id = to.into();
let rpc_call = endpoint
@ -154,18 +157,18 @@ impl RpcHelper {
select! {
res = rpc_call => {
if res.is_err() {
self.0.metrics.rpc_netapp_error_counter.add(1, &metric_tags);
self.0.metrics.rpc_netapp_error_counter.add(&Context::current(), 1, &metric_tags);
}
let res = res?.into_msg();
if res.is_err() {
self.0.metrics.rpc_garage_error_counter.add(1, &metric_tags);
self.0.metrics.rpc_garage_error_counter.add(&Context::current(), 1, &metric_tags);
}
Ok(res?)
}
() = timeout => {
self.0.metrics.rpc_timeout_counter.add(1, &metric_tags);
self.0.metrics.rpc_timeout_counter.add(&Context::current(), 1, &metric_tags);
Err(Error::Timeout)
}
}