Skip to content

Commit 2ae739a

Browse files
committed
feat(server): More metric tags
1 parent dab1d3e commit 2ae739a

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

relay-server/src/actors/envelopes.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1530,7 +1530,9 @@ impl EnvelopeProcessor {
15301530

15311531
metric!(
15321532
counter(RelayCounters::EventTransactionSource) += 1,
1533-
source = &source.to_string()
1533+
source = &source.to_string(),
1534+
sdk = state.envelope.meta().client_name().unwrap_or("proprietary"),
1535+
platform = event.platform.as_str().unwrap_or("other"),
15341536
);
15351537
}
15361538
}

relay-server/src/extractors/request_meta.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,21 @@ pub struct RequestMeta<D = PartialDsn> {
204204

205205
impl<D> RequestMeta<D> {
206206
/// Returns the client that sent this event (Sentry SDK identifier).
207+
///
208+
/// The client is formatted as `"sdk/version"`, for example `"raven-node/2.6.3"`.
207209
pub fn client(&self) -> Option<&str> {
208210
self.client.as_deref()
209211
}
210212

213+
/// Returns the name of the client that sent the event without version.
214+
///
215+
/// If the client is not sent in standard format, this method returns `None`.
216+
pub fn client_name(&self) -> Option<&str> {
217+
let client = self.client()?;
218+
let (name, _version) = client.split_once('/')?;
219+
Some(name)
220+
}
221+
211222
/// Returns the protocol version of the event payload.
212223
pub fn version(&self) -> u16 {
213224
self.version

relay-server/src/statsd.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,9 @@ pub enum RelayCounters {
450450
/// The number of transaction events processed by the source of the transaction name.
451451
///
452452
/// This metric is tagged with:
453+
/// - `platform`: The event's platform, such as `"javascript"`.
454+
/// - `sdk`: The name of the Sentry SDK sending the transaction. This tag is only set for
455+
/// Sentry's SDKs and defaults to "proprietary".
453456
/// - `source`: The source of the transaction name on the client. See the [transaction source
454457
/// documentation](https://develop.sentry.dev/sdk/event-payloads/properties/transaction_info/)
455458
/// for all valid values.

0 commit comments

Comments
 (0)