Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into remove-kafka-topics
Browse files Browse the repository at this point in the history
  • Loading branch information
lynnagara committed Mar 6, 2024
2 parents 93c62ea + 6aa0fd7 commit c749483
Show file tree
Hide file tree
Showing 407 changed files with 5,318 additions and 3,362 deletions.
18 changes: 18 additions & 0 deletions fixtures/backup/model_dependencies/detailed.json
Original file line number Diff line number Diff line change
Expand Up @@ -3237,6 +3237,24 @@
]
]
},
"sentry.monitorenvbrokendetection": {
"dangling": false,
"foreign_keys": {
"monitor_incident": {
"kind": "FlexibleForeignKey",
"model": "sentry.monitorincident",
"nullable": false
}
},
"model": "sentry.monitorenvbrokendetection",
"relocation_dependencies": [],
"relocation_scope": "Excluded",
"silos": [
"Region"
],
"table_name": "sentry_monitorenvbrokendetection",
"uniques": []
},
"sentry.monitorenvironment": {
"dangling": false,
"foreign_keys": {
Expand Down
3 changes: 3 additions & 0 deletions fixtures/backup/model_dependencies/flat.json
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,9 @@
"sentry.monitorlocation",
"sentry.project"
],
"sentry.monitorenvbrokendetection": [
"sentry.monitorincident"
],
"sentry.monitorenvironment": [
"sentry.environment",
"sentry.monitor"
Expand Down
1 change: 1 addition & 0 deletions fixtures/backup/model_dependencies/sorted.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@
"sentry.organizationmemberteamreplica",
"sentry.notificationactionproject",
"sentry.monitorincident",
"sentry.monitorenvbrokendetection",
"sentry.incident",
"sentry.dashboardwidgetquery",
"sentry.alertruletrigger",
Expand Down
1 change: 1 addition & 0 deletions fixtures/backup/model_dependencies/truncate.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@
"sentry_organizationmember_teamsreplica",
"sentry_notificationactionproject",
"sentry_monitorincident",
"sentry_monitorenvbrokendetection",
"sentry_incident",
"sentry_dashboardwidgetquery",
"sentry_alertruletrigger",
Expand Down
1 change: 1 addition & 0 deletions fixtures/js-stubs/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function GroupFixture(params: Partial<Group> = {}): Group {
pluginContexts: [],
pluginIssues: [],
priority: PriorityLevel.MEDIUM,
priorityLockedAt: null,
project: ProjectFixture({
platform: 'javascript',
}),
Expand Down
2 changes: 1 addition & 1 deletion migrations_lockfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ feedback: 0004_index_together
hybridcloud: 0013_add_orgauthtokenreplica_token_index
nodestore: 0002_nodestore_no_dictfield
replays: 0004_index_together
sentry: 0661_artifactbundleindex_cleanup_step2
sentry: 0666_monitor_incident_default_grouphash
social_auth: 0002_default_auto_field
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@
"@sentry-internal/rrweb-player": "2.9.0",
"@sentry-internal/rrweb-snapshot": "2.9.0",
"@sentry/babel-plugin-component-annotate": "^2.14.0",
"@sentry/core": "7.103.0",
"@sentry/integrations": "7.103.0",
"@sentry/node": "7.103.0",
"@sentry/react": "7.103.0",
"@sentry/core": "^7.105.0",
"@sentry/integrations": "^7.105.0",
"@sentry/node": "^7.105.0",
"@sentry/react": "^7.105.0",
"@sentry/release-parser": "^1.3.1",
"@sentry/types": "7.103.0",
"@sentry/utils": "7.103.0",
"@sentry/types": "^7.105.0",
"@sentry/utils": "^7.105.0",
"@spotlightjs/spotlight": "^1.2.13",
"@tanstack/react-query": "^4.29.7",
"@types/color": "^3.0.3",
Expand Down
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ module = [
"sentry.incidents.endpoints.organization_incident_comment_details",
"sentry.incidents.endpoints.organization_incident_index",
"sentry.incidents.logic",
"sentry.incidents.models",
"sentry.incidents.subscription_processor",
"sentry.incidents.tasks",
"sentry.integrations.aws_lambda.integration",
Expand Down Expand Up @@ -371,9 +370,7 @@ module = [
"sentry.issues.endpoints.group_events",
"sentry.issues.endpoints.organization_group_index",
"sentry.issues.endpoints.source_map_debug",
"sentry.issues.occurrence_consumer",
"sentry.issues.search",
"sentry.issues.status_change",
"sentry.middleware.access_log",
"sentry.middleware.auth",
"sentry.middleware.ratelimit",
Expand Down
2 changes: 1 addition & 1 deletion requirements-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ sentry-arroyo>=2.16.2
sentry-kafka-schemas>=0.1.58
sentry-ophio==0.1.5
sentry-redis-tools>=0.1.7
sentry-relay>=0.8.45
sentry-relay>=0.8.48
sentry-sdk>=1.39.2
snuba-sdk>=2.0.29
simplejson>=3.17.6
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev-frozen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ sentry-forked-djangorestframework-stubs==3.14.5.post1
sentry-kafka-schemas==0.1.58
sentry-ophio==0.1.5
sentry-redis-tools==0.1.7
sentry-relay==0.8.45
sentry-relay==0.8.48
sentry-sdk==1.39.2
sentry-usage-accountant==0.0.10
simplejson==3.17.6
Expand Down
2 changes: 1 addition & 1 deletion requirements-frozen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ sentry-arroyo==2.16.2
sentry-kafka-schemas==0.1.58
sentry-ophio==0.1.5
sentry-redis-tools==0.1.7
sentry-relay==0.8.45
sentry-relay==0.8.48
sentry-sdk==1.39.2
sentry-usage-accountant==0.0.10
simplejson==3.17.6
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/api/bases/incident.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from sentry import features
from sentry.api.bases.organization import OrganizationEndpoint, OrganizationPermission
from sentry.api.exceptions import ResourceDoesNotExist
from sentry.incidents.models import Incident
from sentry.incidents.models.incident import Incident


class IncidentPermission(OrganizationPermission):
Expand Down
31 changes: 21 additions & 10 deletions src/sentry/api/endpoints/auth_index.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging

from django.conf import settings
from django.contrib.auth import logout
from django.contrib.auth.models import AnonymousUser
from django.utils.http import url_has_allowed_host_and_scheme
Expand Down Expand Up @@ -33,10 +32,6 @@

PREFILLED_SU_MODAL_KEY = "prefilled_su_modal"

DISABLE_SU_FORM_U2F_CHECK_FOR_LOCAL = getattr(
settings, "DISABLE_SU_FORM_U2F_CHECK_FOR_LOCAL", False
)


@control_silo_endpoint
class BaseAuthIndexEndpoint(Endpoint):
Expand Down Expand Up @@ -155,6 +150,15 @@ def _validate_superuser(
SSO and if they do not, we redirect them back to the SSO login.
"""
logger.info(
"auth-index.validate_superuser",
extra={
"validator": validator,
"user": request.user.id,
"raise_exception": not DISABLE_SSO_CHECK_FOR_LOCAL_DEV,
"verify_authenticator": verify_authenticator,
},
)
# Disable exception for missing password or u2f code if we're running locally
validator.is_valid(raise_exception=not DISABLE_SSO_CHECK_FOR_LOCAL_DEV)

Expand Down Expand Up @@ -248,15 +252,13 @@ def put(self, request: Request) -> Response:
id=Superuser.org_id, include_teams=False, include_projects=False
)

verify_authenticator = (
False
if superuser_org is None
else features.has(
if superuser_org is not None:
has_u2f_flag = features.has(
"organizations:u2f-superuser-form",
superuser_org.organization,
actor=request.user,
)
)
verify_authenticator = has_u2f_flag

if verify_authenticator:
if not Authenticator.objects.filter(
Expand All @@ -265,6 +267,15 @@ def put(self, request: Request) -> Response:
return Response(
{"detail": {"code": "no_u2f"}}, status=status.HTTP_403_FORBIDDEN
)
logger.info(
"auth-index.put",
extra={
"organization": superuser_org,
"u2f_flag": has_u2f_flag,
"user": request.user.id,
"verify_authenticator": verify_authenticator,
},
)
try:
authenticated = self._validate_superuser(validator, request, verify_authenticator)
except ValidationError:
Expand Down
8 changes: 7 additions & 1 deletion src/sentry/api/endpoints/chunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from sentry.api.api_publish_status import ApiPublishStatus
from sentry.api.base import region_silo_endpoint
from sentry.api.bases.organization import OrganizationEndpoint, OrganizationReleasePermission
from sentry.api.utils import generate_region_url
from sentry.models.files.fileblob import FileBlob
from sentry.ratelimits.config import RateLimitConfig
from sentry.utils.files import get_max_file_size
Expand Down Expand Up @@ -81,7 +82,12 @@ def get(self, request: Request, organization) -> Response:
url = relative_url.lstrip(API_PREFIX)
# Otherwise, if we do not support them, return an absolute, versioned endpoint with a default, system-wide prefix
else:
url = absolute_uri(relative_url)
# We need to generate region specific upload URLs when possible to avoid hitting the API proxy
# which tends to cause timeouts and performance issues for uploads.
base_url = None
if options.get("hybrid_cloud.use_region_specific_upload_url"):
base_url = generate_region_url()
url = absolute_uri(relative_url, base_url)
else:
# If user overridden upload url prefix, we want an absolute, versioned endpoint, with user-configured prefix
url = absolute_uri(relative_url, endpoint)
Expand Down
2 changes: 0 additions & 2 deletions src/sentry/api/endpoints/organization_events_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from sentry.models.organization import Organization
from sentry.snuba import (
discover,
errors,
functions,
metrics_enhanced_performance,
metrics_performance,
Expand Down Expand Up @@ -214,7 +213,6 @@ def get(self, request: Request, organization: Organization) -> Response:
if dataset
in [
discover,
errors,
functions,
metrics_performance,
metrics_enhanced_performance,
Expand Down
2 changes: 2 additions & 0 deletions src/sentry/api/endpoints/organization_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ class MetricsSamplesSerializer(serializers.Serializer):
field = serializers.ListField(required=True, allow_empty=False, child=serializers.CharField())
max = serializers.FloatField(required=False)
min = serializers.FloatField(required=False)
operation = serializers.CharField(required=False)
query = serializers.CharField(required=False)
referrer = serializers.CharField(required=False)
sort = serializers.CharField(required=False)
Expand Down Expand Up @@ -532,6 +533,7 @@ def get(self, request: Request, organization: Organization) -> Response:
params,
snuba_params,
serialized["field"],
serialized.get("operation"),
serialized.get("query", ""),
serialized.get("min"),
serialized.get("max"),
Expand Down
37 changes: 19 additions & 18 deletions src/sentry/api/endpoints/organization_profiling_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,25 @@ def get(self, request: Request, organization: Organization) -> Response:
return Response(serializer.errors, status=400)
data = serializer.validated_data

top_functions = functions.query(
selected_columns=[
"project.id",
"fingerprint",
"package",
"function",
"count()",
"examples()",
],
query=data.get("query"),
params=params,
orderby=["-count()"],
limit=TOP_FUNCTIONS_LIMIT,
referrer=Referrer.API_PROFILING_FUNCTION_TRENDS_TOP_EVENTS.value,
auto_aggregations=True,
use_aggregate_conditions=True,
transform_alias_to_input_format=True,
)
with handle_query_errors():
top_functions = functions.query(
selected_columns=[
"project.id",
"fingerprint",
"package",
"function",
"count()",
"examples()",
],
query=data.get("query"),
params=params,
orderby=["-count()"],
limit=TOP_FUNCTIONS_LIMIT,
referrer=Referrer.API_PROFILING_FUNCTION_TRENDS_TOP_EVENTS.value,
auto_aggregations=True,
use_aggregate_conditions=True,
transform_alias_to_input_format=True,
)

def get_event_stats(_columns, query, params, _rollup, zerofill_results, _comparison_delta):
rollup = get_rollup_from_range(params["end"] - params["start"])
Expand Down
6 changes: 3 additions & 3 deletions src/sentry/api/endpoints/project_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,10 +817,10 @@ def put(self, request: Request, project) -> Response:
"sentry:replay_rage_click_issues",
bool(options["sentry:replay_rage_click_issues"]),
)
if "sentry:feedback_user_report_notification" in options:
if "sentry:feedback_user_report_notifications" in options:
project.update_option(
"sentry:feedback_user_report_notification",
bool(options["sentry:feedback_user_report_notification"]),
"sentry:feedback_user_report_notifications",
bool(options["sentry:feedback_user_report_notifications"]),
)
if "sentry:feedback_ai_spam_detection" in options:
project.update_option(
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/api/endpoints/rule_snooze.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from sentry.api.bases.project import ProjectAlertRulePermission, ProjectEndpoint
from sentry.api.serializers import Serializer, register, serialize
from sentry.api.serializers.rest_framework.base import CamelSnakeSerializer
from sentry.incidents.models import AlertRule
from sentry.incidents.models.alert_rule import AlertRule
from sentry.models.organization import Organization
from sentry.models.organizationmember import OrganizationMember
from sentry.models.rule import Rule
Expand Down
4 changes: 2 additions & 2 deletions src/sentry/api/endpoints/team_alerts_triggered.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
from sentry.api.serializers import serialize
from sentry.api.serializers.models.alert_rule import AlertRuleSerializer
from sentry.api.utils import get_date_range_from_params
from sentry.incidents.models import (
AlertRule,
from sentry.incidents.models.alert_rule import AlertRule
from sentry.incidents.models.incident import (
IncidentActivity,
IncidentActivityType,
IncidentProject,
Expand Down
8 changes: 2 additions & 6 deletions src/sentry/api/endpoints/team_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from rest_framework.request import Request
from rest_framework.response import Response

from sentry import audit_log, features
from sentry import audit_log
from sentry.api.api_owners import ApiOwner
from sentry.api.api_publish_status import ApiPublishStatus
from sentry.api.base import EnvironmentMixin, region_silo_endpoint
Expand Down Expand Up @@ -182,11 +182,7 @@ def post(self, request: Request, team) -> Response:
# XXX: create sample event?

# Turns on some inbound filters by default for new Javascript platform projects
if (
features.has("organizations:default-inbound-filters", team.organization)
and project.platform
and project.platform.startswith("javascript")
):
if project.platform and project.platform.startswith("javascript"):
set_default_inbound_filters(project, team.organization)

self.create_audit_entry(
Expand Down
1 change: 0 additions & 1 deletion src/sentry/api/helpers/group_index/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,6 @@ def update_groups(
acting_user=acting_user,
status_details=result.get("statusDetails", {}),
sender=update_groups,
activity_type=activity_type,
)

# XXX (ahmed): hack to get the activities to work properly on issues page. Not sure of
Expand Down
Loading

0 comments on commit c749483

Please sign in to comment.