-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat(discover): Add docs for organization_events #34768
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
Changes from all commits
5d5174d
c029730
36ba73b
d95d12b
8e64e14
34929aa
1716b4f
55d33a3
df466f9
1d43cb4
a15876c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from drf_spectacular.types import OpenApiTypes | ||
from drf_spectacular.utils import OpenApiParameter | ||
from rest_framework import serializers | ||
|
||
|
@@ -17,6 +18,50 @@ class GLOBAL_PARAMS: | |
type=str, | ||
location="path", | ||
) | ||
STATS_PERIOD = OpenApiParameter( | ||
name="statsPeriod", | ||
location="query", | ||
required=False, | ||
type=str, | ||
description="""The period of time for the query, will override the start & end parameters, a number followed by one of: | ||
- `d` for days | ||
- `h` for hours | ||
- `m` for minutes | ||
- `s` for seconds | ||
- `w` for weeks | ||
|
||
For example `24h`, to mean query data starting from 24 hours ago to now.""", | ||
) | ||
START = OpenApiParameter( | ||
name="start", | ||
location="query", | ||
required=False, | ||
type=OpenApiTypes.DATETIME, | ||
description="The start of the period of time for the query, expected in ISO-8601 format. For example `2001-12-14T12:34:56.7890`", | ||
) | ||
END = OpenApiParameter( | ||
name="end", | ||
location="query", | ||
required=False, | ||
type=OpenApiTypes.DATETIME, | ||
description="The end of the period of time for the query, expected in ISO-8601 format. For example `2001-12-14T12:34:56.7890`", | ||
) | ||
PROJECT = OpenApiParameter( | ||
name="project", | ||
location="query", | ||
required=False, | ||
many=True, | ||
type=int, | ||
description="The ids of projects to filter by. `-1` means all available projects. If this parameter is omitted, the request will default to using 'My Projects'", | ||
) | ||
ENVIRONMENT = OpenApiParameter( | ||
name="environment", | ||
location="query", | ||
required=False, | ||
many=True, | ||
type=str, | ||
description="The name of environments to filter by.", | ||
) | ||
|
||
|
||
class SCIM_PARAMS: | ||
|
@@ -46,6 +91,51 @@ class ISSUE_ALERT_PARAMS: | |
) | ||
|
||
|
||
class VISIBILITY_PARAMS: | ||
QUERY = OpenApiParameter( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a visibility-only param? I think we use it in several places outside of visibility. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a specific |
||
name="query", | ||
location="query", | ||
required=False, | ||
type=str, | ||
description="""The search filter for your query, read more about query syntax [here](https://docs.sentry.io/product/sentry-basics/search/) | ||
|
||
example: `query=(transaction:foo AND release:abc) OR (transaction:[bar,baz] AND release:def)` | ||
""", | ||
) | ||
FIELD = OpenApiParameter( | ||
name="field", | ||
location="query", | ||
required=True, | ||
type=str, | ||
many=True, | ||
description="""The fields, functions, or equations to request for the query. At most 20 fields can be selected per request. Each field can be one of the following types: | ||
- A built-in key field. See possible fields in the [properties table](/product/sentry-basics/search/searchable-properties/#properties-table), under any field that is an event property | ||
- example: `field=transaction` | ||
- A tag. Tags should use the `tag[]` formatting to avoid ambiguity with any fields | ||
- example: `field=tag[isEnterprise]` | ||
- A function which will be in the format of `function_name(parameters,...)`. See possible functions in the [query builder documentation](/product/discover-queries/query-builder/#stacking-functions) | ||
- when a function is included, Discover will group by any tags or fields | ||
- example: `field=count_if(transaction.duration,greater,300)` | ||
- An equation when prefixed with `equation|`. Read more about [equations here](https://docs.sentry.io/product/discover-queries/query-builder/query-equations/) | ||
- example: `field=equation|count_if(transaction.duration,greater,300) / count() * 100` | ||
""", | ||
) | ||
SORT = OpenApiParameter( | ||
name="sort", | ||
location="query", | ||
required=False, | ||
type=str, | ||
description="What to order the results of the query by. Must be something in the `field` list, excluding equations.", | ||
) | ||
PER_PAGE = OpenApiParameter( | ||
name="per_page", | ||
location="query", | ||
required=False, | ||
type=int, | ||
description="Limit the number of rows to return in the result. Default and maximum allowed is 100.", | ||
) | ||
|
||
|
||
class CURSOR_QUERY_PARAM(serializers.Serializer): # type: ignore | ||
cursor = serializers.CharField( | ||
help_text="A pointer to the last object fetched and its' sort order; used to retrieve the next or previous results.", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think OpenApiParameter maps to URL parameters, not query parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drf serializers map to query parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, its what the
location
param on the OpenApiParameter is for so you can define whether the parameter is a part of thepath
or thequery
Based on docs you can do header, cookie or form parameters too:
https://drf-spectacular.readthedocs.io/en/latest/drf_yasg.html?highlight=location#parameter-location