Skip to content
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

fix(eap): Add test for explore homepage #81206

Merged
merged 1 commit into from
Nov 22, 2024
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
5 changes: 5 additions & 0 deletions src/sentry/search/eap/columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@ def simple_measurements_field(field) -> ResolvedColumn:
internal_name="sentry.segment_name",
search_type="string",
),
ResolvedColumn(
public_alias="transaction.span_id",
internal_name="sentry.segment_id",
search_type="string",
),
ResolvedColumn(
public_alias="replay.id",
internal_name="sentry.replay_id",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import uuid
from datetime import datetime
from unittest import mock

import pytest
Expand Down Expand Up @@ -754,7 +755,6 @@ def test_orderby_alias(self):
"dataset": self.dataset,
}
)

assert response.status_code == 200, response.content
data = response.data["data"]
meta = response.data["meta"]
Expand All @@ -771,6 +771,58 @@ def test_orderby_alias(self):
]
assert meta["dataset"] == self.dataset

@pytest.mark.querybuilder
def test_explore_sample_query(self):
spans = [
self.create_span(
{"description": "foo", "sentry_tags": {"status": "success"}},
start_ts=self.ten_mins_ago,
),
self.create_span(
{"description": "bar", "sentry_tags": {"status": "invalid_argument"}},
start_ts=self.nine_mins_ago,
),
]
self.store_spans(
spans,
is_eap=self.is_eap,
)
response = self.do_request(
{
"field": [
"id",
"project",
"span.op",
"span.description",
"span.duration",
"timestamp",
"trace",
"transaction.span_id",
],
# This is to skip INP spans
"query": "!transaction.span_id:00",
"orderby": "timestamp",
"statsPeriod": "1h",
"project": self.project.id,
"dataset": self.dataset,
}
)
assert response.status_code == 200, response.content
data = response.data["data"]
meta = response.data["meta"]
assert len(data) == 2
for source, result in zip(spans, data):
assert result["id"] == source["span_id"], "id"
assert result["span.duration"] == 1000.0, "duration"
assert result["span.op"] == "", "op"
assert result["span.description"] == source["description"], "description"
assert datetime.fromisoformat(result["timestamp"]).timestamp() == pytest.approx(
source["end_timestamp_precise"], abs=5
), "timestamp"
assert result["transaction.span_id"] == source["segment_id"], "transaction.span_id"
assert result["project"] == result["project.name"] == self.project.slug, "project"
assert meta["dataset"] == self.dataset

def test_span_status(self):
self.store_spans(
[
Expand Down
Loading