From bd46d808546250a166abeefe4e1052f86232d0e3 Mon Sep 17 00:00:00 2001 From: Evan Purkhiser Date: Wed, 26 Apr 2023 17:36:30 -0700 Subject: [PATCH] feat(crons): Pass-through minimal `sdk` field --- relay-monitors/src/lib.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/relay-monitors/src/lib.rs b/relay-monitors/src/lib.rs index 56ac1b5f36..fbc57bb9ee 100644 --- a/relay-monitors/src/lib.rs +++ b/relay-monitors/src/lib.rs @@ -100,6 +100,17 @@ struct MonitorConfig { timezone: Option, } +// 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 { @@ -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, + /// The environment to associate the check-in with #[serde(default, skip_serializing_if = "Option::is_none")] environment: Option, @@ -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 }"#; @@ -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", @@ -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", @@ -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",