From e7652a7d9bdaf64a66383999d748c398c60d0ae7 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Thu, 5 Dec 2019 15:22:43 -0500 Subject: [PATCH 1/4] feat(discover2) Add public fields to discover for tracing I've not added the new fields to the query builder as I don't think they are that useful to end user result sets. I've opted to go with the `trace` prefix as that matches the tags we're currently generating and the name of the context in the raw event payloads. --- src/sentry/snuba/events.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/sentry/snuba/events.py b/src/sentry/snuba/events.py index dbaef1f15489bd..3765078991aeb7 100644 --- a/src/sentry/snuba/events.py +++ b/src/sentry/snuba/events.py @@ -209,6 +209,28 @@ class Columns(Enum): TRANSACTION_STATUS = Column( None, None, "transaction_status", "transaction_status", "transaction.status" ) + # Tracing context fields. + TRACE_ID = Column( + "events.contexts[trace.trace_id]", + "contexts[trace.trace_id]", + "trace_id", + "contexts[trace.trace_id]", + "trace", + ) + SPAN_ID = Column( + "events.contexts[trace.span_id]", + "contexts[trace.span_id]", + "span_id", + "contexts[trace.span_id]", + "trace.span", + ) + PARENT_SPAN_ID = Column( + None, + None, + "contexts[trace.parent_span_id]", + "contexts[trace.parent_span_id]", + "trace.parent_span", + ) def get_columns_from_aliases(aliases): From 5dc6a37293ef8b8fe71223e8d4e247d42f4e3924 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Thu, 5 Dec 2019 16:07:45 -0500 Subject: [PATCH 2/4] See if not waiting on the title makes this test more stable. --- tests/acceptance/test_create_project.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/acceptance/test_create_project.py b/tests/acceptance/test_create_project.py index 65c41bbcfd3476..1df715f0eee8ab 100644 --- a/tests/acceptance/test_create_project.py +++ b/tests/acceptance/test_create_project.py @@ -23,7 +23,6 @@ def test_simple(self): self.browser.snapshot(name="create project") self.browser.click('[data-test-id="create-project"]') - self.browser.wait_until(title="java") self.browser.wait_until_not(".loading") project = Project.objects.get(organization=self.org) From 92e5ea3281e90b7a3cda35b9f7ca3c26807402c0 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Thu, 5 Dec 2019 17:20:00 -0500 Subject: [PATCH 3/4] Attempt to stabilize test in another way. --- tests/acceptance/test_create_project.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/test_create_project.py b/tests/acceptance/test_create_project.py index 1df715f0eee8ab..203588b0bbda60 100644 --- a/tests/acceptance/test_create_project.py +++ b/tests/acceptance/test_create_project.py @@ -2,6 +2,7 @@ from sentry.testutils import AcceptanceTestCase from sentry.models import Project +from mock import patch class CreateProjectTest(AcceptanceTestCase): @@ -13,9 +14,11 @@ def setUp(self): self.path = u"/organizations/{}/projects/new/".format(self.org.slug) - def test_simple(self): + @patch("django.db.models.signals.ModelSignal.send") + def test_simple(self, mock_signal): self.team = self.create_team(organization=self.org, name="Mariachi Band") self.create_member(user=self.user, organization=self.org, role="owner", teams=[self.team]) + self.browser.get(self.path) self.browser.wait_until_not(".loading") @@ -24,6 +27,7 @@ def test_simple(self): self.browser.click('[data-test-id="create-project"]') self.browser.wait_until_not(".loading") + self.browser.wait_until("#installation") project = Project.objects.get(organization=self.org) assert project.name == "Java" From 42bc748d13522e0495c292b02e9720d780492a30 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Fri, 6 Dec 2019 10:05:51 -0500 Subject: [PATCH 4/4] Use contexts for span_id and trace_id as they are uuid/int in snuba and we don't have the right casting in place. --- src/sentry/snuba/events.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sentry/snuba/events.py b/src/sentry/snuba/events.py index 3765078991aeb7..9294001c8f5d10 100644 --- a/src/sentry/snuba/events.py +++ b/src/sentry/snuba/events.py @@ -213,14 +213,14 @@ class Columns(Enum): TRACE_ID = Column( "events.contexts[trace.trace_id]", "contexts[trace.trace_id]", - "trace_id", + "contexts[trace.trace_id]", "contexts[trace.trace_id]", "trace", ) SPAN_ID = Column( "events.contexts[trace.span_id]", "contexts[trace.span_id]", - "span_id", + "contexts[trace.span_id]", "contexts[trace.span_id]", "trace.span", )