Skip to content

Commit

Permalink
Added CLI docs for sentry.
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Kirilin <win10@list.ru>
  • Loading branch information
s3rius committed Dec 11, 2023
1 parent ef77ad2 commit 8b9571f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@ please provide sentry-dsn to rustus.

``` bash
rustus --sentry-dsn "https://user@sentry-instance.com/11" \
--sentry-sample-rate 1.0
--sentry-sample-rate 1.0 \
--sentry-environment "dev"
```

=== "ENV"

``` bash
export RUSTUS_SENTRY_DSN="https://user@sentry-instance.com/11"
export RUSTUS_SENTRY_SAMPLE_RATE="1.0"
export RUSTUS_SENTRY_ENVIRONMENT="dev"

rustus
```
Expand Down
24 changes: 23 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,24 +279,46 @@ pub struct NotificationConfig {
#[derive(Parser, Clone, Debug)]
pub struct SentryConfig {
/// Sentry DSN.
///
/// Link to sentry project, which is used to send events to.
#[arg(name = "sentry-dsn", long, env = "RUSTUS_SENTRY_DSN")]
pub dsn: Option<String>,

/// Sentry sample rate.
#[arg(name = "sentry-sample-rate", long, env = "RUSTUS_SENTRY_SAMPLE_RATE")]
///
/// This option is used to set how often events are sent to sentry.
/// The default value is 1.0, which means that all events are sent.
#[arg(
name = "sentry-sample-rate",
long,
default_value = "1.0",
env = "RUSTUS_SENTRY_SAMPLE_RATE"
)]
pub sample_rate: Option<f32>,

/// Sentry traces sample rate.
///
/// This option is used to set how often traces are sent to sentry.
/// Traces are used to track performance, so this option might not be
/// useful for regular users.
#[arg(
name = "sentry-traces-sample-rate",
long,
env = "RUSTUS_SENTRY_TRACES_SAMPLE_RATE"
)]
pub traces_sample_rate: Option<f32>,

/// Sentry environment.
///
/// This option is used to set environment for sentry.
#[arg(name = "sentry-environment", long, env = "RUSTUS_SENTRY_ENVIRONMENT")]
pub environment: Option<String>,

/// DEvelopment option for sentry.
///
/// This option enables logging of sentry events,
/// which is useful for debugging. But it is not recommended
/// to enable this option in production.
#[arg(
name = "sentry-debug",
long,
Expand Down

0 comments on commit 8b9571f

Please sign in to comment.