Skip to content

Commit 54650bc

Browse files
authored
feat(uptime): new snuba-uptime-results topic (#361)
I wanted to avoid duplication in #359, so I wrote #360 to allow us to reference other schemas.
1 parent 52cf555 commit 54650bc

File tree

7 files changed

+119
-0
lines changed

7 files changed

+119
-0
lines changed

CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
/topics/monitors-incident-occurrences.yaml @getsentry/crons
7272

7373
# Topics related to uptime
74+
/topics/snuba-uptime-results.yaml @getsentry/crons
7475
/topics/uptime-results.yaml @getsentry/crons
7576
/topics/uptime-configs.yaml @getsentry/crons
7677

@@ -89,6 +90,7 @@
8990
/schemas/monitors-clock-tasks.v1.schema.json @getsentry/crons
9091
/schemas/uptime-results.v1.schema.json @getsentry/crons
9192
/schemas/uptime-configs.v1.schema.json @getsentry/crons
93+
/schemas/snuba-uptime-results.v1.schema.json @getsentry/crons
9294
/schemas/taskworker.v1.schema.json @getsentry/hybrid-cloud
9395

9496
# Examples
@@ -107,6 +109,7 @@
107109
/examples/monitors-clock-tasks/ @getsentry/crons
108110
/examples/uptime-results/ @getsentry/crons
109111
/examples/uptime-configs/ @getsentry/crons
112+
/examples/snuba-uptime-results/ @getsentry/crons
110113
/examples/taskworker/ @getsentry/taskworker
111114

112115
# Internal Snuba topics
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"guid": "54afc7ed9c53491481919c931f75bae1",
3+
"subscription_id": "5421b5df80744113a6b57014f01a3a42",
4+
"status": "failure",
5+
"status_reason": {
6+
"type": "dns_error",
7+
"description": "Unable to resolve hostname example.xyz"
8+
},
9+
"trace_id": "947efba02dac463b9c1d886a44bafc94",
10+
"span_id": "58e84098e63f42e1",
11+
"scheduled_check_time_ms": 1717614062978,
12+
"actual_check_time_ms": 1717614068008,
13+
"duration_ms": 100,
14+
"request_info": {
15+
"request_type": "HEAD",
16+
"http_status_code": 500
17+
},
18+
"organization_id": 123,
19+
"project_id": 456,
20+
"retention_days": 90,
21+
"region_slug": "us-east-1"
22+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"guid": "54afc7ed9c53491481919c931f75bae1",
3+
"subscription_id": "5421b5df80744113a6b57014f01a3a42",
4+
"status": "success",
5+
"status_reason": null,
6+
"trace_id": "947efba02dac463b9c1d886a44bafc94",
7+
"span_id": "58e84098e63f42e1",
8+
"scheduled_check_time_ms": 1717614062978,
9+
"actual_check_time_ms": 1717614068008,
10+
"duration_ms": 50,
11+
"request_info": {
12+
"request_type": "HEAD",
13+
"http_status_code": 200
14+
},
15+
"organization_id": 123,
16+
"project_id": 456,
17+
"retention_days": 90,
18+
"region_slug": "us-east-1"
19+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"guid": "54afc7ed9c53491481919c931f75bae1",
3+
"subscription_id": "5421b5df80744113a6b57014f01a3a42",
4+
"status": "failure",
5+
"status_reason": {
6+
"type": "timeout",
7+
"description": "Check timed out"
8+
},
9+
"trace_id": "947efba02dac463b9c1d886a44bafc94",
10+
"span_id": "58e84098e63f42e1",
11+
"scheduled_check_time_ms": 1717614062978,
12+
"actual_check_time_ms": 1717614068008,
13+
"duration_ms": 100,
14+
"request_info": {
15+
"request_type": "HEAD",
16+
"http_status_code": null
17+
},
18+
"organization_id": 123,
19+
"project_id": 456,
20+
"retention_days": 90,
21+
"region_slug": "us-east-1"
22+
}

rust/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ mod tests {
246246
// Did not error
247247
get_schema("snuba-queries", Some(1)).unwrap();
248248
get_schema("transactions", Some(1)).unwrap();
249+
get_schema("snuba-uptime-results", Some(1)).unwrap();
249250
}
250251

251252
fn validate_schema(schema_name: &str) {
@@ -267,5 +268,6 @@ mod tests {
267268
fn test_validate() {
268269
validate_schema("snuba-queries");
269270
validate_schema("uptime-results");
271+
validate_schema("snuba-uptime-results");
270272
}
271273
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "snuba_uptime_result",
4+
"type": "object",
5+
"allOf": [
6+
{
7+
"$ref": "file://uptime-results.v1.schema.json#/definitions/CheckResult"
8+
}
9+
],
10+
"properties": {
11+
"organization_id": {
12+
"type": "integer",
13+
"description": "The organization ID associated with this check",
14+
"minimum": 0
15+
},
16+
"project_id": {
17+
"type": "integer",
18+
"description": "The project ID associated with this check",
19+
"minimum": 0
20+
},
21+
"retention_days": {
22+
"type": "integer",
23+
"description": "Number of days to retain this data",
24+
"minimum": 0,
25+
"maximum": 65535
26+
},
27+
"region_slug": {
28+
"type": ["string", "null"],
29+
"description": "The region identifier where this check was performed"
30+
}
31+
},
32+
"required": ["organization_id", "project_id", "retention_days"]
33+
}

topics/snuba-uptime-results.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
pipeline: uptime
2+
description: uptime check results for snuba
3+
services:
4+
producers:
5+
- getsentry/sentry
6+
consumers:
7+
- getsentry/snuba
8+
schemas:
9+
- version: 1
10+
compatibility_mode: backward
11+
type: json
12+
resource: snuba-uptime-results.v1.schema.json
13+
examples:
14+
- snuba-uptime-results/1/
15+
topic_creation_config:
16+
compression.type: lz4
17+
message.timestamp.type: LogAppendTime
18+
retention.ms: "86400000"

0 commit comments

Comments
 (0)