Skip to content
Draft
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
2,075 changes: 1,112 additions & 963 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -174,20 +174,21 @@ regex-lite = "0.1.7"
reqwest = "0.12.23"
rmp-serde = "1.3.0"
semver = "1.0.27"
sentry = { version = "0.41.0", default-features = false, features = [
sentry = { git = "https://github.com/getsentry/sentry-rust", branch = "feat/trace-metrics", default-features = false, features = [
# default features, except `release-health` is disabled
"backtrace",
"contexts",
"debug-images",
"panic",
"transport",
"metrics",
] }
sentry-core = "0.41.0"
sentry-core = { git = "https://github.com/getsentry/sentry-rust", branch = "feat/trace-metrics" }
sentry-kafka-schemas = { version = "2.1.14", default-features = false }
sentry-release-parser = { version = "1.4.0", default-features = false, features = [
"semver-1",
] }
sentry-types = "0.41.0"
sentry-types = { git = "https://github.com/getsentry/sentry-rust", branch = "feat/trace-metrics" }
sentry_protos = "0.5.0"
serde = { version = "=1.0.228", features = ["derive", "rc"] }
serde-transcode = "1.1.1"
Expand Down
11 changes: 11 additions & 0 deletions relay-config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,11 @@ pub struct Metrics {
///
/// Defaults to `false`.
pub allow_high_cardinality_tags: bool,
/// Sample rate for sending internal metrics to Sentry as trace metrics.
///
/// A value between `0.0` and `1.0`. `0.0` disables trace metrics entirely (default).
/// `1.0` means all metrics are sent to Sentry.
pub send_to_sentry: f64,
}

impl Default for Metrics {
Expand All @@ -600,6 +605,7 @@ impl Default for Metrics {
periodic_secs: 5,
aggregate: true,
allow_high_cardinality_tags: false,
send_to_sentry: 0.0,
}
}
}
Expand Down Expand Up @@ -2204,6 +2210,11 @@ impl Config {
self.values.metrics.allow_high_cardinality_tags
}

/// Returns the sample rate for sending internal metrics to Sentry as trace metrics.
pub fn metrics_send_to_sentry(&self) -> f64 {
self.values.metrics.send_to_sentry
}

/// Returns the interval for periodic metrics emitted from Relay.
///
/// `None` if periodic metrics are disabled.
Expand Down
3 changes: 2 additions & 1 deletion relay-log/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ relay-crash = { workspace = true, optional = true }
sentry = { workspace = true, features = [
"debug-images",
"tracing",
"logs"
"logs",
"metrics",
], optional = true }
sentry-core = { workspace = true }
serde = { workspace = true, optional = true }
Expand Down
8 changes: 8 additions & 0 deletions relay-log/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ pub struct SentryConfig {
/// Add defaults tags to the events emitted by Relay
pub default_tags: Option<BTreeMap<String, String>>,

/// Enables sending trace metrics to Sentry.
///
/// Defaults to `false`. Set to `true` when `metrics.send_to_sentry` is greater than `0.0`.
#[serde(default)]
pub enable_metrics: bool,

/// Internal. Enables crash handling and sets the absolute path to where minidumps should be
/// cached on disk. The path is created if it doesn't exist. Path must be UTF-8.
pub _crash_db: Option<PathBuf>,
Expand All @@ -239,6 +245,7 @@ impl Default for SentryConfig {
environment: None,
server_name: None,
default_tags: None,
enable_metrics: false,
_crash_db: None,
}
}
Expand Down Expand Up @@ -366,6 +373,7 @@ pub unsafe fn init(config: &LogConfig, sentry: &SentryConfig) {
server_name: sentry.server_name.clone(),
traces_sampler,
enable_logs: true,
enable_metrics: sentry.enable_metrics,
..Default::default()
};

Expand Down
6 changes: 3 additions & 3 deletions relay-prosperoconv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ mime_guess = "2.0.4"
minidump-writer = "0.11.0"
object = "0.36.0"
rmpv = "1.3.0"
sentry = { version = "0.41.0", default-features = false, features = [
# default features, except `release-health` is disabled and `reqwest` is explicitly selected as the transport
sentry = { git = "https://github.com/getsentry/sentry-rust", branch = "feat/trace-metrics", default-features = false, features = [
# default features, except `release-health` is disabled
"backtrace",
"contexts",
"debug-images",
"panic",
"reqwest",
"transport",
]}
tracing = "0.1.40"
watto = "0.1.0"
Expand Down
1 change: 1 addition & 0 deletions relay-statsd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ crossbeam-channel = { workspace = true }
parking_lot = { workspace = true }
rand = { workspace = true }
relay-log = { workspace = true }
sentry-core = { workspace = true, features = ["client", "metrics"] }
statsdproxy = { workspace = true, features = ["cadence"] }

[features]
Expand Down
Loading