Set up Sentry error collection via a feature flag

This commit is contained in:
Deirdre Connolly 2020-12-04 05:07:16 -05:00 committed by Deirdre Connolly
parent 47d78d4cf4
commit 27e42f4ed5
4 changed files with 11 additions and 12 deletions

View File

@ -3,7 +3,7 @@ FROM rust:buster as builder
RUN apt-get update && \
apt-get install -y --no-install-recommends \
make cmake g++ gcc llvm libclang-dev clang
make cmake g++ gcc llvm libclang-dev clang ca-certificates
RUN mkdir /zebra
WORKDIR /zebra
@ -18,7 +18,7 @@ RUN rustc -V; cargo -V; rustup -V
COPY . .
RUN cargo test --all --release; cargo build --release
RUN cargo test --all --release; cargo build --release --features enable-sentry
# Runner image
@ -41,6 +41,8 @@ RUN cat /zebrad.toml
EXPOSE 3000 8233 18233
ENV RUST_LOG debug
ENV RUST_BACKTRACE full
ENV SENTRY_DSN https://94059ee72a44420286310990b7c614b5@o485484.ingest.sentry.io/5540918
CMD [ "/zebrad", "-c", "/zebrad.toml", "start" ]

View File

@ -2,7 +2,7 @@ FROM rust:buster
RUN apt-get update && \
apt-get install -y --no-install-recommends \
make cmake g++ gcc llvm libclang-dev clang
make cmake g++ gcc llvm libclang-dev clang ca-certificates
RUN mkdir /zebra
WORKDIR /zebra

View File

@ -52,6 +52,7 @@ tempdir = "0.3.7"
zebra-test = { path = "../zebra-test" }
[features]
enable-sentry = []
test_sync_to_sapling_mainnet = []
test_sync_to_sapling_testnet = []
test_sync_past_sapling_mainnet = []

View File

@ -7,15 +7,11 @@ use zebrad::application::APPLICATION;
/// Boot Zebrad
fn main() {
let _guard = sentry::init((
"https://94059ee72a44420286310990b7c614b5@o485484.ingest.sentry.io/5540918",
sentry::ClientOptions {
debug: true,
..Default::default()
},
));
sentry::capture_message("Hello World!", sentry::Level::Info);
if cfg!(feature = "enable-sentry") {
// The Sentry default config pulls in the DSN from the `SENTRY_DSN`
// environment variable.
let _guard = sentry::init(());
}
abscissa_core::boot(&APPLICATION);
}