Skip to content

Commit

Permalink
Merge branch 'master' into christinarlong/send-alert-event-use-nodestore
Browse files Browse the repository at this point in the history
  • Loading branch information
Christinarlong committed Nov 5, 2024
2 parents 0de3f4b + 41be1f5 commit f71c0fc
Show file tree
Hide file tree
Showing 1,038 changed files with 39,618 additions and 4,500 deletions.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -629,3 +629,7 @@ tests/sentry/api/endpoints/test_organization_dashboard_widget_details.py @ge
/src/sentry/data_secrecy/ @getsentry/core-product-foundations
/tests/sentry/data_secrecy/ @getsentry/core-product-foundations
## End of Core Product Foundations

# Taskworkers
/src/sentry/taskworker/ @getsentry/taskworker
/tests/sentry/taskworker/ @getsentry/taskworker
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"type": "python",
"request": "launch",
"module": "pytest",
"args": ["--verbosity", "2", "${file}"],
"args": ["--verbosity", "2", "${file}", "--reuse-db"],
"django": true,
"env": {
"SENTRY_MODEL_MANIFEST_FILE_PATH": "./model-manifest.json"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"post": {
"tags": ["Integration"],
"description": "Create an external issue from an integration platform integration.",
"operationId": "Create an External Issue",
"description": "Create or update an external issue from an integration platform integration.",
"operationId": "Create or update an External Issue",
"parameters": [
{
"name": "uuid",
Expand Down
55 changes: 55 additions & 0 deletions devservices/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Ignored by docker compose, used by devservices
x-sentry-service-config:
version: 0.1
service_name: sentry
dependencies:
snuba:
description: Service that provides fast aggregation and query capabilities on top of Clickhouse
remote:
repo_name: snuba
branch: master
repo_link: git@github.com:getsentry/snuba.git
mode: containerized
relay:
description: Service event forwarding and ingestion service
remote:
repo_name: relay
branch: master
repo_link: git@github.com:getsentry/relay.git
mode: containerized
postgres:
description: Database used to store Sentry data
modes:
default: [snuba, postgres, relay]

services:
postgres:
image: ghcr.io/getsentry/image-mirror-library-postgres:14-alpine
environment:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_DB: sentry
command:
[
postgres,
-c,
wal_level=logical,
-c,
max_replication_slots=1,
-c,
max_wal_senders=1,
]
networks:
- devservices
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- 5432:5432
extra_hosts:
- host.docker.internal:host-gateway

networks:
devservices:
name: devservices

volumes:
postgres-data:
2 changes: 1 addition & 1 deletion migrations_lockfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ hybridcloud: 0016_add_control_cacheversion
nodestore: 0002_nodestore_no_dictfield
remote_subscriptions: 0003_drop_remote_subscription
replays: 0004_index_together
sentry: 0780_create_sentry_rollback_models
sentry: 0782_align_deletedproject_slug_length
social_auth: 0002_default_auto_field
uptime: 0017_unique_on_timeout
workflow_engine: 0010_detector_state_unique_group
5 changes: 0 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,11 @@ ignore_missing_imports = true
module = [
"sentry.api.base",
"sentry.api.bases.organization_events",
"sentry.api.bases.organization_request_change",
"sentry.api.bases.organizationmember",
"sentry.api.bases.project",
"sentry.api.bases.project_request_change",
"sentry.api.bases.team",
"sentry.api.endpoints.accept_organization_invite",
"sentry.api.endpoints.auth_config",
"sentry.api.endpoints.auth_login",
"sentry.api.endpoints.chunk",
"sentry.api.endpoints.codeowners",
"sentry.api.endpoints.codeowners.index",
"sentry.api.endpoints.event_attachments",
Expand Down Expand Up @@ -248,7 +244,6 @@ module = [
"sentry.integrations.pipeline",
"sentry.integrations.slack.actions.form",
"sentry.integrations.slack.integration",
"sentry.integrations.slack.message_builder.notifications.digest",
"sentry.integrations.slack.message_builder.notifications.issues",
"sentry.integrations.slack.notifications",
"sentry.integrations.slack.unfurl.discover",
Expand Down
6 changes: 3 additions & 3 deletions requirements-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ rfc3986-validator>=0.1.1
sentry-arroyo>=2.16.5
sentry-kafka-schemas>=0.1.116
sentry-ophio==1.0.0
sentry-protos>=0.1.30
sentry-protos>=0.1.32
sentry-redis-tools>=0.1.7
sentry-relay>=0.9.2
sentry-sdk[http2]>=2.17.0
Expand All @@ -86,10 +86,10 @@ typing-extensions>=4.9.0
ua-parser>=0.10.0
unidiff>=0.7.4
urllib3[brotli]>=2.2.2
pyuwsgi==2.0.27.post1
pyuwsgi==2.0.28.post1
zstandard>=0.18.0
sentry-usage-accountant==0.0.10
orjson>=3.10.3
orjson>=3.10.10

msgpack>=1.1
cryptography>=38.0.3
Expand Down
6 changes: 3 additions & 3 deletions requirements-dev-frozen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ openapi-core==0.18.2
openapi-pydantic==0.4.0
openapi-schema-validator==0.6.2
openapi-spec-validator==0.7.1
orjson==3.10.3
orjson==3.10.10
outcome==1.2.0
packaging==24.1
parse==1.19.0
Expand Down Expand Up @@ -160,7 +160,7 @@ python-u2flib-server==5.0.0
python-utils==3.3.3
python3-saml==1.15.0
pyupgrade==3.17.0
pyuwsgi==2.0.27.post1
pyuwsgi==2.0.28.post1
pyvat==1.3.15
pyyaml==6.0.2
rb==1.10.0
Expand All @@ -186,7 +186,7 @@ sentry-forked-django-stubs==5.1.1.post1
sentry-forked-djangorestframework-stubs==3.15.1.post2
sentry-kafka-schemas==0.1.116
sentry-ophio==1.0.0
sentry-protos==0.1.30
sentry-protos==0.1.32
sentry-redis-tools==0.1.7
sentry-relay==0.9.2
sentry-sdk==2.17.0
Expand Down
6 changes: 3 additions & 3 deletions requirements-frozen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ mmh3==4.0.0
msgpack==1.1.0
oauthlib==3.1.0
openai==1.3.5
orjson==3.10.3
orjson==3.10.10
packaging==24.1
parsimonious==0.10.0
petname==2.6
Expand All @@ -107,7 +107,7 @@ python-rapidjson==1.8
python-u2flib-server==5.0.0
python-utils==3.3.3
python3-saml==1.15.0
pyuwsgi==2.0.27.post1
pyuwsgi==2.0.28.post1
pyvat==1.3.15
pyyaml==6.0.2
rb==1.10.0
Expand All @@ -127,7 +127,7 @@ s3transfer==0.10.0
sentry-arroyo==2.16.5
sentry-kafka-schemas==0.1.116
sentry-ophio==1.0.0
sentry-protos==0.1.30
sentry-protos==0.1.32
sentry-redis-tools==0.1.7
sentry-relay==0.9.2
sentry-sdk==2.17.0
Expand Down
1 change: 1 addition & 0 deletions src/sentry/analytics/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
from .missing_members_nudge import * # noqa: F401,F403
from .monitor_mark_failed import * # noqa: F401,F403
from .notifications_settings_updated import * # noqa: F401,F403
from .onboarding_complete import * # noqa: F401,F403
from .onboarding_continuation_sent import * # noqa: F401,F403
from .open_pr_comment import * # noqa: F401,F403
from .org_auth_token_created import * # noqa: F401,F403
Expand Down
5 changes: 1 addition & 4 deletions src/sentry/api/bases/organization_request_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from sentry.api.bases import OrganizationPermission
from sentry.api.bases.organization import OrganizationEndpoint
from sentry.models.organization import Organization


class OrganizationRequestChangeEndpointPermission(OrganizationPermission):
Expand All @@ -13,9 +12,7 @@ class OrganizationRequestChangeEndpointPermission(OrganizationPermission):
"POST": ["org:read"],
}

def is_member_disabled_from_limit(
self, request: Request, organization_or_id: Organization | int
):
def is_member_disabled_from_limit(self, request: Request, organization: object) -> bool:
# disabled members need to be able to make requests
return False

Expand Down
5 changes: 1 addition & 4 deletions src/sentry/api/bases/project_request_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from rest_framework.request import Request

from sentry.api.bases import ProjectEndpoint, ProjectPermission
from sentry.organizations.services.organization import RpcOrganization, RpcUserOrganizationContext


class ProjectRequestChangeEndpointPermission(ProjectPermission):
Expand All @@ -12,9 +11,7 @@ class ProjectRequestChangeEndpointPermission(ProjectPermission):
"POST": ["org:read"],
}

def is_member_disabled_from_limit(
self, request: Request, organization: RpcOrganization | RpcUserOrganizationContext
):
def is_member_disabled_from_limit(self, request: Request, organization: object) -> bool:
# disabled members need to be able to make requests
return False

Expand Down
3 changes: 2 additions & 1 deletion src/sentry/api/endpoints/auth_login.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.http import HttpRequest
from rest_framework.request import Request
from rest_framework.response import Response

Expand All @@ -23,7 +24,7 @@ class AuthLoginEndpoint(Endpoint, OrganizationMixin):
# Disable authentication and permission requirements.
permission_classes = ()

def dispatch(self, request: Request, *args, **kwargs) -> Response:
def dispatch(self, request: HttpRequest, *args, **kwargs) -> Response:
self.determine_active_organization(request)
return super().dispatch(request, *args, **kwargs)

Expand Down
6 changes: 3 additions & 3 deletions src/sentry/api/endpoints/chunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ def post(self, request: Request, organization) -> Response:
logger.info("chunkupload.start")

files = []
if request.data:
files = request.data.getlist("file")
files += [GzipChunk(chunk) for chunk in request.data.getlist("file_gzip")]
if request.FILES:
files = request.FILES.getlist("file")
files += [GzipChunk(chunk) for chunk in request.FILES.getlist("file_gzip")]

if len(files) == 0:
# No files uploaded is ok
Expand Down
17 changes: 7 additions & 10 deletions src/sentry/api/endpoints/organization_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
REQUIRE_SCRUB_DATA_DEFAULT,
REQUIRE_SCRUB_DEFAULTS_DEFAULT,
REQUIRE_SCRUB_IP_ADDRESS_DEFAULT,
ROLLBACK_ENABLED_DEFAULT,
SAFE_FIELDS_DEFAULT,
SAMPLING_MODE_DEFAULT,
SCRAPE_JAVASCRIPT_DEFAULT,
Expand All @@ -71,6 +72,7 @@
boost_low_volume_projects_of_org_with_query,
)
from sentry.dynamic_sampling.types import DynamicSamplingMode
from sentry.dynamic_sampling.utils import has_custom_dynamic_sampling
from sentry.hybridcloud.rpc import IDEMPOTENCY_KEY_LENGTH
from sentry.integrations.utils.codecov import has_codecov_integration
from sentry.lang.native.utils import (
Expand Down Expand Up @@ -220,6 +222,7 @@
("uptimeAutodetection", "sentry:uptime_autodetection", bool, UPTIME_AUTODETECTION),
("targetSampleRate", "sentry:target_sample_rate", float, TARGET_SAMPLE_RATE_DEFAULT),
("samplingMode", "sentry:sampling_mode", str, SAMPLING_MODE_DEFAULT),
("rollbackEnabled", "sentry:rollback_enabled", bool, ROLLBACK_ENABLED_DEFAULT),
)

DELETION_STATUSES = frozenset(
Expand Down Expand Up @@ -281,6 +284,8 @@ class OrganizationSerializer(BaseOrganizationSerializer):
uptimeAutodetection = serializers.BooleanField(required=False)
targetSampleRate = serializers.FloatField(required=False, min_value=0, max_value=1)
samplingMode = serializers.ChoiceField(choices=DynamicSamplingMode.choices, required=False)
rollbackEnabled = serializers.BooleanField(required=False)
rollbackSharingEnabled = serializers.BooleanField(required=False)

@cached_property
def _has_legacy_rate_limits(self):
Expand Down Expand Up @@ -371,13 +376,9 @@ def validate_projectRateLimit(self, value):
return value

def validate_targetSampleRate(self, value):
from sentry import features

organization = self.context["organization"]
request = self.context["request"]
has_dynamic_sampling_custom = features.has(
"organizations:dynamic-sampling-custom", organization, actor=request.user
)
has_dynamic_sampling_custom = has_custom_dynamic_sampling(organization, actor=request.user)
if not has_dynamic_sampling_custom:
raise serializers.ValidationError(
"Organization does not have the custom dynamic sample rate feature enabled."
Expand All @@ -394,13 +395,9 @@ def validate_targetSampleRate(self, value):
return value

def validate_samplingMode(self, value):
from sentry import features

organization = self.context["organization"]
request = self.context["request"]
has_dynamic_sampling_custom = features.has(
"organizations:dynamic-sampling-custom", organization, actor=request.user
)
has_dynamic_sampling_custom = has_custom_dynamic_sampling(organization, actor=request.user)
if not has_dynamic_sampling_custom:
raise serializers.ValidationError(
"Organization does not have the custom dynamic sample rate feature enabled."
Expand Down
6 changes: 3 additions & 3 deletions src/sentry/api/endpoints/organization_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from sentry.api.serializers.models.organization import BaseOrganizationSerializer
from sentry.api.serializers.types import OrganizationSerializerResponse
from sentry.apidocs.constants import RESPONSE_FORBIDDEN, RESPONSE_NOT_FOUND, RESPONSE_UNAUTHORIZED
from sentry.apidocs.examples.organization_examples import OrganizationExamples
from sentry.apidocs.examples.user_examples import UserExamples
from sentry.apidocs.parameters import CursorQueryParam, OrganizationParams
from sentry.apidocs.utils import inline_sentry_response_serializer
from sentry.auth.superuser import is_active_superuser
Expand Down Expand Up @@ -55,7 +55,7 @@ def validate_agreeTerms(self, value):
return value


@extend_schema(tags=["Organizations"])
@extend_schema(tags=["Users"])
@region_silo_endpoint
class OrganizationIndexEndpoint(Endpoint):
publish_status = {
Expand All @@ -81,7 +81,7 @@ class OrganizationIndexEndpoint(Endpoint):
403: RESPONSE_FORBIDDEN,
404: RESPONSE_NOT_FOUND,
},
examples=OrganizationExamples.LIST_ORGANIZATIONS,
examples=UserExamples.LIST_ORGANIZATIONS,
)
def get(self, request: Request) -> Response:
"""
Expand Down
4 changes: 2 additions & 2 deletions src/sentry/api/endpoints/organization_recent_searches.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class OrganizationRecentSearchPermission(OrganizationPermission):
class OrganizationRecentSearchesEndpoint(OrganizationEndpoint):
owner = ApiOwner.UNOWNED
publish_status = {
"GET": ApiPublishStatus.UNKNOWN,
"POST": ApiPublishStatus.UNKNOWN,
"GET": ApiPublishStatus.PRIVATE,
"POST": ApiPublishStatus.PRIVATE,
}
permission_classes = (OrganizationRecentSearchPermission,)

Expand Down
Loading

0 comments on commit f71c0fc

Please sign in to comment.