Skip to content

Commit 0a33a34

Browse files
committed
make it an overrride
1 parent 5564f9a commit 0a33a34

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

src/sentry/search/eap/columns.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,7 @@ class ResolvedAggregate(ResolvedFunction):
202202
# The internal rpc alias for this column
203203
internal_name: Function.ValueType
204204
# Whether to enable extrapolation
205-
extrapolation_mode: ExtrapolationMode.ValueType = (
206-
ExtrapolationMode.EXTRAPOLATION_MODE_SAMPLE_WEIGHTED
207-
)
205+
extrapolation_mode_override: ExtrapolationMode.ValueType | None = None
208206
is_aggregate: bool = field(default=True, init=False)
209207
# Only for aggregates, we only support functions with 1 argument right now
210208
argument: AttributeKey | None = None
@@ -225,9 +223,7 @@ class ResolvedConditionalAggregate(ResolvedFunction):
225223
# The internal rpc alias for this column
226224
internal_name: Function.ValueType
227225
# Whether to enable extrapolation
228-
extrapolation_mode: ExtrapolationMode.ValueType = (
229-
ExtrapolationMode.EXTRAPOLATION_MODE_SAMPLE_WEIGHTED
230-
)
226+
extrapolation_mode_override: ExtrapolationMode.ValueType | None = None
231227
# The condition to filter on
232228
filter: TraceItemFilter
233229
# The attribute to conditionally aggregate on
@@ -277,9 +273,7 @@ class FunctionDefinition:
277273
# The internal rpc type for this function, optional as it can mostly be inferred from search_type
278274
internal_type: AttributeKey.Type.ValueType | None = None
279275
# Whether to request extrapolation or not, should be true for all functions except for _sample functions for debugging
280-
extrapolation_mode: ExtrapolationMode.ValueType = (
281-
ExtrapolationMode.EXTRAPOLATION_MODE_SAMPLE_WEIGHTED
282-
)
276+
extrapolation_mode_override: ExtrapolationMode.ValueType | None = None
283277
# Processor is the function run in the post process step to transform a row into the final result
284278
processor: Callable[[Any], Any] | None = None
285279
# if a function is private, assume it can't be used unless it's provided in `SearchResolverConfig.functions_acl`
@@ -341,7 +335,9 @@ def resolve(
341335
search_type=search_type,
342336
internal_type=self.internal_type,
343337
processor=self.processor,
344-
extrapolation_mode=resolve_extrapolation_mode(search_config, self.extrapolation_mode),
338+
extrapolation_mode=resolve_extrapolation_mode(
339+
search_config, self.extrapolation_mode_override
340+
),
345341
argument=resolved_attribute,
346342
)
347343

@@ -404,7 +400,9 @@ def resolve(
404400
search_type=search_type,
405401
internal_type=self.internal_type,
406402
processor=self.processor,
407-
extrapolation_mode=resolve_extrapolation_mode(search_config, self.extrapolation_mode),
403+
extrapolation_mode=resolve_extrapolation_mode(
404+
search_config, self.extrapolation_mode_override
405+
),
408406
argument=resolved_attribute,
409407
)
410408

@@ -441,7 +439,9 @@ def resolve(
441439
filter=aggregate_filter,
442440
key=key,
443441
processor=self.processor,
444-
extrapolation_mode=resolve_extrapolation_mode(search_config, self.extrapolation_mode),
442+
extrapolation_mode=resolve_extrapolation_mode(
443+
search_config, self.extrapolation_mode_override
444+
),
445445
)
446446

447447

@@ -467,7 +467,9 @@ def resolve(
467467
search_config: SearchResolverConfig,
468468
) -> ResolvedFormula:
469469
resolver_settings = ResolverSettings(
470-
extrapolation_mode=resolve_extrapolation_mode(search_config, self.extrapolation_mode),
470+
extrapolation_mode=resolve_extrapolation_mode(
471+
search_config, self.extrapolation_mode_override
472+
),
471473
snuba_params=snuba_params,
472474
query_result_cache=query_result_cache,
473475
search_config=search_config,

src/sentry/search/eap/spans/aggregates.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def resolve_bounded_sample(args: ResolvedArguments) -> tuple[AttributeKey, Trace
452452
],
453453
aggregate_resolver=resolve_bounded_sample,
454454
processor=lambda x: x > 0,
455-
extrapolation_mode=ExtrapolationMode.EXTRAPOLATION_MODE_NONE,
455+
extrapolation_mode_override=ExtrapolationMode.EXTRAPOLATION_MODE_NONE,
456456
),
457457
}
458458

@@ -509,7 +509,7 @@ def resolve_bounded_sample(args: ResolvedArguments) -> tuple[AttributeKey, Trace
509509
default_arg="span.duration",
510510
)
511511
],
512-
extrapolation_mode=ExtrapolationMode.EXTRAPOLATION_MODE_NONE,
512+
extrapolation_mode_override=ExtrapolationMode.EXTRAPOLATION_MODE_NONE,
513513
),
514514
"count": AggregateDefinition(
515515
internal_function=Function.FUNCTION_COUNT,
@@ -550,7 +550,7 @@ def resolve_bounded_sample(args: ResolvedArguments) -> tuple[AttributeKey, Trace
550550
default_arg="span.duration",
551551
)
552552
],
553-
extrapolation_mode=ExtrapolationMode.EXTRAPOLATION_MODE_NONE,
553+
extrapolation_mode_override=ExtrapolationMode.EXTRAPOLATION_MODE_NONE,
554554
),
555555
"p50": AggregateDefinition(
556556
internal_function=Function.FUNCTION_P50,
@@ -586,7 +586,7 @@ def resolve_bounded_sample(args: ResolvedArguments) -> tuple[AttributeKey, Trace
586586
default_arg="span.duration",
587587
)
588588
],
589-
extrapolation_mode=ExtrapolationMode.EXTRAPOLATION_MODE_NONE,
589+
extrapolation_mode_override=ExtrapolationMode.EXTRAPOLATION_MODE_NONE,
590590
),
591591
"p75": AggregateDefinition(
592592
internal_function=Function.FUNCTION_P75,

0 commit comments

Comments
 (0)