def test_event_processed(self): now = timezone.now() project = self.create_project(first_event=now) event = self.create_full_event() event_processed.send(project=project, event=event, sender=type(project)) task = OrganizationOnboardingTask.objects.get( organization=project.organization, task=OnboardingTask.RELEASE_TRACKING, status=OnboardingTaskStatus.COMPLETE, ) assert task is not None task = OrganizationOnboardingTask.objects.get( organization=project.organization, task=OnboardingTask.USER_CONTEXT, status=OnboardingTaskStatus.COMPLETE, ) assert task is not None task = OrganizationOnboardingTask.objects.get( organization=project.organization, task=OnboardingTask.SOURCEMAPS, status=OnboardingTaskStatus.COMPLETE, ) assert task is not None
def test_csp(self): group = self.create_group(project=self.project, platform="csp", message="csp error message") event = self.create_event(group=group, data={"platform": "csp"}) event_processed.send(project=self.project, event=event, sender=type(self.project)) csp = FeatureAdoption.objects.get_by_slug(organization=self.organization, slug="csp") assert csp.complete
def test_bulk_create(self): event = self.store_event( data={ "platform": "javascript", "environment": "prod", "tags": { "sentry:release": "abc" }, "user": { "id": "123" }, }, project_id=self.project.id, ) event_processed.send(project=self.project, event=event, sender=type(self.project)) javascript = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="javascript") assert javascript environment_tracking = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="environment_tracking") assert environment_tracking release_tracking = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="release_tracking") assert release_tracking feature_complete = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="user_tracking") assert feature_complete
def test_event_processed(self): project = self.create_project(first_event=timezone.now()) event = self.create_full_event() event_processed.send(project=project, group=self.group, event=event, sender=type(project)) task = OrganizationOnboardingTask.objects.get( organization=project.organization, task=OnboardingTask.RELEASE_TRACKING, status=OnboardingTaskStatus.COMPLETE, ) assert task is not None task = OrganizationOnboardingTask.objects.get( organization=project.organization, task=OnboardingTask.USER_CONTEXT, status=OnboardingTaskStatus.COMPLETE, ) assert task is not None task = OrganizationOnboardingTask.objects.get( organization=project.organization, task=OnboardingTask.SOURCEMAPS, status=OnboardingTaskStatus.COMPLETE, ) assert task is not None
def test_breadcrumbs(self): event = self.store_event( data={ "breadcrumbs": { "values": [{ "category": "xhr", "timestamp": 1496395011.63, "type": "http", "data": { "url": "/api/path/here", "status_code": "500", "method": "POST", }, }] } }, project_id=self.project.id, ) event_processed.send(project=self.project, event=event, sender=type(self.project)) breadcrumbs = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="breadcrumbs") assert breadcrumbs
def test_bulk_create(self): group = self.create_group( project=self.project, platform='javascript', message='javascript error message' ) event = self.create_full_event() event_processed.send( project=self.project, group=group, event=event, sender=type(self.project) ) javascript = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="javascript" ) assert javascript environment_tracking = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="environment_tracking" ) assert environment_tracking release_tracking = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="release_tracking" ) assert release_tracking feature_complete = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="user_tracking" ) assert feature_complete
def test_transaction_processed_no_platform(self): self.project.update(platform=None) assert not self.project.platform assert not self.project.flags.has_transactions event = self.store_event( data={ "type": "transaction", "timestamp": self.min_ago, "start_timestamp": self.min_ago, "contexts": { "trace": { "trace_id": "b" * 32, "span_id": "c" * 16, "op": "" } }, }, project_id=self.project.id, ) event_processed.send(project=self.project, event=event, sender=type(self.project)) project = Project.objects.get(id=self.project.id) assert project.flags.has_transactions
def test_analytics_event(self, mock_record): assert not self.project.flags.has_transactions event = self.store_event( data={ "type": "transaction", "timestamp": self.min_ago, "start_timestamp": self.min_ago, "contexts": { "trace": { "trace_id": "b" * 32, "span_id": "c" * 16, "op": "" } }, }, project_id=self.project.id, ) event_processed.send(project=self.project, event=event, sender=type(self.project)) assert self.project.flags.has_transactions mock_record.assert_called_with( "first_transaction.sent", default_user_id=self.user.id, organization_id=self.organization.id, project_id=self.project.id, platform=self.project.platform, )
def test_source_maps(self): event = self.store_event( data={ "platform": "javascript", "exception": { "values": [{ "stacktrace": { "frames": [{ "data": { "sourcemap": "https://media.sentry.io/_static/29e365f8b0d923bc123e8afa38d890c3/sentry/dist/vendor.js.map" } }] }, "type": "TypeError", }] }, }, project_id=self.project.id, ) event_processed.send(project=self.project, event=event, sender=type(self.project)) source_maps = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="source_maps") assert source_maps
def test_event_processed(self): now = timezone.now() project = self.create_project(first_event=now) event = self.store_event( data={ "event_id": "a" * 32, "platform": "javascript", "timestamp": iso_format(before_now(minutes=1)), "tags": { "sentry:release": "e1b5d1900526feaf20fe2bc9cad83d392136030a", "sentry:user": "******", }, "user": { "ip_address": "0.0.0.0", "id": "41656", "email": "*****@*****.**" }, "exception": { "values": [{ "stacktrace": { "frames": [{ "data": { "sourcemap": "https://media.sentry.io/_static/29e365f8b0d923bc123e8afa38d890c3/sentry/dist/vendor.js.map" } }] }, "type": "TypeError", }] }, }, project_id=project.id, ) event_processed.send(project=project, event=event, sender=type(project)) task = OrganizationOnboardingTask.objects.get( organization=project.organization, task=OnboardingTask.RELEASE_TRACKING, status=OnboardingTaskStatus.COMPLETE, ) assert task is not None task = OrganizationOnboardingTask.objects.get( organization=project.organization, task=OnboardingTask.USER_CONTEXT, status=OnboardingTaskStatus.COMPLETE, ) assert task is not None task = OrganizationOnboardingTask.objects.get( organization=project.organization, task=OnboardingTask.SOURCEMAPS, status=OnboardingTaskStatus.COMPLETE, ) assert task is not None
def test_ruby(self): event = self.store_event( data={"platform": "ruby", "message": "ruby error message"}, project_id=self.project.id ) event_processed.send(project=self.project, event=event, sender=type(self.project)) ruby = FeatureAdoption.objects.get_by_slug(organization=self.organization, slug="ruby") assert ruby.complete
def test_user_tracking(self): event = self.store_event(data={"user": {"id": "123"}}, project_id=self.project.id) event_processed.send(project=self.project, event=event, sender=type(self.project)) feature_complete = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="user_tracking" ) assert feature_complete
def test_environment_tracking(self): event = self.store_event(data={"environment": "prod"}, project_id=self.project.id) event_processed.send(project=self.project, event=event, sender=type(self.project)) environment_tracking = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="environment_tracking" ) assert environment_tracking
def test_release_tracking(self): event = self.store_event(data={"tags": {"sentry:release": "1"}}, project_id=self.project.id) event_processed.send(project=self.project, event=event, sender=type(self.project)) release_tracking = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="release_tracking" ) assert release_tracking
def test_breadcrumbs(self): event = self.create_full_event() event_processed.send(project=self.project, event=event, sender=type(self.project)) breadcrumbs = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="breadcrumbs" ) assert breadcrumbs
def test_source_maps(self): event = self.create_full_event() event_processed.send(project=self.project, event=event, sender=type(self.project)) source_maps = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="source_maps" ) assert source_maps
def test_user_tracking(self): event = self.create_full_event() event_processed.send(project=self.project, event=event, sender=type(self.project)) feature_complete = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="user_tracking" ) assert feature_complete
def test_environment_tracking(self): event = self.create_full_event() event_processed.send(project=self.project, event=event, sender=type(self.project)) environment_tracking = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="environment_tracking" ) assert environment_tracking
def test_csp(self): group = self.create_group(project=self.project, platform='csp', message='C# error message') event = self.create_event() event_processed.send( project=self.project, group=group, event=event, sender=type(self.project) ) csp = FeatureAdoption.objects.get_by_slug(organization=self.organization, slug="csp") assert csp.complete
def test_go(self): group = self.create_group(project=self.project, platform='go', message='go error message') event = self.create_event() event_processed.send( project=self.project, group=group, event=event, sender=type(self.project) ) go = FeatureAdoption.objects.get_by_slug(organization=self.organization, slug="go") assert go.complete
def test_event_processed(self): assert not self.project.flags.has_transactions event = self.store_event( data={"type": "default", "timestamp": self.min_ago}, project_id=self.project.id ) event_processed.send(project=self.project, event=event, sender=type(self.project)) project = Project.objects.get(id=self.project.id) assert not project.flags.has_transactions
def test_javascript(self): group = self.create_group( project=self.project, platform="javascript", message="javascript error message" ) event = self.create_event(group=group, data={"platform": "javascript"}) event_processed.send(project=self.project, event=event, sender=type(self.project)) js = FeatureAdoption.objects.get_by_slug(organization=self.organization, slug="javascript") assert js.complete
def test_python(self): event = self.store_event( data={"platform": "python", "message": "python error message"}, project_id=self.project.id, ) event_processed.send(project=self.project, event=event, sender=type(self.project)) python = FeatureAdoption.objects.get_by_slug(organization=self.organization, slug="python") assert python.complete
def test_python(self): group = self.create_group( project=self.project, platform="python", message="python error message" ) event = self.create_event(group=group) event_processed.send(project=self.project, event=event, sender=type(self.project)) python = FeatureAdoption.objects.get_by_slug(organization=self.organization, slug="python") assert python.complete
def test_custom_tags(self): event = self.store_event(data={}, project_id=self.project.id) event.data["tags"].append(("foo", "bar")) assert event.get_tag("foo") == "bar" event_processed.send(project=self.project, event=event, sender=type(self.project)) custom_tags = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="custom_tags" ) assert custom_tags
def test_javascript(self): event = self.store_event(data={"platform": "javascript"}, project_id=self.project.id) event_processed.send(project=self.project, event=event, sender=type(self.project)) js = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="javascript") assert js.complete
def test_all_passed_feature_slugs_are_complete(self): event1 = self.create_full_event() event2 = self.create_full_event(event_id="b") event_processed.send(project=self.project, event=event1, sender=type(self.project)) event_processed.send(project=self.project, event=event2, sender=type(self.project)) feature_complete = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="environment_tracking" ) assert feature_complete.complete
def test_no_env_tracking(self): envless_event = self.store_event(data={"platform": "javascript"}, project_id=self.project.id) event_processed.send(project=self.project, event=envless_event, sender=type(self.project)) feature_complete = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="environment_tracking") assert feature_complete is None
def test_objc(self): group = self.create_group( project=self.project, platform='objc', message='objc error message' ) event = self.create_event() event_processed.send( project=self.project, group=group, event=event, sender=type(self.project) ) objc = FeatureAdoption.objects.get_by_slug(organization=self.organization, slug="objc") assert objc.complete
def test_ruby(self): group = self.create_group( project=self.project, platform='ruby', message='ruby error message' ) event = self.create_event() event_processed.send( project=self.project, group=group, event=event, sender=type(self.project) ) ruby = FeatureAdoption.objects.get_by_slug(organization=self.organization, slug="ruby") assert ruby.complete
def test_node(self): group = self.create_group( project=self.project, platform='node', message='node error message' ) event = self.create_event() event_processed.send( project=self.project, group=group, event=event, sender=type(self.project) ) node = FeatureAdoption.objects.get_by_slug(organization=self.organization, slug="node") assert node.complete
def test_custom_tags(self): event = self.create_full_event() event.data['tags'].append(('foo', 'bar')) assert event.get_tag('foo') == 'bar' event_processed.send(project=self.project, event=event, sender=type(self.project)) custom_tags = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="custom_tags") assert custom_tags
def test_javascript(self): group = self.create_group( project=self.project, platform='javascript', message='javascript error message' ) event = self.create_event() event_processed.send( project=self.project, group=group, event=event, sender=type(self.project) ) js = FeatureAdoption.objects.get_by_slug(organization=self.organization, slug="javascript") assert js.complete
def test_python(self): group = self.create_group( project=self.project, platform='python', message='python error message' ) event = self.create_event() event_processed.send( project=self.project, group=group, event=event, sender=type(self.project) ) python = FeatureAdoption.objects.get_by_slug(organization=self.organization, slug="python") assert python.complete
def test_environment_tracking(self): group = self.create_group( project=self.project, platform='javascript', message='javascript error message' ) event = self.create_full_event() event_processed.send( project=self.project, group=group, event=event, sender=type(self.project) ) environment_tracking = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="environment_tracking" ) assert environment_tracking
def test_breadcrumbs(self): group = self.create_group( project=self.project, platform='javascript', message='javascript error message' ) event = self.create_full_event() event_processed.send( project=self.project, group=group, event=event, sender=type(self.project) ) breadcrumbs = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="breadcrumbs" ) assert breadcrumbs
def test_custom_tags(self): group = self.create_group( project=self.project, platform='javascript', message='javascript error message' ) event = self.create_full_event() event.data['tags'].append(('foo', 'bar')) assert event.get_tag('foo') == 'bar' event_processed.send( project=self.project, group=group, event=event, sender=type(self.project) ) custom_tags = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="custom_tags" ) assert custom_tags
def test_multiple_events(self): group = self.create_group( project=self.project, platform='javascript', message='javascript error message' ) simple_event = self.create_event() first_event_received.send(project=self.project, group=group, sender=type(self.project)) event_processed.send( project=self.project, group=group, event=simple_event, sender=type(self.project) ) first_event = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="first_event" ) assert first_event.complete js = FeatureAdoption.objects.get_by_slug(organization=self.organization, slug="javascript") assert js.complete full_event = self.create_full_event() event_processed.send( project=self.project, group=group, event=full_event, sender=type(self.project) ) release_tracking = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="release_tracking" ) assert release_tracking environment_tracking = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="environment_tracking" ) assert environment_tracking feature_complete = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="user_tracking" ) assert feature_complete source_maps = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="source_maps" ) assert source_maps breadcrumbs = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="breadcrumbs" ) assert breadcrumbs
def test_onboarding_complete(self): user = self.create_user(email='*****@*****.**') project = self.create_project(first_event=timezone.now()) second_project = self.create_project(first_event=timezone.now()) second_group = self.create_group(project=second_project, platform='python', message='python error message') event = self.create_full_event() member = self.create_member(organization=self.organization, teams=[self.team], user=user) event_processed.send(project=project, group=self.group, event=event, sender=type(project)) project_created.send(project=project, user=user, sender=type(project)) project_created.send(project=second_project, user=user, sender=type(second_project)) first_event_received.send(project=project, group=self.group, sender=type(project)) first_event_received.send(project=second_project, group=second_group, sender=type(second_project)) member_joined.send(member=member, sender=type(member)) plugin_enabled.send(plugin=IssueTrackingPlugin(), project=project, user=user, sender=type(IssueTrackingPlugin)) issue_tracker_used.send(plugin=IssueTrackingPlugin(), project=project, user=user, sender=type(IssueTrackingPlugin)) plugin_enabled.send(plugin=NotificationPlugin(), project=project, user=user, sender=type(NotificationPlugin)) assert OrganizationOption.objects.filter(organization=self.organization, key="onboarding:complete").count() == 1
def test_all_passed_feature_slugs_are_complete(self): group1 = self.create_group( project=self.project, platform='javascript', message='javascript error message' ) event1 = self.create_full_event() group2 = self.create_group( project=self.project, platform='javascript', message='javascript error message' ) event2 = self.create_full_event(event_id='b') event_processed.send( project=self.project, group=group1, event=event1, sender=type(self.project) ) event_processed.send( project=self.project, group=group2, event=event2, sender=type(self.project) ) feature_complete = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="environment_tracking" ) assert feature_complete.complete
def test_no_env_tracking(self): """test to see if just sending ip address doesn't check the user tracking box""" envless_payload = """ { "id": "f5dd88e612bc406ba89dfebd09120769", "project": 11276, "release": "e1b5d1900526feaf20fe2bc9cad83d392136030a", "platform": "javascript", "culprit": "app/components/events/eventEntries in map", "message": "TypeError: Cannot read property '1' of null", "tags": [ ["sentry_version", "e1b5d1900526feaf20fe2bc9cad83d392136030a"], ["level", "error"], ["logger", "javascript"], ["sentry:release", "e1b5d1900526feaf20fe2bc9cad83d392136030a"], ["browser", "Chrome 48.0"], ["device", "Other"], ["os", "Windows 10"], ["url", "https://sentry.io/katon-direct/localhost/issues/112734598/"], ["sentry:user", "id:41656"] ], "errors": [{ "url": "<anonymous>", "type": "js_no_source" }], "extra": { "session:duration": 40364 }, "exception": { "exc_omitted": null, "values": [{ "stacktrace": { "frames": [{ "function": "batchedUpdates", "abs_path": "webpack:////usr/src/getsentry/src/sentry/~/react/lib/ReactUpdates.js", "pre_context": [" // verify that that's the case. (This is called by each top-level update", " // function, like setProps, setState, forceUpdate, etc.; creation and", " // destruction of top-level components is guarded in ReactMount.)", "", " if (!batchingStrategy.isBatchingUpdates) {"], "post_context": [" return;", " }", "", " dirtyComponents.push(component);", "}"], "filename": "~/react/lib/ReactUpdates.js", "module": "react/lib/ReactUpdates", "colno": 0, "in_app": false, "data": { "orig_filename": "/_static/29e365f8b0d923bc123e8afa38d890c3/sentry/dist/vendor.js", "orig_abs_path": "https://media.sentry.io/_static/29e365f8b0d923bc123e8afa38d890c3/sentry/dist/vendor.js", "sourcemap": "https://media.sentry.io/_static/29e365f8b0d923bc123e8afa38d890c3/sentry/dist/vendor.js.map", "orig_lineno": 37, "orig_function": "Object.s [as enqueueUpdate]", "orig_colno": 16101 }, "context_line": " batchingStrategy.batchedUpdates(enqueueUpdate, component);", "lineno": 176 }], "frames_omitted": null }, "type": "TypeError", "value": "Cannot read property '1' of null", "module": null }] }, "request": { "url": "https://sentry.io/katon-direct/localhost/issues/112734598/", "headers": [ ["Referer", "https://sentry.io/welcome/"], ["User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36"] ] }, "user": { "ip_address": "0.0.0.0" }, "version": "7", "breadcrumbs": { "values": [ { "category": "xhr", "timestamp": 1496395011.63, "type": "http", "data": { "url": "/api/path/here", "status_code": "500", "method": "POST" } } ] } }""" group = self.create_group( project=self.project, platform='javascript', message='javascript error message' ) envless_event = self.create_event( event_id='a', platform='javascript', data=json.loads(envless_payload) ) event_processed.send( project=self.project, group=group, event=envless_event, sender=type(self.project) ) feature_complete = FeatureAdoption.objects.get_by_slug( organization=self.organization, slug="environment_tracking" ) assert feature_complete is None