本文整理汇总了Python中sentry.app.tsdb.incr函数的典型用法代码示例。如果您正苦于以下问题:Python incr函数的具体用法?Python incr怎么用?Python incr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了incr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_integration
def test_integration(self, has_feature):
Project.objects.all().delete()
now = datetime(2016, 9, 12, tzinfo=pytz.utc)
has_feature.side_effect = lambda name, *a, **k: {
'organizations:reports:deliver': True,
'organizations:reports:prepare': True,
}.get(name, False)
project = self.create_project(
organization=self.organization,
team=self.team,
)
tsdb.incr(
tsdb.models.project,
project.id,
now - timedelta(days=1),
)
member_set = set(project.team.member_set.all())
with self.tasks():
prepare_reports(timestamp=to_timestamp(now))
assert len(mail.outbox) == len(member_set) == 1
message = mail.outbox[0]
assert self.organization.name in message.subject
开发者ID:ForkRepo,项目名称:sentry,代码行数:29,代码来源:test_reports.py
示例2: test_integration
def test_integration(self):
Project.objects.all().delete()
now = datetime(2016, 9, 12, tzinfo=pytz.utc)
project = self.create_project(
organization=self.organization,
team=self.team,
date_added=now - timedelta(days=90),
)
tsdb.incr(
tsdb.models.project,
project.id,
now - timedelta(days=1),
)
member_set = set(project.team.member_set.all())
with self.tasks():
prepare_reports(timestamp=to_timestamp(now))
assert len(mail.outbox) == len(member_set) == 1
message = mail.outbox[0]
assert self.organization.name in message.subject
开发者ID:pythorn,项目名称:sentry,代码行数:25,代码来源:test_reports.py
示例3: test_simple
def test_simple(self):
self.login_as(user=self.user)
group1 = self.create_group()
group2 = self.create_group()
url = reverse('sentry-api-0-group-stats', kwargs={
'group_id': group1.id,
})
response = self.client.get(url, format='json')
assert response.status_code == 200, response.content
for point in response.data:
assert point[1] == 0
assert len(response.data) == 24
tsdb.incr(tsdb.models.group, group1.id, count=3)
tsdb.incr(tsdb.models.group, group2.id, count=5)
response = self.client.get(url, format='json')
assert response.status_code == 200, response.content
assert response.data[-1][1] == 3, response.data
for point in response.data[:-1]:
assert point[1] == 0
assert len(response.data) == 24
开发者ID:DZTPY,项目名称:sentry,代码行数:26,代码来源:test_group_stats.py
示例4: test_simple
def test_simple(self):
self.login_as(user=self.user)
project = self.create_project()
group1 = self.create_group(project=project)
group2 = self.create_group(project=project)
url = reverse('sentry-api-0-project-group-stats', kwargs={
'organization_slug': project.organization.slug,
'project_slug': project.slug,
})
response = self.client.get('%s?id=%s&id=%s' % (url, group1.id, group2.id),
format='json')
tsdb.incr(tsdb.models.group, group1.id, count=3)
response = self.client.get('%s?id=%s&id=%s' % (url, group1.id, group2.id),
format='json')
assert response.status_code == 200, response.content
assert len(response.data) == 2
assert str(group1.id) in response.data
assert str(group2.id) in response.data
group_data = response.data[str(group1.id)]
assert group_data[-1][1] == 3, response.data
for point in group_data[:-1]:
assert point[1] == 0
assert len(group_data) == 24
开发者ID:noah-lee,项目名称:sentry,代码行数:29,代码来源:test_project_group_stats.py
示例5: test_integration
def test_integration(self):
Project.objects.all().delete()
now = datetime(2016, 9, 12, tzinfo=pytz.utc)
project = self.create_project(
organization=self.organization,
team=self.team,
date_added=now - timedelta(days=90),
)
tsdb.incr(
tsdb.models.project,
project.id,
now - timedelta(days=1),
)
member_set = set(project.team.member_set.all())
with self.tasks(), \
mock.patch.object(tsdb, 'get_earliest_timestamp') as get_earliest_timestamp:
# Ensure ``get_earliest_timestamp`` is relative to the fixed
# "current" timestamp -- this prevents filtering out data points
# that would be considered expired relative to the *actual* current
# timestamp.
get_earliest_timestamp.return_value = to_timestamp(now - timedelta(days=60))
prepare_reports(timestamp=to_timestamp(now))
assert len(mail.outbox) == len(member_set) == 1
message = mail.outbox[0]
assert self.organization.name in message.subject
开发者ID:alshopov,项目名称:sentry,代码行数:32,代码来源:test_reports.py
示例6: _incr_internal
def _incr_internal(key, amount):
from sentry.app import tsdb
sample_rate = settings.SENTRY_METRICS_SAMPLE_RATE
if _should_sample():
amount = _sampled_value(amount)
tsdb.incr(tsdb.models.internal, key, count=amount)
开发者ID:hyserver,项目名称:sentry,代码行数:7,代码来源:metrics.py
示例7: test_simple
def test_simple(self):
self.login_as(user=self.user)
project = self.create_project()
group1 = self.create_group(project=project)
group2 = self.create_group(project=project)
url = u'/api/0/projects/{}/{}/issues/stats/'.format(
project.organization.slug,
project.slug,
)
response = self.client.get('%s?id=%s&id=%s' % (url, group1.id, group2.id), format='json')
tsdb.incr(tsdb.models.group, group1.id, count=3)
response = self.client.get('%s?id=%s&id=%s' % (url, group1.id, group2.id), format='json')
assert response.status_code == 200, response.content
assert len(response.data) == 2
assert six.text_type(group1.id) in response.data
assert six.text_type(group2.id) in response.data
group_data = response.data[six.text_type(group1.id)]
assert group_data[-1][1] == 3, response.data
for point in group_data[:-1]:
assert point[1] == 0
assert len(group_data) == 24
开发者ID:Kayle009,项目名称:sentry,代码行数:27,代码来源:test_project_group_stats.py
示例8: _incr_internal
def _incr_internal(key, instance=None, tags=None, amount=1):
from sentry.app import tsdb
if _should_sample():
amount = _sampled_value(amount)
if instance:
full_key = '{}.{}'.format(key, instance)
else:
full_key = key
tsdb.incr(tsdb.models.internal, full_key, count=amount)
开发者ID:noah-lee,项目名称:sentry,代码行数:10,代码来源:metrics.py
示例9: _incr_internal
def _incr_internal(key, instance=None, tags=None, amount=1):
from sentry.app import tsdb
sample_rate = settings.SENTRY_METRICS_SAMPLE_RATE
if _should_sample():
amount = _sampled_value(amount)
if instance:
full_key = '{}.{}'.format(key, instance)
else:
full_key = key
tsdb.incr(tsdb.models.internal, full_key, count=amount)
开发者ID:carriercomm,项目名称:sentry-1,代码行数:11,代码来源:metrics.py
示例10: incr
def incr(key, amount=1):
from sentry.app import tsdb
sample_rate = settings.SENTRY_METRICS_SAMPLE_RATE
statsd.incr(_get_key(key), amount,
rate=sample_rate)
if sample_rate >= 1 or random() >= sample_rate:
if sample_rate < 1:
amount = int(amount * (1.0 / sample_rate))
tsdb.incr(tsdb.models.internal, key, count=amount)
开发者ID:DZTPY,项目名称:sentry,代码行数:12,代码来源:metrics.py
示例11: test_more_than_zero
def test_more_than_zero(self):
event = self.get_event()
rule = self.get_rule({
'interval': Interval.ONE_MINUTE,
'value': '0',
})
self.assertDoesNotPass(rule, event)
rule.clear_cache(event)
tsdb.incr(tsdb.models.group, event.group_id, count=1)
self.assertPasses(rule, event)
开发者ID:dcvz,项目名称:sentry,代码行数:12,代码来源:test_event_frequency.py
示例12: _incr_internal
def _incr_internal(key, instance=None, tags=None, amount=1):
from sentry.app import tsdb
if _should_sample():
amount = _sampled_value(amount)
if instance:
full_key = '{}.{}'.format(key, instance)
else:
full_key = key
try:
tsdb.incr(tsdb.models.internal, full_key, count=amount)
except Exception:
logger = logging.getLogger('sentry.errors')
logger.exception('Unable to incr internal metric')
开发者ID:280185386,项目名称:sentry,代码行数:15,代码来源:metrics.py
示例13: test_doesnt_send_consecutive
def test_doesnt_send_consecutive(self):
event = self.get_event()
value = 10
rule = self.get_rule({
'interval': Interval.ONE_HOUR,
'value': six.text_type(value),
})
self.assertDoesNotPass(rule, event)
rule.clear_cache(event)
tsdb.incr(tsdb.models.group, event.group_id, count=value + 1)
self.assertPasses(rule, event)
self.assertDoesNotPass(rule, event, rule_last_active=timezone.now())
开发者ID:dcvz,项目名称:sentry,代码行数:15,代码来源:test_event_frequency.py
示例14: test_simple
def test_simple(self):
self.login_as(user=self.user)
org = self.create_organization(owner=self.user, name='baz')
tsdb.incr(tsdb.models.organization_total_received, org.id, count=3)
url = reverse('sentry-api-0-organization-stats', args=[org.slug])
response = self.client.get(url, format='json')
assert response.status_code == 200, response.content
assert response.data[-1][1] == 3, response.data
for point in response.data[:-1]:
assert point[1] == 0
assert len(response.data) == 24
开发者ID:ForkRepo,项目名称:sentry,代码行数:15,代码来源:test_organization_stats.py
示例15: test_doesnt_send_consecutive
def test_doesnt_send_consecutive(self):
event = self.get_event()
rule = self.get_rule({
'interval': Interval.ONE_HOUR,
'value': '10',
})
tsdb.incr(tsdb.models.group, event.group_id, count=11)
rule = self.get_rule({
'interval': Interval.ONE_HOUR,
'value': '10',
})
self.assertPasses(rule, event)
self.assertDoesNotPass(rule, event, rule_last_active=timezone.now())
开发者ID:280185386,项目名称:sentry,代码行数:16,代码来源:test_event_frequency.py
示例16: repair_tsdb_data
def repair_tsdb_data(caches, project, events):
counters, sets, frequencies = collect_tsdb_data(caches, project, events)
for timestamp, data in counters.items():
for model, keys in data.items():
for (key, environment_id), value in keys.items():
tsdb.incr(model, key, timestamp, value, environment_id=environment_id)
for timestamp, data in sets.items():
for model, keys in data.items():
for (key, environment_id), values in keys.items():
# TODO: This should use `record_multi` rather than `record`.
tsdb.record(model, key, values, timestamp, environment_id=environment_id)
for timestamp, data in frequencies.items():
tsdb.record_frequency_multi(data.items(), timestamp)
开发者ID:Kayle009,项目名称:sentry,代码行数:16,代码来源:unmerge.py
示例17: test_one_hour
def test_one_hour(self):
event = self.get_event()
rule = self.get_rule({
'interval': Interval.ONE_HOUR,
'value': '10',
})
self.assertDoesNotPass(rule, event)
tsdb.incr(tsdb.models.group, event.group_id, count=11)
rule.clear_cache(event)
rule = self.get_rule({
'interval': Interval.ONE_HOUR,
'value': '10',
})
self.assertPasses(rule, event)
开发者ID:280185386,项目名称:sentry,代码行数:17,代码来源:test_event_frequency.py
示例18: test_simple
def test_simple(self):
self.login_as(user=self.user)
project1 = self.create_project(owner=self.user, name='foo')
project2 = self.create_project(owner=self.user, name='bar')
tsdb.incr(tsdb.models.project, project1.id, count=3)
tsdb.incr(tsdb.models.project, project2.id, count=5)
url = reverse('sentry-api-0-project-stats', kwargs={
'project_id': project1.id,
})
response = self.client.get(url, format='json')
assert response.status_code == 200, response.content
assert response.data[-1][1] == 3, response.data
for point in response.data[:-1]:
assert point[1] == 0
assert len(response.data) == 24
开发者ID:CrazyLionHeart,项目名称:sentry,代码行数:19,代码来源:test_project_stats.py
示例19: test_simple
def test_simple(self):
self.login_as(user=self.user)
project1 = self.create_project(name="foo")
project2 = self.create_project(name="bar")
tsdb.incr(tsdb.models.project_total_received, project1.id, count=3)
tsdb.incr(tsdb.models.project_total_received, project2.id, count=5)
url = reverse(
"sentry-api-0-project-stats",
kwargs={"organization_slug": project1.organization.slug, "project_slug": project1.slug},
)
response = self.client.get(url, format="json")
assert response.status_code == 200, response.content
assert response.data[-1][1] == 3, response.data
for point in response.data[:-1]:
assert point[1] == 0
assert len(response.data) == 24
开发者ID:AyrtonRicardo,项目名称:sentry,代码行数:20,代码来源:test_project_stats.py
示例20: test_simple
def test_simple(self):
self.login_as(user=self.user)
group1 = self.create_group()
group2 = self.create_group()
url = '/api/0/issues/{}/stats/'.format(group1.id)
response = self.client.get(url, format='json')
assert response.status_code == 200, response.content
for point in response.data:
assert point[1] == 0
assert len(response.data) == 24
tsdb.incr(tsdb.models.group, group1.id, count=3)
tsdb.incr(tsdb.models.group, group2.id, count=5)
response = self.client.get(url, format='json')
assert response.status_code == 200, response.content
assert response.data[-1][1] == 3, response.data
for point in response.data[:-1]:
assert point[1] == 0
assert len(response.data) == 24
开发者ID:280185386,项目名称:sentry,代码行数:24,代码来源:test_group_stats.py
注:本文中的sentry.app.tsdb.incr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论