Skip to content

Commit

Permalink
fix snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshFerge committed Jan 7, 2025
1 parent a066a79 commit f46dd4d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
2 changes: 1 addition & 1 deletion rust_snuba/src/processors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ define_processing_functions! {
("ProfilesMessageProcessor", "processed-profiles", ProcessingFunctionType::ProcessingFunction(profiles::process_message)),
("QuerylogProcessor", "snuba-queries", ProcessingFunctionType::ProcessingFunction(querylog::process_message)),
("ReplaysProcessor", "ingest-replay-events", ProcessingFunctionType::ProcessingFunction(replays::process_message)),
("UptimeMonitorChecksProcessor", "uptime-results", ProcessingFunctionType::ProcessingFunction(uptime_monitor_checks::process_message)),
("UptimeMonitorChecksProcessor", "snuba-uptime-results", ProcessingFunctionType::ProcessingFunction(uptime_monitor_checks::process_message)),
("SpansMessageProcessor", "snuba-spans", ProcessingFunctionType::ProcessingFunction(spans::process_message)),
("EAPSpansMessageProcessor", "snuba-spans", ProcessingFunctionType::ProcessingFunction(eap_spans::process_message)),
("OutcomesProcessor", "outcomes", ProcessingFunctionType::ProcessingFunction(outcomes::process_message)),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
source: src/processors/mod.rs
description: "{\n \"guid\": \"54afc7ed9c53491481919c931f75bae1\",\n \"subscription_id\": \"5421b5df80744113a6b57014f01a3a42\",\n \"status\": \"failure\",\n \"status_reason\": {\n \"type\": \"dns_error\",\n \"description\": \"Unable to resolve hostname example.xyz\"\n },\n \"trace_id\": \"947efba02dac463b9c1d886a44bafc94\",\n \"span_id\": \"58e84098e63f42e1\",\n \"scheduled_check_time_ms\": 1717614062978,\n \"actual_check_time_ms\": 1717614068008,\n \"duration_ms\": 100,\n \"request_info\": {\n \"request_type\": \"HEAD\",\n \"http_status_code\": 500\n }\n}\n"
description: "{\n \"guid\": \"54afc7ed9c53491481919c931f75bae1\",\n \"subscription_id\": \"5421b5df80744113a6b57014f01a3a42\",\n \"status\": \"failure\",\n \"status_reason\": {\n \"type\": \"dns_error\",\n \"description\": \"Unable to resolve hostname example.xyz\"\n },\n \"trace_id\": \"947efba02dac463b9c1d886a44bafc94\",\n \"span_id\": \"58e84098e63f42e1\",\n \"scheduled_check_time_ms\": 1717614062978,\n \"actual_check_time_ms\": 1717614068008,\n \"duration_ms\": 100,\n \"request_info\": {\n \"request_type\": \"HEAD\",\n \"http_status_code\": 500\n },\n \"organization_id\": 123,\n \"project_id\": 456,\n \"retention_days\": 90,\n \"region_slug\": \"us-east-1\"\n}\n"
expression: snapshot_payload
---
[
Expand All @@ -11,11 +11,11 @@ expression: snapshot_payload
"environment": null,
"http_status_code": 500,
"offset": 1,
"organization_id": 1,
"organization_id": 123,
"partition": 0,
"project_id": 1,
"region_slug": "global",
"retention_days": 30,
"project_id": 456,
"region_slug": "us-east-1",
"retention_days": 90,
"scheduled_check_time": 1717614062978.0,
"timestamp": 1717614068008.0,
"trace_id": "947efba0-2dac-463b-9c1d-886a44bafc94",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
source: src/processors/mod.rs
description: "{\n \"guid\": \"54afc7ed9c53491481919c931f75bae1\",\n \"subscription_id\": \"5421b5df80744113a6b57014f01a3a42\",\n \"status\": \"success\",\n \"status_reason\": null,\n \"trace_id\": \"947efba02dac463b9c1d886a44bafc94\",\n \"span_id\": \"58e84098e63f42e1\",\n \"scheduled_check_time_ms\": 1717614062978,\n \"actual_check_time_ms\": 1717614068008,\n \"duration_ms\": 50,\n \"request_info\": {\n \"request_type\": \"HEAD\",\n \"http_status_code\": 200\n }\n}\n"
description: "{\n \"guid\": \"54afc7ed9c53491481919c931f75bae1\",\n \"subscription_id\": \"5421b5df80744113a6b57014f01a3a42\",\n \"status\": \"success\",\n \"status_reason\": null,\n \"trace_id\": \"947efba02dac463b9c1d886a44bafc94\",\n \"span_id\": \"58e84098e63f42e1\",\n \"scheduled_check_time_ms\": 1717614062978,\n \"actual_check_time_ms\": 1717614068008,\n \"duration_ms\": 50,\n \"request_info\": {\n \"request_type\": \"HEAD\",\n \"http_status_code\": 200\n },\n \"organization_id\": 123,\n \"project_id\": 456,\n \"retention_days\": 90,\n \"region_slug\": \"us-east-1\"\n}\n"
expression: snapshot_payload
---
[
Expand All @@ -11,11 +11,11 @@ expression: snapshot_payload
"environment": null,
"http_status_code": 200,
"offset": 1,
"organization_id": 1,
"organization_id": 123,
"partition": 0,
"project_id": 1,
"region_slug": "global",
"retention_days": 30,
"project_id": 456,
"region_slug": "us-east-1",
"retention_days": 90,
"scheduled_check_time": 1717614062978.0,
"timestamp": 1717614068008.0,
"trace_id": "947efba0-2dac-463b-9c1d-886a44bafc94",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
source: src/processors/mod.rs
description: "{\n \"guid\": \"54afc7ed9c53491481919c931f75bae1\",\n \"subscription_id\": \"5421b5df80744113a6b57014f01a3a42\",\n \"status\": \"failure\",\n \"status_reason\": {\n \"type\": \"timeout\",\n \"description\": \"Check timed out\"\n },\n \"trace_id\": \"947efba02dac463b9c1d886a44bafc94\",\n \"span_id\": \"58e84098e63f42e1\",\n \"scheduled_check_time_ms\": 1717614062978,\n \"actual_check_time_ms\": 1717614068008,\n \"duration_ms\": 100,\n \"request_info\": {\n \"request_type\": \"HEAD\",\n \"http_status_code\": null\n }\n}\n"
description: "{\n \"guid\": \"54afc7ed9c53491481919c931f75bae1\",\n \"subscription_id\": \"5421b5df80744113a6b57014f01a3a42\",\n \"status\": \"failure\",\n \"status_reason\": {\n \"type\": \"timeout\",\n \"description\": \"Check timed out\"\n },\n \"trace_id\": \"947efba02dac463b9c1d886a44bafc94\",\n \"span_id\": \"58e84098e63f42e1\",\n \"scheduled_check_time_ms\": 1717614062978,\n \"actual_check_time_ms\": 1717614068008,\n \"duration_ms\": 100,\n \"request_info\": {\n \"request_type\": \"HEAD\",\n \"http_status_code\": null\n },\n \"organization_id\": 123,\n \"project_id\": 456,\n \"retention_days\": 90,\n \"region_slug\": \"us-east-1\"\n}\n"
expression: snapshot_payload
---
[
Expand All @@ -9,13 +9,13 @@ expression: snapshot_payload
"check_status_reason": "timeout",
"duration": 100,
"environment": null,
"http_status_code": 0,
"http_status_code": null,
"offset": 1,
"organization_id": 1,
"organization_id": 123,
"partition": 0,
"project_id": 1,
"region_slug": "global",
"retention_days": 30,
"project_id": 456,
"region_slug": "us-east-1",
"retention_days": 90,
"scheduled_check_time": 1717614062978.0,
"timestamp": 1717614068008.0,
"trace_id": "947efba0-2dac-463b-9c1d-886a44bafc94",
Expand Down
13 changes: 8 additions & 5 deletions rust_snuba/src/processors/uptime_monitor_checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ pub fn deserialize_message(
http_status_code: monitor_message
.request_info
.unwrap_or_default()
.http_status_code
.unwrap_or(0),
.http_status_code,
trace_id: monitor_message.trace_id,
retention_days: monitor_message.retention_days,
partition,
Expand Down Expand Up @@ -98,7 +97,7 @@ pub struct UptimeMonitorCheckRow {
region_slug: String,
check_status: String,
check_status_reason: Option<String>,
http_status_code: u16,
http_status_code: Option<u16>,
trace_id: Uuid,
retention_days: u16,
partition: u16,
Expand All @@ -112,6 +111,10 @@ mod tests {
#[test]
fn test_parse_monitor_checkin() {
let data = r#"{
"organization_id": 1,
"project_id": 1,
"retention_days": 30,
"region_slug": "global",
"environment": "prod",
"subscription_id": "123e4567-e89b-12d3-a456-426614174000",
"guid": "550e8400-e29b-41d4-a716-446655440000",
Expand Down Expand Up @@ -143,13 +146,13 @@ mod tests {
);
assert_eq!(monitor_row.duration, 100);
assert_eq!(monitor_row.timestamp, 1702659277.0);
assert_eq!(monitor_row.region_slug, Some("global".to_string()));
assert_eq!(monitor_row.region_slug, "global".to_string());
assert_eq!(&monitor_row.check_status, "ok");
assert_eq!(
monitor_row.check_status_reason,
Some("Request successful".to_string())
);
assert_eq!(monitor_row.http_status_code, 200);
assert_eq!(monitor_row.http_status_code, Some(200));
assert_eq!(monitor_row.retention_days, 30);
assert_eq!(monitor_row.partition, 0);
assert_eq!(monitor_row.offset, 0);
Expand Down

0 comments on commit f46dd4d

Please sign in to comment.