Skip to content

Commit

Permalink
feat(server): More metric tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-auer committed Jul 4, 2022
1 parent dab1d3e commit fdc51c9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion relay-server/src/actors/envelopes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,9 @@ impl EnvelopeProcessor {

metric!(
counter(RelayCounters::EventTransactionSource) += 1,
source = &source.to_string()
source = &source.to_string(),
sdk = envelope.meta().client_name().unwrap_or("proprietary"),
platform = event.platform.as_str().unwrap_or("other"),
);
}
}
Expand Down
11 changes: 11 additions & 0 deletions relay-server/src/extractors/request_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,21 @@ pub struct RequestMeta<D = PartialDsn> {

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

/// Returns the name of the client that sent the event without version.
///
/// If the client is not sent in standard format, this method returns `None`.
pub fn client_name(&self) -> Option<&str> {
let client = self.client()?;
let (name, _version) = client.split_once('/')?;
Some(name)
}

/// Returns the protocol version of the event payload.
pub fn version(&self) -> u16 {
self.version
Expand Down
3 changes: 3 additions & 0 deletions relay-server/src/statsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,9 @@ pub enum RelayCounters {
/// The number of transaction events processed by the source of the transaction name.
///
/// This metric is tagged with:
/// - `platform`: The event's platform, such as `"javascript"`.
/// - `sdk`: The name of the Sentry SDK sending the transaction. This tag is only set for
/// Sentry's SDKs and defaults to "proprietary".
/// - `source`: The source of the transaction name on the client. See the [transaction source
/// documentation](https://develop.sentry.dev/sdk/event-payloads/properties/transaction_info/)
/// for all valid values.
Expand Down

0 comments on commit fdc51c9

Please sign in to comment.