Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(crons): Pass-through minimal sdk field #2073

Merged
Merged
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
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,
jan-auer marked this conversation as resolved.
Show resolved Hide resolved
}
jan-auer marked this conversation as resolved.
Show resolved Hide resolved

/// 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