Skip to content
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
1 change: 1 addition & 0 deletions src/sentry/search/eap/spans/aggregates.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def resolve_bounded_sample(args: ResolvedArguments) -> tuple[AttributeKey, Trace
"string",
"duration",
"number",
"integer",
"percentage",
"currency",
"boolean",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6247,6 +6247,51 @@ def test_count_if_numeric_raises_invalid_search_query_with_bad_value(self) -> No
assert response.status_code == 400, response.content
assert "Invalid Parameter " in response.data["detail"].title()

def test_count_if_integer(self) -> None:
self.store_spans(
[
self.create_span(
{"description": "foo"},
measurements={"gen_ai.usage.total_tokens": {"value": 100}},
start_ts=self.ten_mins_ago,
duration=400,
),
self.create_span(
{"description": "bar"},
measurements={"gen_ai.usage.total_tokens": {"value": 200}},
start_ts=self.ten_mins_ago,
duration=400,
),
self.create_span(
{"description": "baz"},
measurements={"gen_ai.usage.total_tokens": {"value": 300}},
start_ts=self.ten_mins_ago,
duration=200,
),
],
is_eap=True,
)
response = self.do_request(
{
"field": ["count_if(gen_ai.usage.total_tokens,greater,200)"],
"query": "",
"orderby": "count_if(gen_ai.usage.total_tokens,greater,200)",
"project": self.project.id,
"dataset": "spans",
}
)

assert response.status_code == 200, response.content
data = response.data["data"]
meta = response.data["meta"]
assert len(data) == 1
assert data == [
{
"count_if(gen_ai.usage.total_tokens,greater,200)": 1,
},
]
assert meta["dataset"] == "spans"

def test_apdex_function(self) -> None:
"""Test the apdex function with span.duration and threshold."""
# Create spans with different durations to test apdex calculation
Expand Down
Loading