diff --git a/Cargo.lock b/Cargo.lock index 4b40b3b..62f45e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -45,7 +45,7 @@ dependencies = [ [[package]] name = "alpaca-data-relay" -version = "1.0.0" +version = "1.0.1" dependencies = [ "alpaca", "anyhow", @@ -55,6 +55,7 @@ dependencies = [ "kafka-settings", "rdkafka", "sentry", + "sentry-anyhow", "serde 1.0.125", "serde_json", "tokio 1.5.0", @@ -273,28 +274,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "failure" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", - "failure_derive", -] - -[[package]] -name = "failure_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - [[package]] name = "fnv" version = "1.0.7" @@ -571,9 +550,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.3.6" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc35c995b9d93ec174cf9a27d425c7892722101e14993cd227fdb51d70cf9589" +checksum = "4a1ce40d6fc9764887c2fdc7305c3dcc429ba11ff981c1509416afd5697e4437" [[package]] name = "httpdate" @@ -657,9 +636,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89829a5d69c23d348314a7ac337fe39173b61149a9864deabd260983aed48c21" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" dependencies = [ "matches", "unicode-bidi", @@ -668,9 +647,9 @@ dependencies = [ [[package]] name = "im" -version = "14.3.0" +version = "15.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "696059c87b83c5a258817ecd67c3af915e3ed141891fc35a1e79908801cf0ce7" +checksum = "111c1983f3c5bb72732df25cddacee9b546d08325fb584b5ebd38148be7b0246" dependencies = [ "bitmaps", "rand_core 0.5.1", @@ -1084,18 +1063,18 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pin-project" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc174859768806e91ae575187ada95c91a29e96a98dc5d2cd9a1fed039501ba6" +checksum = "c7509cc106041c40a4518d2af7a61530e1eed0e6285296a3d8c5472806ccc4a4" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a490329918e856ed1b083f244e3bfe2d8c4f336407e4ea9e1a9f479ff09049e5" +checksum = "48c950132583b500556b1efd71d45b319029f2b71518d979fcc208e16b42426f" dependencies = [ "proc-macro2", "quote", @@ -1484,24 +1463,33 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sentry" -version = "0.19.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd0927ec4a785fc4328abe9089afbe074b3874983b3373fc328a73a9f8310cb" +checksum = "933beb0343c84eefd69a368318e9291b179e09e51982d49c65d7b362b0e9466f" dependencies = [ "httpdate", "reqwest 0.10.10", "sentry-backtrace", "sentry-contexts", "sentry-core", - "sentry-failure", "sentry-panic", ] +[[package]] +name = "sentry-anyhow" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6176c8099ad6fcef14b8d5ce3e5717e060e26f1ab23453f45ea48be904bcd4a7" +dependencies = [ + "anyhow", + "sentry-core", +] + [[package]] name = "sentry-backtrace" -version = "0.19.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4585422b92435a04569441aef8dc3417eb9d7547fd591b67fdf6fdfe204232c9" +checksum = "38e528fb457baf53fcd6c90beb420705f35c12c3d8caed8817dcf7be00eff7c7" dependencies = [ "backtrace", "lazy_static", @@ -1511,9 +1499,9 @@ dependencies = [ [[package]] name = "sentry-contexts" -version = "0.19.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d607b3be0593e026f1c089f0086c244429fe3026eca8e075e8f9e834703ee4c0" +checksum = "ce3a560a34cffac347f0b588fc29b31db969e27bf57208f946d6a2d588668b0b" dependencies = [ "hostname", "lazy_static", @@ -1526,32 +1514,23 @@ dependencies = [ [[package]] name = "sentry-core" -version = "0.19.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9c118347dc0958e66f8b0f3866f0d85bbf8a63bffe64603baebe3f989e929e6" +checksum = "17b8c235063c1007fd8e2fc7e35ce7eac09dd678d198ecc996daee33d46b3dcc" dependencies = [ "im", "lazy_static", "rand 0.7.3", "sentry-types", -] - -[[package]] -name = "sentry-failure" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8599d375040329e106653a133a1d876af53df8b504cff1de7b6f4471fd41eec3" -dependencies = [ - "failure", - "sentry-backtrace", - "sentry-core", + "serde 1.0.125", + "serde_json", ] [[package]] name = "sentry-panic" -version = "0.19.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3943c3fc7fff39244158b625bb2235a27e7e4d0b862b5e52cb57db51e6a6e6e" +checksum = "04ee338d8292fcdcfb032929c9f53bc0dfac8e0b9d3096be79ceee96818851ed" dependencies = [ "sentry-backtrace", "sentry-core", @@ -1559,9 +1538,9 @@ dependencies = [ [[package]] name = "sentry-types" -version = "0.19.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87b41bac48a3586249431fa9efb88cd1414c3455117eb57c02f5bda9634e158d" +checksum = "5fbbea6debac0a24880a38239d4c2fc3dbb0b1b398f621bea03ed761796b7dfb" dependencies = [ "chrono", "debugid", @@ -1657,9 +1636,9 @@ dependencies = [ [[package]] name = "sized-chunks" -version = "0.5.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59044ea371ad781ff976f7b06480b9f0180e834eda94114f2afb4afc12b7718" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" dependencies = [ "bitmaps", "typenum", @@ -1715,18 +1694,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "synstructure" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", -] - [[package]] name = "tempfile" version = "3.2.0" @@ -2093,9 +2060,9 @@ dependencies = [ [[package]] name = "utf-8" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "uuid" @@ -2109,9 +2076,9 @@ dependencies = [ [[package]] name = "vcpkg" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb" +checksum = "cbdbff6266a24120518560b5dc983096efb98462e51d0d68169895b237be3e5d" [[package]] name = "version_check" diff --git a/Cargo.toml b/Cargo.toml index ae713d4..9c6f0ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "alpaca-data-relay" -version = "1.0.0" +version = "1.0.1" authors = ["Sebastian Rollen "] edition = "2018" @@ -14,7 +14,8 @@ dotenv = "0.15" futures = "0.3" kafka-settings = { git = "ssh://git@github.com/Overmuse/kafka-settings", tag = "v0.2.1" } rdkafka = { version = "0.26", features = ["ssl-vendored"] } -sentry = "0.19.0" +sentry = "0.21.0" +sentry-anyhow = "0.21.0" serde = "1.0" serde_json = "1.0" tokio = {version = "1.0", features = ["macros", "rt-multi-thread"]} diff --git a/src/main.rs b/src/main.rs index 9a10600..b8f9db0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,13 +1,13 @@ use alpaca_data_relay::{run, Settings}; use anyhow::Result; use dotenv::dotenv; +use sentry_anyhow::capture_anyhow; use tracing::{info, subscriber::set_global_default}; use tracing_log::LogTracer; use tracing_subscriber::{filter::EnvFilter, FmtSubscriber}; #[tokio::main] async fn main() -> Result<()> { - let _guard = sentry::init(sentry::ClientOptions::new()); let _ = dotenv(); let subscriber = FmtSubscriber::builder() .with_env_filter(EnvFilter::from_default_env()) @@ -15,7 +15,18 @@ async fn main() -> Result<()> { set_global_default(subscriber).expect("Failed to set subscriber"); LogTracer::init().expect("Failed to set logger"); let settings = Settings::new()?; + let _guard = sentry::init(( + settings.sentry.address.clone(), + sentry::ClientOptions { + release: sentry::release_name!(), + ..Default::default() + }, + )); info!("Starting alpaca-data-relay"); - run(settings).await + let res = run(settings).await; + if let Err(e) = res { + capture_anyhow(&e); + } + Ok(()) } diff --git a/src/settings.rs b/src/settings.rs index 3b07afa..c31bbfa 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -11,10 +11,16 @@ pub struct AlpacaSettings { pub trade_updates: bool, } +#[derive(Debug, Deserialize)] +pub struct SentrySettings { + pub address: String, +} + #[derive(Debug, Deserialize)] pub struct Settings { pub alpaca: AlpacaSettings, pub kafka: KafkaSettings, + pub sentry: SentrySettings, } impl Settings {