Skip to content

Commit

Permalink
meta(crons): Update API help text (#58048)
Browse files Browse the repository at this point in the history
Updates API help text for Crons validators
  • Loading branch information
rjo100 committed Oct 16, 2023
1 parent 6028542 commit 650777e
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/sentry/monitors/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,21 +230,26 @@ def validate(self, attrs):
return attrs


@extend_schema_serializer(exclude_fields=["project", "name", "slug", "config", "alert_rule"])
@extend_schema_serializer(exclude_fields=["project", "config", "alert_rule"])
class MonitorValidator(CamelSnakeSerializer, PreventNumericSlugMixin):
project = ProjectField(scope="project:read")
name = serializers.CharField(max_length=128)
name = serializers.CharField(
max_length=128,
help_text="Name of the monitor. Used for notifications.",
)
slug = serializers.RegexField(
DEFAULT_SLUG_PATTERN,
max_length=MAX_SLUG_LENGTH,
required=False,
error_messages={
"invalid": DEFAULT_SLUG_ERROR_MESSAGE,
},
help_text="Uniquely identifies your monitor within your organization. Changing this slug will require updates to any instrumented check-in calls.",
)
status = serializers.ChoiceField(
choices=list(zip(MONITOR_STATUSES.keys(), MONITOR_STATUSES.keys())),
default="active",
help_text="Status of the monitor. Disabled monitors do not generate events or notifications.",
)
type = serializers.ChoiceField(choices=list(zip(MONITOR_TYPES.keys(), MONITOR_TYPES.keys())))
config = ConfigValidator()
Expand Down Expand Up @@ -288,22 +293,28 @@ class ContextsValidator(serializers.Serializer):
trace = TraceContextValidator(required=False)


@extend_schema_serializer(exclude_fields=["duration", "environment", "monitor_config", "contexts"])
@extend_schema_serializer(exclude_fields=["monitor_config", "contexts"])
class MonitorCheckInValidator(serializers.Serializer):
status = serializers.ChoiceField(
choices=(
("ok", CheckInStatus.OK),
("error", CheckInStatus.ERROR),
("in_progress", CheckInStatus.IN_PROGRESS),
)
),
help_text="The status of the job run.",
)
duration = EmptyIntegerField(
required=False,
allow_null=True,
max_value=BoundedPositiveIntegerField.MAX_VALUE,
min_value=0,
help_text="Duration of the job run, in milliseconds.",
)
environment = serializers.CharField(
required=False,
allow_null=True,
help_text="Name of the environment.",
)
environment = serializers.CharField(required=False, allow_null=True)
monitor_config = ConfigValidator(required=False)
contexts = ContextsValidator(required=False, allow_null=True)

Expand Down

0 comments on commit 650777e

Please sign in to comment.