Skip to content

Commit 9d3e506

Browse files
evanpurkhiserandrewshie-sentry
authored andcommitted
ref(uptime): Remove uptime-configs topic usage (#89320)
1 parent 213921d commit 9d3e506

File tree

4 files changed

+78
-8
lines changed

4 files changed

+78
-8
lines changed

src/sentry/conf/server.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3065,9 +3065,7 @@ def custom_parameter_sort(parameter: dict) -> tuple[str, int]:
30653065
"monitors-clock-tick": "default",
30663066
"monitors-clock-tasks": "default",
30673067
"monitors-incident-occurrences": "default",
3068-
"uptime-configs": "default",
30693068
"uptime-results": "default",
3070-
"uptime-configs": "default",
30713069
"snuba-uptime-results": "default",
30723070
"generic-events": "default",
30733071
"snuba-generic-events-commit-log": "default",

src/sentry/conf/types/kafka_definition.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class Topic(Enum):
5555
MONITORS_INCIDENT_OCCURRENCES = "monitors-incident-occurrences"
5656
UPTIME_RESULTS = "uptime-results"
5757
SNUBA_UPTIME_RESULTS = "snuba-uptime-results"
58-
UPTIME_CONFIGS = "uptime-configs"
5958
EVENTSTREAM_GENERIC = "generic-events"
6059
GENERIC_EVENTS_COMMIT_LOG = "snuba-generic-events-commit-log"
6160
GROUP_ATTRIBUTES = "group-attributes"

src/sentry/uptime/config_producer.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,27 @@
33
import logging
44
from uuid import UUID
55

6+
import jsonschema
67
import msgpack
78
from django.conf import settings
89
from redis import StrictRedis
910
from rediscluster import RedisCluster
10-
from sentry_kafka_schemas.codecs import Codec
1111

12-
from sentry.conf.types.kafka_definition import Topic, get_topic_codec
1312
from sentry.conf.types.uptime import UptimeRegionConfig
13+
from sentry.uptime.config_schema import CHECK_CONFIG_SCHEMA
1414
from sentry.uptime.subscriptions.regions import get_region_config
1515
from sentry.uptime.types import CheckConfig
1616
from sentry.utils import redis
1717

1818
logger = logging.getLogger(__name__)
1919

20-
UPTIME_CONFIGS_CODEC: Codec[CheckConfig] = get_topic_codec(Topic.UPTIME_CONFIGS)
21-
2220

2321
def produce_config(destination_region_slug: str, config: CheckConfig):
22+
jsonschema.validate(config, CHECK_CONFIG_SCHEMA)
2423
_send_to_redis(
2524
destination_region_slug,
2625
UUID(config["subscription_id"]),
27-
UPTIME_CONFIGS_CODEC.encode(config),
26+
msgpack.packb(config),
2827
)
2928

3029

src/sentry/uptime/config_schema.py

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
CHECK_CONFIG_SCHEMA = {
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "uptime_config",
4+
"$ref": "#/definitions/CheckConfig",
5+
"definitions": {
6+
"CheckInterval": {
7+
"title": "check_interval",
8+
"description": "The interval between each check run in seconds.",
9+
"type": "number",
10+
"enum": [60, 300, 600, 1200, 1800, 3600],
11+
},
12+
"RequestHeader": {
13+
"title": "request_header",
14+
"description": "An individual header, consisting of a name and value as a tuple.",
15+
"type": "array",
16+
"prefixItems": [
17+
{"title": "header_name", "type": "string"},
18+
{"title": "header_value", "type": "string"},
19+
],
20+
},
21+
"RegionScheduleMode": {
22+
"title": "region_schedule_mode",
23+
"description": "Defines how we'll schedule checks based on other active regions.",
24+
"type": "string",
25+
"enum": ["round_robin"],
26+
},
27+
"CheckConfig": {
28+
"title": "check_config",
29+
"description": "A message containing the configuration for a check to scheduled and executed by the uptime-checker.",
30+
"type": "object",
31+
"additionalProperties": True,
32+
"properties": {
33+
"subscription_id": {
34+
"description": "UUID of the subscription that this check config represents.",
35+
"type": "string",
36+
},
37+
"interval_seconds": {"$ref": "#/definitions/CheckInterval"},
38+
"timeout_ms": {
39+
"description": "The total time we will allow to make the request in milliseconds.",
40+
"type": "number",
41+
},
42+
"url": {"description": "The actual HTTP URL to check.", "type": "string"},
43+
"request_method": {
44+
"description": "The HTTP method to use for the request.",
45+
"type": "string",
46+
"enum": ["GET", "POST", "HEAD", "PUT", "DELETE", "PATCH", "OPTIONS"],
47+
},
48+
"request_headers": {
49+
"description": "Additional HTTP headers to send with the request",
50+
"type": "array",
51+
"items": {"$ref": "#/definitions/RequestHeader"},
52+
},
53+
"request_body": {
54+
"description": "Additional HTTP headers to send with the request",
55+
"type": "string",
56+
},
57+
"trace_sampling": {
58+
"description": "Whether to allow for sampled trace spans for the request.",
59+
"type": "boolean",
60+
},
61+
"active_regions": {
62+
"description": "A list of region slugs the uptime check is configured to run in.",
63+
"type": "array",
64+
"items": {"type": "string"},
65+
},
66+
"region_schedule_mode": {"$ref": "#/definitions/RegionScheduleMode"},
67+
},
68+
"required": ["subscription_id", "interval_seconds", "timeout_ms", "url"],
69+
},
70+
},
71+
}
72+
"""
73+
The json-schema for the uptime config object provided to the uptime-checker via redis.
74+
"""

0 commit comments

Comments
 (0)