本文整理汇总了Python中sentry.analytics.record函数的典型用法代码示例。如果您正苦于以下问题:Python record函数的具体用法?Python record怎么用?Python record使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了record函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dispatch
def dispatch(self, request, organization, **kwargs):
try:
config = self.get_repository_data(organization, request.DATA)
except Exception as e:
return self.handle_api_error(e)
try:
result = self.build_repository_config(
organization=organization,
data=config,
)
except IntegrationError as e:
return Response(
{
'errors': {
'__all__': e.message
},
}, status=400
)
try:
with transaction.atomic():
repo = Repository.objects.create(
organization_id=organization.id,
name=result['name'],
external_id=result.get('external_id'),
url=result.get('url'),
config=result.get('config') or {},
provider=self.id,
integration_id=result.get('integration_id'),
)
except IntegrityError:
# Try to delete webhook we just created
try:
repo = Repository(
organization_id=organization.id,
name=result['name'],
external_id=result.get('external_id'),
url=result.get('url'),
config=result.get('config') or {},
provider=self.id,
integration_id=result.get('integration_id'),
)
self.on_delete_repository(repo)
except IntegrationError:
pass
return Response(
{'errors': {'__all__': 'A repository with that name already exists'}},
status=400,
)
else:
repo_linked.send_robust(repo=repo, user=request.user, sender=self.__class__)
analytics.record(
'integration.repo.added',
provider=self.id,
id=result.get('integration_id'),
organization_id=organization.id,
)
return Response(serialize(repo, request.user), status=201)
示例2: record_issue_tracker_used
def record_issue_tracker_used(plugin, project, user, **kwargs):
rows_affected, created = OrganizationOnboardingTask.objects.create_or_update(
organization_id=project.organization_id,
task=OnboardingTask.ISSUE_TRACKER,
status=OnboardingTaskStatus.PENDING,
values={
'status': OnboardingTaskStatus.COMPLETE,
'user': user,
'project_id': project.id,
'date_completed': timezone.now(),
'data': {
'plugin': plugin.slug
}
}
)
if rows_affected or created:
check_for_onboarding_complete(project.organization_id)
if user and user.is_authenticated():
user_id = default_user_id = user.id
else:
user_id = None
default_user_id = project.organization.get_default_owner().id
analytics.record(
'issue_tracker.used',
user_id=user_id,
default_user_id=default_user_id,
organization_id=project.organization_id,
project_id=project.id,
issue_tracker=plugin.slug,
)
示例3: record_analytics
def record_analytics(self):
analytics.record(
'sentry_app.uninstalled',
user_id=self.user.id,
organization_id=self.install.organization_id,
sentry_app=self.install.sentry_app.slug,
)
示例4: sync_assignee_outbound
def sync_assignee_outbound(external_issue_id, user_id, assign, **kwargs):
# sync Sentry assignee to an external issue
external_issue = ExternalIssue.objects.get(id=external_issue_id)
organization = Organization.objects.get(id=external_issue.organization_id)
has_issue_sync = features.has('organizations:integrations-issue-sync',
organization)
if not has_issue_sync:
return
integration = Integration.objects.get(id=external_issue.integration_id)
# assume unassign if None
if user_id is None:
user = None
else:
user = User.objects.get(id=user_id)
installation = integration.get_installation(
organization_id=external_issue.organization_id,
)
if installation.should_sync('outbound_assignee'):
installation.sync_assignee_outbound(external_issue, user, assign=assign)
analytics.record(
'integration.issue.assignee.synced',
provider=integration.provider,
id=integration.id,
organization_id=external_issue.organization_id,
)
示例5: record_issue_resolved
def record_issue_resolved(organization_id, project, group, user, resolution_type, **kwargs):
""" There are three main types of ways to resolve issues
1) via a release (current release, next release, or other)
2) via commit (in the UI with the commit hash (marked as "in_commit")
or tagging the issue in a commit (marked as "with_commit"))
3) now
"""
if resolution_type in ('in_next_release', 'in_release'):
FeatureAdoption.objects.record(
organization_id=organization_id, feature_slug="resolved_in_release", complete=True
)
if resolution_type == 'with_commit':
FeatureAdoption.objects.record(
organization_id=organization_id, feature_slug="resolved_with_commit", complete=True
)
if user and user.is_authenticated():
user_id = default_user_id = user.id
else:
user_id = None
default_user_id = project.organization.get_default_owner().id
analytics.record(
'issue.resolved',
user_id=user_id,
default_user_id=default_user_id,
organization_id=organization_id,
group_id=group.id,
resolution_type=resolution_type,
)
示例6: record_analytics
def record_analytics(self):
analytics.record(
'sentry_app.created',
user_id=self.user.id,
organization_id=self.organization.id,
sentry_app=self.sentry_app.slug,
)
示例7: sync_status_outbound
def sync_status_outbound(group_id, external_issue_id, **kwargs):
try:
group = Group.objects.filter(
id=group_id,
status__in=[GroupStatus.UNRESOLVED, GroupStatus.RESOLVED],
)[0]
except IndexError:
return
has_issue_sync = features.has('organizations:integrations-issue-sync',
group.organization)
if not has_issue_sync:
return
external_issue = ExternalIssue.objects.get(id=external_issue_id)
integration = Integration.objects.get(id=external_issue.integration_id)
installation = integration.get_installation(
organization_id=external_issue.organization_id,
)
if installation.should_sync('outbound_status'):
installation.sync_status_outbound(
external_issue, group.status == GroupStatus.RESOLVED, group.project_id
)
analytics.record(
'integration.issue.status.synced',
provider=integration.provider,
id=integration.id,
organization_id=external_issue.organization_id,
)
示例8: record_plugin_enabled
def record_plugin_enabled(plugin, project, user, **kwargs):
if isinstance(plugin, IssueTrackingPlugin) or isinstance(plugin, IssueTrackingPlugin2):
task = OnboardingTask.ISSUE_TRACKER
status = OnboardingTaskStatus.PENDING
elif isinstance(plugin, NotificationPlugin):
task = OnboardingTask.NOTIFICATION_SERVICE
status = OnboardingTaskStatus.COMPLETE
else:
return
success = OrganizationOnboardingTask.objects.record(
organization_id=project.organization_id,
task=task,
status=status,
user=user,
project_id=project.id,
data={'plugin': plugin.slug},
)
if success:
check_for_onboarding_complete(project.organization_id)
analytics.record(
'plugin.enabled',
user_id=user.id,
organization_id=project.organization_id,
project_id=project.id,
plugin=plugin.slug,
)
示例9: record_new_project
def record_new_project(project, user, **kwargs):
if user.is_authenticated():
user_id = default_user_id = user.id
else:
user = user_id = None
default_user_id = Organization.objects.get(
id=project.organization_id).get_default_owner().id
analytics.record(
'project.created',
user_id=user_id,
default_user_id=default_user_id,
organization_id=project.organization_id,
project_id=project.id,
platform=project.platform,
)
success = OrganizationOnboardingTask.objects.record(
organization_id=project.organization_id,
task=OnboardingTask.FIRST_PROJECT,
user=user,
status=OnboardingTaskStatus.COMPLETE,
project_id=project.id,
)
if not success:
OrganizationOnboardingTask.objects.record(
organization_id=project.organization_id,
task=OnboardingTask.SECOND_PLATFORM,
user=user,
status=OnboardingTaskStatus.PENDING,
project_id=project.id,
)
示例10: delete
def delete(self, request, organization, search_id):
"""
Delete a saved search
Permanently remove a saved search.
{method} {path}
"""
try:
search = SavedSearch.objects.get(
owner__isnull=True,
organization=organization,
id=search_id,
)
except SavedSearch.DoesNotExist:
raise ResourceDoesNotExist
search.delete()
analytics.record(
'organization_saved_search.deleted',
search_type=SearchType(search.type).name,
org_id=organization.id,
query=search.query,
)
return Response(status=204)
示例11: on_assign
def on_assign(self, request, identity, group, action):
assignee = action['selected_options'][0]['value']
if assignee == 'none':
assignee = None
self.update_group(group, identity, {'assignedTo': assignee})
analytics.record('integrations.slack.assign', actor_id=identity.user_id)
示例12: record_member_joined
def record_member_joined(member, organization, **kwargs):
FeatureAdoption.objects.record(
organization_id=member.organization_id, feature_slug="invite_team", complete=True
)
analytics.record(
'organization.joined',
user_id=member.user.id,
organization_id=organization.id,
)
示例13: record_sso_enabled
def record_sso_enabled(organization, user, provider, **kwargs):
FeatureAdoption.objects.record(
organization_id=organization.id, feature_slug="sso", complete=True
)
analytics.record(
'sso.enabled',
user_id=user.id,
organization_id=organization.id,
provider=provider,
)
示例14: record_team_created
def record_team_created(organization, user, team, **kwargs):
if user and user.is_authenticated():
user_id = default_user_id = user.id
else:
user_id = None
default_user_id = organization.get_default_owner().id
analytics.record(
'team.created',
user_id=user_id,
default_user_id=default_user_id,
organization_id=organization.id,
team_id=team.id,
)
示例15: record_integration_issue_linked
def record_integration_issue_linked(integration, organization, user, **kwargs):
if user and user.is_authenticated():
user_id = default_user_id = user.id
else:
user_id = None
default_user_id = organization.get_default_owner().id
analytics.record(
'integration.issue.linked',
user_id=user_id,
default_user_id=default_user_id,
organization_id=organization.id,
provider=integration.provider,
id=integration.id,
)