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(uptime): new snuba-uptime-results topic #359

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
/topics/monitors-incident-occurrences.yaml @getsentry/crons

# Topics related to uptime
/topics/snuba-uptime-results.yaml @getsentry/crons
/topics/uptime-results.yaml @getsentry/crons
/topics/uptime-configs.yaml @getsentry/crons

Expand All @@ -88,6 +89,7 @@
/schemas/monitors-clock-tick.v1.schema.json @getsentry/crons
/schemas/monitors-clock-tasks.v1.schema.json @getsentry/crons
/schemas/uptime-results.v1.schema.json @getsentry/crons
/schemas/uptime-results.v1.schema.json @getsentry/crons
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate?

/schemas/uptime-configs.v1.schema.json @getsentry/crons
/schemas/taskworker.v1.schema.json @getsentry/hybrid-cloud

Expand All @@ -107,6 +109,7 @@
/examples/monitors-clock-tasks/ @getsentry/crons
/examples/uptime-results/ @getsentry/crons
/examples/uptime-configs/ @getsentry/crons
/examples/snuba-uptime-results/ @getsentry/crons
/examples/taskworker/ @getsentry/taskworker

# Internal Snuba topics
Expand Down
22 changes: 22 additions & 0 deletions examples/snuba-uptime-results/1/failure.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"guid": "54afc7ed9c53491481919c931f75bae1",
"subscription_id": "5421b5df80744113a6b57014f01a3a42",
"status": "failure",
"status_reason": {
"type": "dns_error",
"description": "Unable to resolve hostname example.xyz"
},
"trace_id": "947efba02dac463b9c1d886a44bafc94",
"span_id": "58e84098e63f42e1",
"scheduled_check_time_ms": 1717614062978,
"actual_check_time_ms": 1717614068008,
"duration_ms": 100,
"request_info": {
"request_type": "HEAD",
"http_status_code": 500
},
"organization_id": 123,
"project_id": 456,
"retention_days": 90,
"region_slug": "us-east-1"
}
19 changes: 19 additions & 0 deletions examples/snuba-uptime-results/1/succeess.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"guid": "54afc7ed9c53491481919c931f75bae1",
"subscription_id": "5421b5df80744113a6b57014f01a3a42",
"status": "success",
"status_reason": null,
"trace_id": "947efba02dac463b9c1d886a44bafc94",
"span_id": "58e84098e63f42e1",
"scheduled_check_time_ms": 1717614062978,
"actual_check_time_ms": 1717614068008,
"duration_ms": 50,
"request_info": {
"request_type": "HEAD",
"http_status_code": 200
},
"organization_id": 123,
"project_id": 456,
"retention_days": 90,
"region_slug": "us-east-1"
}
22 changes: 22 additions & 0 deletions examples/snuba-uptime-results/1/timeout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"guid": "54afc7ed9c53491481919c931f75bae1",
"subscription_id": "5421b5df80744113a6b57014f01a3a42",
"status": "failure",
"status_reason": {
"type": "timeout",
"description": "Check timed out"
},
"trace_id": "947efba02dac463b9c1d886a44bafc94",
"span_id": "58e84098e63f42e1",
"scheduled_check_time_ms": 1717614062978,
"actual_check_time_ms": 1717614068008,
"duration_ms": 100,
"request_info": {
"request_type": "HEAD",
"http_status_code": null
},
"organization_id": 123,
"project_id": 456,
"retention_days": 90,
"region_slug": "us-east-1"
}
145 changes: 145 additions & 0 deletions schemas/snuba-uptime-results.v1.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "snuba_uptime_result",
"definitions": {
Copy link
Member Author

@JoshFerge JoshFerge Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are copied from

i tried to link directly to them with a "$ref", but it doesn't seem like our framework supports that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lynnagara do you know if it's possible to cross reference schemas somehow in this repo?

Would be nice to not need to duplicate these

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wedamija is dealing with this in #360

Copy link
Member

@evanpurkhiser evanpurkhiser Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh cool, I totally missed it. Thanks!

"CheckStatus": {
"title": "check_status",
"description": "The status of the check",
"type": "string",
"enum": ["success", "failure", "missed_window"]
},
"CheckStatusReasonType": {
"title": "check_status_reason_type",
"description": "The type of the status reason",
"type": "string",
"enum": ["timeout", "dns_error", "failure"]
},
"RequestType": {
"title": "request_type",
"description": "The type of HTTP method used for the check",
"type": "string",
"enum": ["GET", "POST", "HEAD", "PUT", "DELETE", "PATCH", "OPTIONS"]
},
"CheckStatusReason": {
"title": "check_status_reason",
"description": "Reason for the status, primairly used for failure",
"type": "object",
"properties": {
"type": {
"$ref": "#/definitions/CheckStatusReasonType"
},
"description": {
"description": "A human readable description of the status reason",
"type": "string"
}
},
"required": ["type", "description"]
},
"RequestInfo": {
"title": "request_info",
"description": "Additional information about the request made",
"type": "object",
"properties": {
"request_type": {
"$ref": "#/definitions/RequestType"
},
"http_status_code": {
"description": "Status code of the successful check-in",
"type": ["number", "null"]
}
},
"required": ["request_type", "http_status_code"]
},
"CheckResult": {
"title": "check_result",
"description": "A message containing the result of the uptime check.",
"type": "object",
"additionalProperties": true,
"properties": {
"guid": {
"description": "Unique identifier of the uptime check",
"type": "string"
},
"subscription_id": {
"description": "Identifier of the subscription that this check was run for",
"type": "string"
},
"status": {
"$ref": "#/definitions/CheckStatus"
},
"status_reason": {
"oneOf": [
{
"$ref": "#/definitions/CheckStatusReason"
},
{
"type": "null"
}
]
},
"trace_id": {
"description": "Trace ID associated with the check-in made",
"type": "string"
},
"span_id": {
"description": "Span ID associated with the check-in made. This is a phantom span generated by the uptime-checker, no real span is ingested.",
"type": "string"
},
"scheduled_check_time_ms": {
"description": "Timestamp in milliseconds of when the check was schedule to run",
"type": "number"
},
"actual_check_time_ms": {
"description": "Timestamp in milliseconds of when the check was actually ran",
"type": "number"
},
"duration_ms": {
"description": "Duration of the check in ms. Will be null when the status is missed_window",
"type": ["number", "null"]
},
"request_info": {
"oneOf": [
{
"$ref": "#/definitions/RequestInfo"
},
{
"type": "null"
}
]
}
}
}
},
"allOf": [
{
"$ref": "#/definitions/CheckResult"
},
{
"type": "object",
"properties": {
"organization_id": {
"type": "integer",
"description": "The organization ID associated with this check",
"minimum": 0
},
"project_id": {
"type": "integer",
"description": "The project ID associated with this check",
"minimum": 0
},
"retention_days": {
"type": "integer",
"description": "Number of days to retain this data",
"minimum": 0,
"maximum": 65535
},
"region_slug": {
"type": ["string", "null"],
"description": "The region identifier where this check was performed"
}
},
"required": ["organization_id", "project_id", "retention_days"]
}
],
"description": "A message containing the result of the uptime check for Snuba ingestion."
}
18 changes: 18 additions & 0 deletions topics/snuba-uptime-results.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pipeline: uptime
description: uptime check results for snuba
services:
producers:
- getsentry/sentry
consumers:
- getsentry/snuba
schemas:
- version: 1
compatibility_mode: backward
type: json
resource: snuba-uptime-results.v1.schema.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the schemas are identical, so can we just point to uptime-results.yaml here and avoid the duplication?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they aren't identical, as the new schema contains organization_id, project_id, retention_days, and region_slug which the old one does not contain.

we could alternatively update the old schema to contain these values i suppose.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎 to having the other schema include these values. They won't be used since the uptime checker isn't aware of org / project_id (and can't be since the requests are de-duplicated right now)

examples:
- snuba-uptime-results/1/
topic_creation_config:
compression.type: lz4
message.timestamp.type: LogAppendTime
retention.ms: "86400000"
Loading