Skip to content

Commit

Permalink
No need for epm tag spec + typing change
Browse files Browse the repository at this point in the history
  • Loading branch information
armenzg committed Sep 25, 2023
1 parent 7b195f4 commit ba4b7a6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 2 additions & 6 deletions src/sentry/snuba/metrics/extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,16 +624,12 @@ def apdex_tag_spec(project: Project, argument: Optional[str]) -> List[TagSpec]:
]


def epm_tag_spec(_1: Project, _2: Optional[str]) -> List[TagSpec]:
return []


# This is used to map a metric to a function which generates a specification
_DERIVED_METRICS: Dict[MetricOperationType, TagsSpecsGenerator] = {
_DERIVED_METRICS: Dict[MetricOperationType, TagsSpecsGenerator | None] = {
"on_demand_failure_count": failure_tag_spec,
"on_demand_failure_rate": failure_tag_spec,
"on_demand_apdex": apdex_tag_spec,
"on_demand_epm": epm_tag_spec,
"on_demand_epm": None,
}


Expand Down
7 changes: 6 additions & 1 deletion src/sentry/snuba/metrics/fields/snql.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,12 @@ def histogram_snql_factory(
)


def rate_snql_factory(aggregate_filter, numerator, denominator=1.0, alias=None):
def rate_snql_factory(
aggregate_filter: Function,
numerator: float,
denominator: float = 1.0,
alias: Optional[str] = None,
):
return Function(
"divide",
[
Expand Down
3 changes: 1 addition & 2 deletions tests/sentry/snuba/test_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
OnDemandMetricSpec,
apdex_tag_spec,
cleanup_query,
epm_tag_spec,
failure_tag_spec,
query_tokens_to_string,
should_use_on_demand_metrics,
Expand Down Expand Up @@ -341,7 +340,7 @@ def test_spec_epm(default_project):
assert spec.field_to_extract is None
assert spec.op == "on_demand_epm"
assert spec.condition == {"name": "event.duration", "op": "gt", "value": 1000.0}
assert spec.tags_conditions(default_project) == epm_tag_spec(default_project, "not_used")
assert spec.tags_conditions(default_project) == []


def test_cleanup_equivalent_specs():
Expand Down

0 comments on commit ba4b7a6

Please sign in to comment.