本文整理汇总了Python中sentry.plugins.register函数的典型用法代码示例。如果您正苦于以下问题:Python register函数的具体用法?Python register怎么用?Python register使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了register函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: install_plugins
def install_plugins(settings):
from sentry.plugins import register
# entry_points={
# 'sentry.plugins': [
# 'phabricator = sentry_phabricator.plugins:PhabricatorPlugin'
# ],
# },
installed_apps = list(settings.INSTALLED_APPS)
for ep in pkg_resources.iter_entry_points('sentry.apps'):
try:
plugin = ep.load()
except Exception:
import sys
import traceback
print >> sys.stderr, "Failed to load app %r:\n%s" % (ep.name, traceback.format_exc())
else:
installed_apps.append(ep.module_name)
settings.INSTALLED_APPS = tuple(installed_apps)
for ep in pkg_resources.iter_entry_points('sentry.plugins'):
try:
plugin = ep.load()
except Exception:
import sys
import traceback
print >> sys.stderr, "Failed to load plugin %r:\n%s" % (ep.name, traceback.format_exc())
else:
register(plugin)
开发者ID:CaseCommonsDevOps,项目名称:sentry,代码行数:30,代码来源:runner.py
示例2: register_plugins
def register_plugins(settings):
from pkg_resources import iter_entry_points
from sentry.plugins import register
# entry_points={
# 'sentry.plugins': [
# 'phabricator = sentry_phabricator.plugins:PhabricatorPlugin'
# ],
# },
for ep in iter_entry_points('sentry.plugins'):
try:
plugin = ep.load()
except Exception:
import traceback
click.echo("Failed to load plugin %r:\n%s" % (ep.name, traceback.format_exc()), err=True)
else:
register(plugin)
开发者ID:dcvz,项目名称:sentry,代码行数:17,代码来源:initializer.py
示例3: register_plugins
def register_plugins(settings):
from sentry.plugins import register
# entry_points={
# 'sentry.plugins': [
# 'phabricator = sentry_phabricator.plugins:PhabricatorPlugin'
# ],
# },
for ep in pkg_resources.iter_entry_points('sentry.plugins'):
try:
plugin = ep.load()
except Exception:
import sys
import traceback
sys.stderr.write("Failed to load plugin %r:\n%s\n" % (ep.name, traceback.format_exc()))
else:
register(plugin)
开发者ID:haojiang1,项目名称:sentry,代码行数:18,代码来源:runner.py
示例4: FacebookPlugin
from sentry.plugins import Plugin, register
class FacebookPlugin(Plugin):
title = 'Facebook'
slug = 'facebook'
version = '0.1'
author = 'George Marshall'
register(FacebookPlugin)
开发者ID:georgemarshall,项目名称:sentry-facebook,代码行数:11,代码来源:models.py
示例5: UrlsPlugin
from django.utils.translation import ugettext_lazy as _
from sentry.plugins import register
from sentry.plugins.bases.tag import TagPlugin
class UrlsPlugin(TagPlugin):
"""
Automatically adds the 'url' tag from events containing interface data
from ``sentry.interfaces.Http``.
"""
slug = 'urls'
title = _('Auto Tag: URLs')
version = sentry.VERSION
author = "Sentry Team"
author_url = "https://github.com/getsentry/sentry"
tag = 'url'
tag_label = _('URL')
project_default_enabled = True
def get_tag_values(self, event):
http = event.interfaces.get('sentry.interfaces.Http')
if not http:
return []
if not http.url:
return []
return [http.url]
register(UrlsPlugin)
开发者ID:DouweM,项目名称:sentry,代码行数:29,代码来源:models.py
示例6: get_option
'group': group,
'event': event,
'link': link,
'interfaces': interface_list,
})).run()
headers = {
'X-Sentry-Logger': event.logger,
'X-Sentry-Logger-Level': event.get_level_display(),
'X-Sentry-Project': project.name,
'X-Sentry-Server': event.server_name,
}
self._send_mail(
subject=subject,
body=body,
html_body=html_body,
project=project,
fail_silently=fail_silently,
headers=headers,
)
def get_option(self, key, *args, **kwargs):
value = super(MailProcessor, self).get_option(key, *args, **kwargs)
if value is None and key in ('min_level', 'include_loggers', 'exclude_loggers',
'send_to_members', 'send_to_admins', 'send_to',
'subject_prefix'):
value = getattr(self, key)
return value
register(MailProcessor)
开发者ID:NewAgeDev,项目名称:sentry,代码行数:30,代码来源:models.py
示例7: notify_digest
self._send_mail(
subject=subject,
template=template,
html_template=html_template,
project=project,
group=group,
headers=headers,
context=context,
)
def notify_digest(self, project, digest):
context = {
'project': project,
'digest': digest,
}
self._send_mail(
subject=render_to_string('sentry/emails/digests/subject.txt', context).rstrip(),
template='sentry/emails/digests/body.txt',
html_template='sentry/emails/digests/body.html',
project=project,
context=context,
)
# Legacy compatibility
MailProcessor = MailPlugin
register(MailPlugin)
开发者ID:noah-lee,项目名称:sentry,代码行数:29,代码来源:models.py
示例8: ServersPlugin
if queryset.model == Event:
return queryset.filter(server_name=self.get_value()).distinct()
else:
return queryset.filter(event_set__server_name=self.get_value()).distinct()
class ServersPlugin(TagPlugin):
"""
Adds additional support for showing information about servers including:
* A panel which shows all servers a message was seen on.
* A sidebar module which shows the servers most actively seen on.
"""
slug = 'servers'
title = _('Servers')
version = sentry.VERSION
author = "Sentry Team"
author_url = "https://github.com/dcramer/sentry"
tag = 'server_name'
tag_label = _('Server Name')
def get_tag_values(self, event):
if not event.server_name:
return []
return [event.server_name]
def get_filters(self, project=None, **kwargs):
return [ServerNameFilter]
register(ServersPlugin)
开发者ID:StefanKjartansson,项目名称:sentry,代码行数:30,代码来源:models.py
示例9: post_process
title = 'JSON Mailer'
conf_title = title
conf_key = 'jsonmailprocessor'
# We want all events, not just new ones, so we override
# this method to remove the is_new check.
def post_process(self, group, event, is_new, is_sample, **kwargs):
if not self.should_notify(group, event):
return
self.notify_users(group, event)
# Overrides the method from MailProcessor
def get_plaintext_body(self, group, event, link, interface_list):
header = "SENTRY_EVENT_MAIL"
event.data['date_local_tz'] = str(timezone.localtime(event.datetime))
data = {
'server_name' : event.server_name,
'culprit' : event.culprit,
'level' : event.level,
'event_id' : event.event_id,
'message' : event.message,
'date' : str(event.datetime),
'data': event.data
}
return " ".join([header, json.dumps(data, separators=(',', ':'))])
register(JsonMailProcessor)
开发者ID:Supy,项目名称:sentry_jsonmailprocessor,代码行数:30,代码来源:models.py
示例10: _
title = _('Browsers')
tag = 'browser'
tag_label = _('Browser Name')
def get_tag_from_ua(self, ua):
if 'browser' not in ua:
return
tag = ua['browser']['name']
if 'version' in ua['browser']:
tag += ' ' + ua['browser']['version']
return tag
register(BrowserPlugin)
class OsPlugin(UserAgentPlugin):
"""
Adds additional support for showing information about operating systems including:
* A panel which shows all operating systems a message was seen on.
* A sidebar module which shows the operating systems most actively seen on.
"""
slug = 'os'
title = _('Operating Systems')
tag = 'os'
tag_label = _('Operating System')
def get_tag_from_ua(self, ua):
开发者ID:Crowdbooster,项目名称:sentry,代码行数:31,代码来源:models.py
示例11: UserEmailsPlugin
from django.utils.translation import ugettext_lazy as _
from sentry.plugins import register
from sentry.plugins.bases.tag import TagPlugin
class UserEmailsPlugin(TagPlugin):
"""
Adds additional support for showing information about users including:
* A panel which shows all users a message was created by.
* A sidebar module which shows the users most actively seeing event.
"""
slug = 'user-emails'
title = _('Auto Tag: User Emails')
version = sentry.VERSION
author = "Sentry Team"
author_url = "https://github.com/getsentry/sentry"
tag = 'user_email'
tag_label = _('User Email')
def get_tag_values(self, event):
user = event.interfaces.get('sentry.interfaces.User')
if not user:
return []
if not getattr(user, 'email', None):
return []
return [user.email]
register(UserEmailsPlugin)
开发者ID:allanlei,项目名称:sentry,代码行数:30,代码来源:models.py
示例12: __init__
base_fields = [RULES_DATA_KEY]
def __init__(self, *args, **kwargs):
initial = kwargs.get('initial', {}).get(RULES_DATA_KEY)
if initial:
kwargs['initial'] = pickle.loads(initial)
super(PatchedGroupRuleFormSet, self).__init__(*args, **kwargs)
@property
def cleaned_data(self):
data = getattr(super(PatchedGroupRuleFormSet, self), 'cleaned_data', {})
return {RULES_DATA_KEY: pickle.dumps(data)}
class GrouperPlugin(Plugin):
slug = 'group_rules'
conf_key = 'group_rules'
conf_key_rules = RULES_DATA_KEY
title = _('Grouping Rules')
version = sentry_grouper.VERSION
author = "Tommaso Barbugli"
author_url = "https://github.com/tbarbugli/sentry_grouper"
project_conf_template = 'sentry/plugins/sentry_grouper/project_configuration.html'
project_conf_form = PatchedGroupRuleFormSet
def get_project_rules(self, project):
rules = self.get_option(RULES_DATA_KEY, project)
unpickled = rules and pickle.loads(rules) or {RULES_DATA_KEY: []}
return unpickled
register(GrouperPlugin)
开发者ID:Fashiolista,项目名称:sentry_grouper,代码行数:30,代码来源:models.py
示例13: register
from __future__ import absolute_import
from sentry.plugins import register
from .plugin import WebHooksPlugin
register(WebHooksPlugin)
开发者ID:280185386,项目名称:sentry,代码行数:7,代码来源:__init__.py
示例14: register
from __future__ import absolute_import, print_function
from sentry.plugins import register
from .plugin import JavascriptPlugin
register(JavascriptPlugin)
开发者ID:280185386,项目名称:sentry,代码行数:7,代码来源:__init__.py
示例15: __import__
# coding: utf-8
"""
sentry_zabbix
"""
from __future__ import absolute_import
try:
VERSION = __import__('pkg_resources').get_distribution(__name__).version
except Exception, e:
VERSION = 'unknown'
from sentry.plugins import register
from .plugin import ZabbixPlugin
register(ZabbixPlugin)
开发者ID:dgaussin,项目名称:sentry-zabbix,代码行数:15,代码来源:__init__.py
示例16: ArgsPlugin
from sentry.interfaces import Message
from sentry.plugins import register
from sentry.plugins.bases.tag import TagPlugin
class ArgsPlugin(TagPlugin):
slug = 'args'
title = 'Auto Tag: Args'
author = "Hiroki KIYOHARA"
tag = 'args'
tag_label = 'Args'
project_default_enabled = True
def get_tag_values(self, event):
tags_list = []
d = event.interfaces
for interface in d.values():
if isinstance(interface, Message):
tags_list.extend(interface.params)
return tags_list
register(ArgsPlugin)
开发者ID:hirokiky,项目名称:sentry_argstagging,代码行数:24,代码来源:plugin.py
示例17: min
threshold = self.condition_rate / TIME_PERIODS[self.condition_rate_period]
logger.debug("current throughput is %f/s" % throughput)
try:
condition = 5 - min(int(throughput / threshold), 4)
except ZeroDivisionError:
condition = 5
if condition == COCKED_PISTOL:
self.set_cocked()
logger.debug("current condition is %r" % condition)
return condition
def post_process(self, group, event, is_new, is_sample, **kwargs):
self.update_throughput_per_second()
self.condition()
register(Defcon)
def notify_defcon_one(sender, **kwargs):
emails = sender.get_option('send_to') or []
if isinstance(emails, basestring):
emails = [s.strip() for s in emails.split(',')]
msg = EmailMultiAlternatives(
'Defcon 1 reached!',
'We reached DEFCON 1, error rate reached errors per seconds!',
settings.SENTRY_SERVER_EMAIL,
emails
)
msg.send(fail_silently=True)
signals.defcon_one_reached.connect(notify_defcon_one)
开发者ID:Fashiolista,项目名称:sentry_defcon,代码行数:30,代码来源:models.py
示例18: setUp
def setUp(self):
super(JIRAPluginTest, self).setUp()
register(self.plugin_cls)
self.group = self.create_group(message='Hello world', culprit='foo.bar')
self.event = self.create_event(group=self.group, message='Hello world')
开发者ID:PXke,项目名称:sentry-jira,代码行数:5,代码来源:test_plugin.py
示例19: register
from __future__ import absolute_import
from sentry.plugins import register
from .plugin import SlackPlugin
register(SlackPlugin)
开发者ID:Hazer,项目名称:sentry-slack,代码行数:7,代码来源:__init__.py
示例20: should_notify
slug = 'sentry_smart_mailer'
conf_key = 'sentry_smart_mailer'
version = sentry_smart_mailer.VERSION
author = "Tommaso Barbugli"
author_url = "https://github.com/tbarbugli/sentry_smart_mailer"
def should_notify(self, group):
return SwitchManager.send_email(group=group, logger_name=group.logger)
def post_process(self, group, event, is_new, is_sample, **kwargs):
lock_key = 'lock_mail:%s' % group.id
try:
with Lock(lock_key, timeout=0.5):
self._post_process(group, event, is_new, is_sample, **kwargs)
except UnableToGetLock:
pass
def _post_process(self, group, event, is_new, is_sample, **kwargs):
if not self.should_notify(group):
return
try:
email_sent_at = list(get_last_email_sent_at(group))
except:
email_sent_at = []
self.notify_users(group, event)
email_sent_at.append((datetime.now(), group.times_seen or 1))
set_last_email_sent_at(group, email_sent_at[-5:])
register(SmartMailer)
unregister(MailProcessor)
开发者ID:tbarbugli,项目名称:sentry_smart_mailer,代码行数:30,代码来源:models.py
注:本文中的sentry.plugins.register函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论