From 80af819636860632c6a651d067b3d4850401e6b3 Mon Sep 17 00:00:00 2001 From: Boyu Yang Date: Tue, 8 Sep 2020 12:11:53 +0800 Subject: [PATCH] chore: replace several dependencies of sentry by sentry-core and sentry-log --- Cargo.lock | 8 ++++---- network/Cargo.toml | 2 +- network/src/network.rs | 4 ++-- sync/Cargo.toml | 2 +- sync/src/relayer/mod.rs | 2 +- sync/src/relayer/transactions_process.rs | 2 +- sync/src/synchronizer/mod.rs | 2 +- util/logger-service/Cargo.toml | 3 ++- util/logger-service/src/lib.rs | 3 ++- 9 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index efdcb6af46..e483b0ae4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -675,7 +675,8 @@ dependencies = [ "log 0.4.11", "once_cell", "regex", - "sentry", + "sentry-core", + "sentry-log", ] [[package]] @@ -777,7 +778,7 @@ dependencies = [ "rand 0.6.5", "resolve", "secp256k1", - "sentry", + "sentry-core", "serde", "serde_json", "snap", @@ -1080,7 +1081,7 @@ dependencies = [ "lru-cache", "rand 0.6.5", "ratelimit_meter", - "sentry", + "sentry-core", "tempfile", ] @@ -4194,7 +4195,6 @@ dependencies = [ "sentry-contexts", "sentry-core", "sentry-failure", - "sentry-log", "sentry-panic", ] diff --git a/network/Cargo.toml b/network/Cargo.toml index 4bbac8dd25..9c18ae20a1 100644 --- a/network/Cargo.toml +++ b/network/Cargo.toml @@ -19,7 +19,7 @@ p2p = { version="0.3.0", package="tentacle", features = ["molc"] } faketime = "0.2.0" lazy_static = "1.3.0" bs58 = "0.3.0" -sentry = "0.19.1" +sentry-core = "0.19.1" faster-hex = "0.4" ckb-hash = {path = "../util/hash"} secp256k1 = {version = "0.17", features = ["recovery"] } diff --git a/network/src/network.rs b/network/src/network.rs index b9d5a8a99a..3017e3428c 100644 --- a/network/src/network.rs +++ b/network/src/network.rs @@ -375,7 +375,7 @@ impl NetworkState { addr ); if dial_started.elapsed() > DIAL_HANG_TIMEOUT { - use sentry::{capture_message, with_scope, Level}; + use sentry_core::{capture_message, with_scope, Level}; with_scope( |scope| scope.set_fingerprint(Some(&["ckb-network", "dialing-timeout"])), || { @@ -640,7 +640,7 @@ impl ServiceHandle for EventHandler { } ServiceError::ProtocolHandleError { proto_id, error } => { debug!("ProtocolHandleError: {:?}, proto_id: {}", error, proto_id); - use sentry::{capture_message, with_scope, Level}; + use sentry_core::{capture_message, with_scope, Level}; with_scope( |scope| scope.set_fingerprint(Some(&["ckb-network", "p2p-service-error"])), || { diff --git a/sync/Cargo.toml b/sync/Cargo.toml index 8a83ca1d1a..ae4c9bfe06 100644 --- a/sync/Cargo.toml +++ b/sync/Cargo.toml @@ -24,7 +24,7 @@ ckb-channel = { path = "../util/channel" } ckb-traits = { path = "../traits" } failure = "0.1.5" lru-cache = { git = "https://github.com/nervosnetwork/lru-cache", rev = "a35fdb8" } -sentry = "0.19.1" +sentry-core = "0.19.1" futures = "0.3" ckb-error = {path = "../error"} ckb-tx-pool = { path = "../tx-pool" } diff --git a/sync/src/relayer/mod.rs b/sync/src/relayer/mod.rs index ffc9c6c973..11f7f0e904 100644 --- a/sync/src/relayer/mod.rs +++ b/sync/src/relayer/mod.rs @@ -664,7 +664,7 @@ impl CKBProtocolHandler for Relayer { msg.item_name(), peer_index ); - let sentry_hub = sentry::Hub::current(); + let sentry_hub = sentry_core::Hub::current(); let _scope_guard = sentry_hub.push_scope(); sentry_hub.configure_scope(|scope| { scope.set_tag("p2p.protocol", "relayer"); diff --git a/sync/src/relayer/transactions_process.rs b/sync/src/relayer/transactions_process.rs index aae6dc1655..e1529978dc 100644 --- a/sync/src/relayer/transactions_process.rs +++ b/sync/src/relayer/transactions_process.rs @@ -11,7 +11,7 @@ use ckb_types::{ use ckb_util::LinkedHashSet; use ckb_verification::cache::CacheEntry; use ckb_verification::TransactionError; -use sentry::{capture_message, with_scope, Level}; +use sentry_core::{capture_message, with_scope, Level}; use std::sync::Arc; use std::time::Duration; diff --git a/sync/src/synchronizer/mod.rs b/sync/src/synchronizer/mod.rs index e5d305f9fe..c201d7a883 100644 --- a/sync/src/synchronizer/mod.rs +++ b/sync/src/synchronizer/mod.rs @@ -557,7 +557,7 @@ impl CKBProtocolHandler for Synchronizer { }; debug!("received msg {} from {}", msg.item_name(), peer_index); - let sentry_hub = sentry::Hub::current(); + let sentry_hub = sentry_core::Hub::current(); let _scope_guard = sentry_hub.push_scope(); sentry_hub.configure_scope(|scope| { scope.set_tag("p2p.protocol", "synchronizer"); diff --git a/util/logger-service/Cargo.toml b/util/logger-service/Cargo.toml index 53413a7ffb..2cec3de352 100644 --- a/util/logger-service/Cargo.toml +++ b/util/logger-service/Cargo.toml @@ -16,4 +16,5 @@ once_cell = "1.3.1" regex = "1.1.6" chrono = "0.4" backtrace = "0.3" -sentry = { version = "0.19.1", features = ["log"] } +sentry-core = "0.19.1" +sentry-log = "0.19.1" diff --git a/util/logger-service/src/lib.rs b/util/logger-service/src/lib.rs index 664de887e8..633fe3c216 100644 --- a/util/logger-service/src/lib.rs +++ b/util/logger-service/src/lib.rs @@ -406,7 +406,8 @@ impl Log for Logger { .collect::>(); if is_match || !extras.is_empty() { if self.emit_sentry_breadcrumbs { - use sentry::{add_breadcrumb, integrations::log::breadcrumb_from_record}; + use sentry_core::add_breadcrumb; + use sentry_log::breadcrumb_from_record; add_breadcrumb(|| breadcrumb_from_record(record)); }