Skip to content

feat(eap): Default unspecified sampling mode to high accuracy #90704

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 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.21.0
sentry-kafka-schemas>=1.2.0
sentry-ophio>=1.1.3
sentry-protos==0.1.72
sentry-protos==0.1.74
sentry-redis-tools>=0.5.0
sentry-relay>=0.9.8
sentry-sdk[http2]>=2.25.1
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev-frozen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ sentry-forked-djangorestframework-stubs==3.15.3.post1
sentry-forked-email-reply-parser==0.5.12.post1
sentry-kafka-schemas==1.2.0
sentry-ophio==1.1.3
sentry-protos==0.1.72
sentry-protos==0.1.74
sentry-redis-tools==0.5.0
sentry-relay==0.9.8
sentry-sdk==2.27.0
Expand Down
2 changes: 1 addition & 1 deletion requirements-frozen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ sentry-arroyo==2.21.0
sentry-forked-email-reply-parser==0.5.12.post1
sentry-kafka-schemas==1.2.0
sentry-ophio==1.1.3
sentry-protos==0.1.72
sentry-protos==0.1.74
sentry-redis-tools==0.5.0
sentry-relay==0.9.8
sentry-sdk==2.27.0
Expand Down
1 change: 1 addition & 0 deletions src/sentry/search/eap/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,5 @@
"BEST_EFFORT": DownsampledStorageConfig.MODE_BEST_EFFORT,
"PREFLIGHT": DownsampledStorageConfig.MODE_PREFLIGHT,
"NORMAL": DownsampledStorageConfig.MODE_NORMAL,
"HIGHEST_ACCURACY": DownsampledStorageConfig.MODE_HIGHEST_ACCURACY,
}
2 changes: 1 addition & 1 deletion src/sentry/search/eap/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def transform_column_to_expression(column: Column) -> Expression:

def validate_sampling(sampling_mode: SAMPLING_MODES | None) -> DownsampledStorageConfig:
if sampling_mode is None:
return DownsampledStorageConfig(mode=DownsampledStorageConfig.MODE_UNSPECIFIED)
return DownsampledStorageConfig(mode=DownsampledStorageConfig.MODE_HIGHEST_ACCURACY)
if sampling_mode not in SAMPLING_MODE_MAP:
raise InvalidSearchQuery(f"sampling mode: {sampling_mode} is not supported")
else:
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/search/events/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class EventsResponse(TypedDict):
meta: EventsMeta


SAMPLING_MODES = Literal["BEST_EFFORT", "PREFLIGHT", "NORMAL"]
SAMPLING_MODES = Literal["BEST_EFFORT", "PREFLIGHT", "NORMAL", "HIGHEST_ACCURACY"]


@dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2017,3 +2017,32 @@ def test_downsampling_can_go_to_higher_accuracy_tier(self):
)

assert response.data["meta"]["dataScanned"] == "partial"

def test_request_without_sampling_mode_defaults_to_highest_accuracy(self):
response = self._do_request(
data={
"start": self.day_ago,
"end": self.day_ago + timedelta(minutes=3),
"interval": "1m",
"yAxis": "count()",
"project": self.project.id,
"dataset": self.dataset,
},
)

assert response.data["meta"]["dataScanned"] == "full"

def test_request_to_highest_accuracy_mode(self):
response = self._do_request(
data={
"start": self.day_ago,
"end": self.day_ago + timedelta(minutes=3),
"interval": "1m",
"yAxis": "count()",
"project": self.project.id,
"dataset": self.dataset,
"sampling": "HIGHEST_ACCURACY",
},
)

assert response.data["meta"]["dataScanned"] == "full"
Loading