Skip to content

Commit 211082d

Browse files
author
Julia Hoge
authored
Merge branch 'master' into julia/user-option
2 parents e43fbc9 + 6ed203e commit 211082d

File tree

157 files changed

+4114
-1891
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+4114
-1891
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
/src/sentry/tagstore/snuba/ @getsentry/owners-snuba
2525
/src/sentry/sentry_metrics/ @getsentry/owners-snuba
2626
/tests/sentry/sentry_metrics/ @getsentry/owners-snuba
27+
/src/sentry/snuba/metrics/ @getsentry/owners-snuba @getsentry/telemetry-experience
28+
/src/sentry/snuba/metrics/query.py @getsentry/owners-snuba @getsentry/telemetry-experience
29+
/src/sentry/search/events/datasets/metrics_layer.py @getsentry/owners-snuba
2730

2831
## Event Ingestion
2932
/src/sentry/attachments/ @getsentry/owners-ingest
@@ -397,13 +400,11 @@ yarn.lock @getsentry/owners-js-de
397400

398401

399402
## Telemetry Experience
400-
/src/sentry/snuba/metrics/ @getsentry/telemetry-experience
401403
/src/sentry/api/endpoints/organization_metrics.py @getsentry/telemetry-experience
402404
/src/sentry/api/endpoints/organization_sessions.py @getsentry/telemetry-experience
403405
/src/sentry/api/endpoints/project_dynamic_sampling.py @getsentry/telemetry-experience
404406
/src/sentry/api/endpoints/organization_dynamic_sampling_sdk_versions.py @getsentry/telemetry-experience
405407
/src/sentry/dynamic_sampling/ @getsentry/telemetry-experience
406-
/src/sentry/snuba/metrics/query.py @getsentry/telemetry-experience
407408
/src/sentry/release_health/metrics_sessions_v2.py @getsentry/telemetry-experience
408409
/tests/sentry/api/endpoints/test_organization_metric_data.py @getsentry/telemetry-experience
409410
/tests/sentry/api/endpoints/test_organization_metric_details.py @getsentry/telemetry-experience

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.env
22
.cache/
3+
.code-workspace
34
.coverage*
45
.DS_Store
56
.venv

fixtures/backup/single-option.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[
2+
{
3+
"model": "sites.site",
4+
"pk": 1,
5+
"fields": {
6+
"domain": "example.com",
7+
"name": "example.com"
8+
}
9+
},
10+
{
11+
"model": "sentry.option",
12+
"pk": 1,
13+
"fields": {
14+
"key": "sentry:latest_version",
15+
"last_updated": "2023-06-22T00:00:00.000Z",
16+
"last_updated_by": "unknown",
17+
"value": "\"23.6.1\""
18+
}
19+
}
20+
]

pyproject.toml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,6 @@ module = [
814814
"sentry.utils.concurrent",
815815
"sentry.utils.distutils.commands.base",
816816
"sentry.utils.distutils.commands.build_assets",
817-
"sentry.utils.email.list_resolver",
818817
"sentry.utils.email.signer",
819818
"sentry.utils.http",
820819
"sentry.utils.locking.backends.migration",
@@ -1059,7 +1058,6 @@ module = [
10591058
"tests.sentry.notifications.test_utils",
10601059
"tests.sentry.notifications.utils.test_tasks",
10611060
"tests.sentry.options.test_store",
1062-
"tests.sentry.ownership.test_grammar",
10631061
"tests.sentry.pipeline.test_pipeline",
10641062
"tests.sentry.plugins.bases.test_issue2",
10651063
"tests.sentry.processing.realtime_metrics.test_redis",
@@ -1083,14 +1081,12 @@ module = [
10831081
"tests.sentry.replays.test_project_replay_recording_segment_index",
10841082
"tests.sentry.replays.unit.test_dead_click_issue",
10851083
"tests.sentry.replays.unit.test_ingest_dom_index",
1086-
"tests.sentry.roles.test_manager",
10871084
"tests.sentry.rules.conditions.test_event_attribute",
10881085
"tests.sentry.rules.conditions.test_level_event",
10891086
"tests.sentry.rules.conditions.test_tagged_event",
10901087
"tests.sentry.rules.filters.test_issue_category",
10911088
"tests.sentry.rules.history.endpoints.test_project_rule_preview",
10921089
"tests.sentry.rules.test_processor",
1093-
"tests.sentry.runner.test_initializer",
10941090
"tests.sentry.search.events.builder.test_discover",
10951091
"tests.sentry.search.events.builder.test_metrics",
10961092
"tests.sentry.search.events.test_fields",
@@ -1109,8 +1105,6 @@ module = [
11091105
"tests.sentry.sentry_metrics.test_multiprocess_steps",
11101106
"tests.sentry.sentry_metrics.test_postgres_indexer",
11111107
"tests.sentry.sentry_metrics.test_strings",
1112-
"tests.sentry.services.test_http",
1113-
"tests.sentry.shared_integrations.client.test_base",
11141108
"tests.sentry.snuba.metrics.test_metrics_layer.test_release_health",
11151109
"tests.sentry.snuba.metrics.test_mqb_query_transformer",
11161110
"tests.sentry.snuba.metrics.test_query_builder",
@@ -1122,7 +1116,6 @@ module = [
11221116
"tests.sentry.snuba.test_profiles",
11231117
"tests.sentry.snuba.test_query_subscription_consumer",
11241118
"tests.sentry.snuba.test_tasks",
1125-
"tests.sentry.spans.grouping.test_strategy",
11261119
"tests.sentry.tagstore.test_types",
11271120
"tests.sentry.tasks.deletion.test_groups",
11281121
"tests.sentry.tasks.deletion.test_scheduled",
@@ -1136,22 +1129,7 @@ module = [
11361129
"tests.sentry.tasks.test_servicehooks",
11371130
"tests.sentry.tasks.test_store",
11381131
"tests.sentry.templatetags.test_sentry_assets",
1139-
"tests.sentry.test_killswitches",
11401132
"tests.sentry.test_stacktraces",
1141-
"tests.sentry.testutils.helpers.test_features",
1142-
"tests.sentry.tsdb.test_redissnuba",
1143-
"tests.sentry.utils.email.test_list_resolver",
1144-
"tests.sentry.utils.locking.backends.test_redis",
1145-
"tests.sentry.utils.suspect_resolutions.test_metric_correlation",
1146-
"tests.sentry.utils.test_audit",
1147-
"tests.sentry.utils.test_cursors",
1148-
"tests.sentry.utils.test_event_frames",
1149-
"tests.sentry.utils.test_functional",
1150-
"tests.sentry.utils.test_meta",
1151-
"tests.sentry.utils.test_outcomes",
1152-
"tests.sentry.utils.test_safe",
1153-
"tests.sentry.utils.test_services",
1154-
"tests.sentry.utils.test_time_window",
11551133
"tests.sentry.web.test_client_config",
11561134
"tests.snuba.rules.conditions.test_event_frequency",
11571135
"tests.snuba.sessions.test_sessions",

src/sentry/api/base.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,18 @@ def __call__(self, decorated_obj: Any) -> Any:
666666

667667

668668
control_silo_endpoint = EndpointSiloLimit(SiloMode.CONTROL)
669+
"""
670+
Apply to endpoints that exist in CONTROL silo.
671+
If a request is received and the application is not in CONTROL
672+
mode 404s will be returned.
673+
"""
674+
669675
region_silo_endpoint = EndpointSiloLimit(SiloMode.REGION)
676+
"""
677+
Apply to endpoints that exist in REGION silo.
678+
If a request is received and the application is not in REGION
679+
mode 404s will be returned.
680+
"""
670681

671682
# Use this decorator to mark endpoints that still need to be marked as either
672683
# control_silo_endpoint or region_silo_endpoint. Marking a class with
@@ -675,5 +686,10 @@ def __call__(self, decorated_obj: Any) -> Any:
675686
# Eventually we should replace all instances of this decorator and delete it.
676687
pending_silo_endpoint = EndpointSiloLimit()
677688

678-
# This should be rarely used, but this should be used for any endpoints that exist in any silo mode.
689+
679690
all_silo_endpoint = EndpointSiloLimit(SiloMode.CONTROL, SiloMode.REGION, SiloMode.MONOLITH)
691+
"""
692+
Apply to endpoints that are available in all silo modes.
693+
694+
This should be rarely used, but is relevant for resources like ROBOTS.txt.
695+
"""

src/sentry/api/helpers/group_index/update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def get_current_release_version_of_group(
173173

174174
def update_groups(
175175
request: Request,
176-
group_ids: Sequence[Group],
176+
group_ids: Sequence[int],
177177
projects: Sequence[Project],
178178
organization_id: int,
179179
search_fn: SearchFunction | None,

src/sentry/auth/providers/saml2/generic/views.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
process_metadata,
1111
)
1212
from sentry.auth.view import AuthView, ConfigureView
13+
from sentry.services.hybrid_cloud.auth import RpcAuthProvider, auth_service
14+
from sentry.services.hybrid_cloud.organization.model import RpcOrganization
1315
from sentry.utils.http import absolute_uri
1416

1517

1618
class SAML2ConfigureView(ConfigureView):
17-
def dispatch(self, request: Request, organization, provider):
19+
def dispatch(self, request: Request, organization: RpcOrganization, provider: RpcAuthProvider):
1820
sp_metadata_url = absolute_uri(
1921
reverse("sentry-auth-organization-saml-metadata", args=[organization.slug])
2022
)
@@ -25,11 +27,14 @@ def dispatch(self, request: Request, organization, provider):
2527
else:
2628
saml_form = SAMLForm(request.POST)
2729
attr_mapping_form = AttributeMappingForm(request.POST)
28-
2930
if saml_form.is_valid() and attr_mapping_form.is_valid():
3031
provider.config["idp"] = saml_form.cleaned_data
3132
provider.config["attribute_mapping"] = attr_mapping_form.cleaned_data
32-
provider.save()
33+
auth_service.update_provider_config(
34+
organization_id=organization.id,
35+
auth_provider_id=provider.id,
36+
config=provider.config,
37+
)
3338

3439
return self.render(
3540
"sentry_auth_saml2/configure.html",

src/sentry/backup/comparators.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ def existence(self, on: InstanceID, left: JSONData, right: JSONData) -> list[Com
5555
if f not in left["fields"]:
5656
findings.append(
5757
ComparatorFinding(
58-
kind=self.get_kind(),
58+
kind="Unexecuted" + self.get_kind(),
5959
on=on,
60-
reason=f"the left {f} value on `{on}` was missing",
60+
reason=f"the left `{f}` value was missing",
6161
)
6262
)
6363
if f not in right["fields"]:
6464
findings.append(
6565
ComparatorFinding(
66-
kind=self.get_kind(),
66+
kind="Unexecuted" + self.get_kind(),
6767
on=on,
68-
reason=f"the right {f} value on `{on}` was missing",
68+
reason=f"the right `{f}` value was missing",
6969
)
7070
)
7171
return findings
@@ -214,11 +214,12 @@ class HashObfuscatingComparator(ObfuscatingComparator):
214214
def truncate(self, data: list[str]) -> list[str]:
215215
truncated = []
216216
for d in data:
217-
if len(d) >= 16:
217+
length = len(d)
218+
if length >= 16:
218219
truncated.append(f"{d[:3]}...{d[-3:]}")
219-
elif len(d) >= 8:
220+
elif length >= 8:
220221
truncated.append(f"{d[:1]}...{d[-1:]}")
221-
elif len(d):
222+
else:
222223
truncated.append("...")
223224
return truncated
224225

src/sentry/backup/findings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ def __init__(self, findings: list[ComparatorFinding]):
3535
def append(self, finding: ComparatorFinding) -> None:
3636
self.findings.append(finding)
3737

38+
def empty(self) -> bool:
39+
return not self.findings
40+
3841
def extend(self, findings: list[ComparatorFinding]) -> None:
3942
self.findings += findings
4043

src/sentry/backup/validate.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,38 @@ def json_lines(obj: JSONData) -> list[str]:
2929
findings = ComparatorFindings([])
3030
exp_models = {}
3131
act_models = {}
32-
for model in expect:
33-
id = InstanceID(model["model"], model["pk"])
34-
exp_models[id] = model
3532

3633
# Because we may be scrubbing data from the objects as we compare them, we may (optionally) make
3734
# deep copies to start to avoid potentially mangling the input data.
3835
expect = deepcopy(expect)
3936
actual = deepcopy(actual)
4037

41-
# Ensure that the actual JSON contains no duplicates - we assume that the expected JSON did not.
38+
# Ensure that the actual JSON contains no duplicates.
39+
exp_dupes = set()
40+
for model in expect:
41+
id = InstanceID(model["model"], model["pk"])
42+
if id in exp_models and id not in exp_dupes:
43+
findings.append(
44+
ComparatorFinding("DuplicateEntry", id, "Duplicate entry in expected output")
45+
)
46+
exp_dupes.add(id)
47+
else:
48+
exp_models[id] = model
49+
act_dupes = set()
4250
for model in actual:
4351
id = InstanceID(model["model"], model["pk"])
44-
if id in act_models:
45-
findings.append(ComparatorFinding("DuplicateEntry", id))
52+
if id in act_models and id not in act_dupes:
53+
findings.append(
54+
ComparatorFinding("DuplicateEntry", id, "Duplicate entry in actual output")
55+
)
56+
act_dupes.add(id)
4657
else:
4758
act_models[id] = model
4859

60+
# If there are duplicate entries, something is seriously wrong, so abort ASAP.
61+
if not findings.empty():
62+
return findings
63+
4964
# Report unexpected and missing entries in the actual JSON.
5065
extra = sorted(act_models.keys() - exp_models.keys())
5166
missing = sorted(exp_models.keys() - act_models.keys())

src/sentry/conf/server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ def SOCIAL_AUTH_DEFAULT_USERNAME() -> str:
11101110
},
11111111
"github_comment_reactions": {
11121112
"task": "sentry.tasks.integrations.github_comment_reactions",
1113-
"schedule": crontab(hour=16), # 9:00 PDT, 12:00 EDT, 16:00 UTC
1113+
"schedule": crontab(minute=0, hour=16), # 9:00 PDT, 12:00 EDT, 16:00 UTC
11141114
},
11151115
"poll_recap_servers": {
11161116
"task": "sentry.tasks.poll_recap_servers",
@@ -1500,6 +1500,8 @@ def SOCIAL_AUTH_DEFAULT_USERNAME() -> str:
15001500
"organizations:issue-details-most-helpful-event-ui": False,
15011501
# Display if a release is using semver when resolving issues
15021502
"organizations:issue-release-semver": False,
1503+
# Display a prompt to setup releases in the resolve options dropdown
1504+
"organizations:issue-resolve-release-setup": False,
15031505
# Adds the ttid & ttfd vitals to the frontend
15041506
"organizations:mobile-vitals": False,
15051507
# Display CPU and memory metrics in transactions with profiles
@@ -1671,8 +1673,6 @@ def SOCIAL_AUTH_DEFAULT_USERNAME() -> str:
16711673
"organizations:org-auth-tokens": False,
16721674
# Enable detecting SDK crashes during event processing
16731675
"organizations:sdk-crash-detection": False,
1674-
# Enables commenting on PRs from the Sentry comment bot.
1675-
"organizations:pr-comment-bot": True,
16761676
# Enables slack channel lookup via schedule message
16771677
"organizations:slack-use-new-lookup": False,
16781678
# Enable functionality for recap server polling.

src/sentry/db/models/base.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,13 @@ def __call__(self, model_class: Type[ModelClass]) -> Type[ModelClass]:
231231

232232

233233
control_silo_only_model = ModelSiloLimit(SiloMode.CONTROL)
234+
"""
235+
Apply to models that are shared by multiple organizations or
236+
require strong consistency with other Control silo resources.
237+
"""
238+
234239
region_silo_only_model = ModelSiloLimit(SiloMode.REGION)
240+
"""
241+
Apply to models that belong to a single organization or
242+
require strong consistency with other Region silo resources.
243+
"""

src/sentry/features/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
default_manager.add("organizations:issue-details-stacktrace-improvements", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
9696
default_manager.add("organizations:issue-platform", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
9797
default_manager.add("organizations:issue-release-semver", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
98+
default_manager.add("organizations:issue-resolve-release-setup", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
9899
default_manager.add("organizations:issue-search-allow-postgres-only-search", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
99100
default_manager.add("organizations:issue-search-use-cdc-primary", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
100101
default_manager.add("organizations:issue-search-use-cdc-secondary", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
@@ -258,7 +259,6 @@
258259
default_manager.add("organizations:codecov-commit-sha-from-git-blame", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
259260
default_manager.add("organizations:ds-sliding-window", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
260261
default_manager.add("organizations:ds-sliding-window-org", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
261-
default_manager.add("organizations:pr-comment-bot", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
262262
default_manager.add("organizations:ds-org-recalibration", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
263263
default_manager.add("organizations:slack-use-new-lookup", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
264264
default_manager.add("organizations:slack-disable-on-broken", OrganizationFeature, FeatureHandlerStrategy.REMOTE)

src/sentry/grouping/variants.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
from __future__ import annotations
2+
13
from sentry.grouping.utils import hash_from_values, is_default_fingerprint_var
24

35

46
class BaseVariant:
57
# The type of the variant that is reported to the UI.
6-
type: str
8+
type: str | None = None
79

810
# This is true if `get_hash` does not return `None`.
911
contributes = True
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
from sentry.rules import rules
2+
3+
from .actions import * # noqa: F401,F403
4+
from .actions import DiscordNotifyServiceAction
5+
from .client import * # noqa: F401,F403
16
from .commands import * # noqa: F401,F403
27
from .integration import * # noqa: F401,F403
8+
from .message_builder.base import * # noqa: F401,F403
9+
from .message_builder.issues import * # noqa: F401,F403
310
from .urls import * # noqa: F401,F403
411
from .utils import * # noqa: F401,F403
512
from .views import * # noqa: F401,F403
13+
14+
rules.add(DiscordNotifyServiceAction) # type: ignore
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from .form import * # noqa: F401, F403
2+
from .notification import * # noqa: F401, F403

0 commit comments

Comments
 (0)