Skip to content

Commit

Permalink
feat(crons): Pass-through minimal sdk field (#2073)
Browse files Browse the repository at this point in the history
We would like to collect more information about where cron checkins are
coming from. Since we're not using `metastructure` yet we can't use the
`ClientSdkInfo` struct


https://github.com/getsentry/relay/blob/3ffdaf1c108ab44d1fea6f73874ddee351975e5d/relay-general/src/protocol/clientsdk.rs#L18-L65

#skip-changelog
  • Loading branch information
evanpurkhiser authored Apr 28, 2023
1 parent 8c13d47 commit 7539958
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions relay-monitors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,17 @@ struct MonitorConfig {
timezone: Option<String>,
}

// XXX(epurkhiser): This is a duplicate of the ClientSdkInfo that is part of the relay-general
// crate. Until we're able to migrate the checkin payload over to it's own protocol using
// metastructure we'll need to have this duplicated here
//
/// The SDK Interface describes the Sentry SDK and its configuration used to capture and transmit an event.
#[derive(Debug, Deserialize, Serialize)]
struct MinimalClientSdkInfo {
pub name: String,
pub version: String,
}

/// The monitor check-in payload.
#[derive(Debug, Deserialize, Serialize)]
struct CheckIn {
Expand All @@ -113,6 +124,10 @@ struct CheckIn {
/// Status of this check-in. Defaults to `"unknown"`.
status: CheckInStatus,

/// monitor configuration to support upserts.
#[serde(default, skip_serializing_if = "Option::is_none")]
sdk: Option<MinimalClientSdkInfo>,

/// The environment to associate the check-in with
#[serde(default, skip_serializing_if = "Option::is_none")]
environment: Option<String>,
Expand Down Expand Up @@ -176,6 +191,10 @@ mod tests {
"check_in_id": "a460c25ff2554577b920fcfacae4e5eb",
"monitor_slug": "my-monitor",
"status": "in_progress",
"sdk": {
"name": "sentry.rust",
"version": "1.0.0"
},
"environment": "production",
"duration": 21.0
}"#;
Expand All @@ -192,6 +211,10 @@ mod tests {
"check_in_id": "a460c25ff2554577b920fcfacae4e5eb",
"monitor_slug": "my-monitor",
"status": "in_progress",
"sdk": {
"name": "sentry.rust",
"version": "1.0.0"
},
"monitor_config": {
"schedule": {
"type": "crontab",
Expand All @@ -212,6 +235,10 @@ mod tests {
"check_in_id": "a460c25ff2554577b920fcfacae4e5eb",
"monitor_slug": "my-monitor",
"status": "in_progress",
"sdk": {
"name": "sentry.rust",
"version": "1.0.0"
},
"monitor_config": {
"schedule": {
"type": "interval",
Expand All @@ -236,6 +263,10 @@ mod tests {
"check_in_id": "a460c25ff2554577b920fcfacae4e5eb",
"monitor_slug": "my-monitor",
"status": "in_progress",
"sdk": {
"name": "sentry.rust",
"version": "1.0.0"
},
"monitor_config": {
"schedule": {
"type": "crontab",
Expand Down

0 comments on commit 7539958

Please sign in to comment.