Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): bump metrics from 0.21.1 to 0.22.0 #629

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tonlibjson-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ derive-new = "0.6.0"
tokio-retry = "0.3"
bytes = "1.5"
crc = "3.0.1"
metrics = "0.21.1"
metrics = "0.22.0"

[dev-dependencies]
tracing-test = { workspace = true }
Expand Down
19 changes: 9 additions & 10 deletions tonlibjson-client/src/cursor_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use tower::load::peak_ewma::Cost;
use tower::load::PeakEwma;
use tower::load::Load;
use tracing::{instrument, trace};
use metrics::{absolute_counter, describe_counter, describe_gauge, gauge};
use quick_cache::sync::Cache;
use crate::router::BlockCriteria;
use crate::block::{BlocksGetMasterchainInfo, BlocksGetShards, BlocksHeader, BlocksMasterchainInfo, BlocksShards, Sync, TonBlockId, TonBlockIdExt};
Expand Down Expand Up @@ -280,11 +279,11 @@ impl CursorClient {
}

pub(crate) fn new(id: String, client: ConcurrencyLimit<SharedService<PeakEwma<Client>>>) -> Self {
describe_counter!("ton_liteserver_last_seqno", "The seqno of the latest block that is available for the liteserver to sync");
describe_counter!("ton_liteserver_synced_seqno", "The seqno of the last block with which the liteserver is actually synchronized");
describe_counter!("ton_liteserver_first_seqno", "The seqno of the first block that is available for the liteserver to request");
describe_gauge!("ton_liteserver_requests_total", "Total count of requests");
describe_gauge!("ton_liteserver_requests", "Number of concurrent requests");
metrics::describe_counter!("ton_liteserver_last_seqno", "The seqno of the latest block that is available for the liteserver to sync");
metrics::describe_counter!("ton_liteserver_synced_seqno", "The seqno of the last block with which the liteserver is actually synchronized");
metrics::describe_counter!("ton_liteserver_first_seqno", "The seqno of the first block that is available for the liteserver to request");
metrics::describe_gauge!("ton_liteserver_requests_total", "Total count of requests");
metrics::describe_gauge!("ton_liteserver_requests", "Number of concurrent requests");

let id = Cow::from(id);
let client = ConcurrencyMetric::new(client, id.clone());
Expand Down Expand Up @@ -603,7 +602,7 @@ impl FirstBlockDiscover {
let cur = self.current.as_ref().map(|n| n.id.seqno + 32);
let (mfb, wfb) = find_first_blocks(&mut self.client, &start, lhs, cur).await?;

absolute_counter!("ton_liteserver_first_seqno", mfb.id.seqno as u64, "liteserver_id" => self.id.clone());
metrics::counter!("ton_liteserver_first_seqno", "liteserver_id" => self.id.clone()).absolute(mfb.id.seqno as u64);

self.registry.upsert_left(&mfb);
for header in &wfb {
Expand Down Expand Up @@ -631,7 +630,7 @@ impl LastBlockDiscover {
loop {
timer.tick().await;

gauge!("ton_liteserver_requests", self.client.load() as f64, "liteserver_id" => self.id.clone());
metrics::gauge!("ton_liteserver_requests", "liteserver_id" => self.id.clone()).set(self.client.load() as f64);

match self.next().await {
Ok(Some(masterchain_info)) => { current.replace(masterchain_info); },
Expand All @@ -648,10 +647,10 @@ impl LastBlockDiscover {
}
}

absolute_counter!("ton_liteserver_last_seqno", masterchain_info.last.seqno as u64, "liteserver_id" => self.id.clone());
metrics::counter!("ton_liteserver_last_seqno", "liteserver_id" => self.id.clone()).absolute(masterchain_info.last.seqno as u64);

let (master_header, last_work_chain_header) = fetch_last_headers(&mut self.client).await?;
absolute_counter!("ton_liteserver_synced_seqno", master_header.id.seqno as u64, "liteserver_id" => self.id.clone());
metrics::counter!("ton_liteserver_synced_seqno", "liteserver_id" => self.id.clone()).absolute(master_header.id.seqno as u64);

self.registry.upsert_right(&master_header);
for header in &last_work_chain_header {
Expand Down
3 changes: 1 addition & 2 deletions tonlibjson-client/src/metric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::future::Future;
use std::pin::Pin;
use std::sync::Arc;
use std::task::{Context, Poll};
use metrics::counter;
use tower::Service;
use pin_project::{pin_project, pinned_drop};
use tower::load::Load;
Expand Down Expand Up @@ -75,7 +74,7 @@ impl<S, Request> Service<Request> for ConcurrencyMetric<S>
fn call(&mut self, req: Request) -> Self::Future {
let req_type = std::any::type_name::<Request>();

counter!("ton_liteserver_requests_total", 1, "liteserver_id" => self.liteserver_id.clone(), r"request_type" => req_type);
metrics::counter!("ton_liteserver_requests_total", "liteserver_id" => self.liteserver_id.clone(), r"request_type" => req_type).increment(1);

let future = self.inner.call(req);

Expand Down
4 changes: 2 additions & 2 deletions tonlibjson-client/src/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl<T: Clone, Res, E> Policy<T, Res, E> for RetryPolicy {

match self.budget.withdraw() {
Ok(_) => {
metrics::increment_counter!("ton_retry_budget_withdraw_success", "request_type" => request_type);
metrics::counter!("ton_retry_budget_withdraw_success", "request_type" => request_type).increment(1);

Some({
let mut pol = self.clone();
Expand All @@ -77,7 +77,7 @@ impl<T: Clone, Res, E> Policy<T, Res, E> for RetryPolicy {
}.boxed()
}) },
Err(_) => {
metrics::increment_counter!("ton_retry_budget_withdraw_fail", "request_type" => request_type);
metrics::counter!("ton_retry_budget_withdraw_fail", "request_type" => request_type).increment(1);

None
}
Expand Down
8 changes: 4 additions & 4 deletions tonlibjson-client/src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ impl Service<&Route> for Router {
return std::future::ready(Ok(services)).boxed();
}

metrics::increment_counter!("ton_router_miss_count");
metrics::counter!("ton_router_miss_count").increment(1);

if let Route::Block { chain, criteria } = req {
let distance = self.distance_to(chain, criteria);
if distance.is_some_and(|d| d <= 1) {
metrics::increment_counter!("ton_router_delayed_count");
metrics::counter!("ton_router_delayed_count").increment(1);

let req = *req;
let svcs = self.services.clone();
Expand All @@ -116,7 +116,7 @@ impl Service<&Route> for Router {

let services = req.choose(&svcs);
if !services.is_empty() {
metrics::increment_counter!("ton_router_delayed_hit_count");
metrics::counter!("ton_router_delayed_hit_count").increment(1);

return Ok(services)
}
Expand All @@ -125,7 +125,7 @@ impl Service<&Route> for Router {
} else {
let services = Route::Latest.choose(&self.services);
if !services.is_empty() {
metrics::increment_counter!("ton_router_fallback_hit_count");
metrics::counter!("ton_router_fallback_hit_count").increment(1);
return std::future::ready(Ok(services)).boxed();
}
}
Expand Down
Loading