示例#1
0
def update_stats():
    if random.random() > 0.8:
        dict_for_truncation = {k: k for k in range(500)}
        assert False, "Bad luck!"
    elasticapm.label(a="x", b="y")
    elasticapm.set_custom_context({"a": "x", "b": "y"})
    cache.set(utils.stats.cache_key, utils.stats(), 60)
示例#2
0
def stats(request):
    from_cache = True
    data = cache.get(utils.stats.cache_key)
    if not data:
        data = utils.stats()
        cache.set(utils.stats.cache_key, data, 60)
        from_cache = False
    label(served_from_cache=from_cache)
    return JsonResponse(data, safe=False)
示例#3
0
def update_stats():
    if random.random() > 0.8:
        dict_for_truncation = {k: k for k in range(500)}
        assert False, "Bad luck!"
    cache.set(utils.stats.cache_key, utils.stats(), 60)
示例#4
0
def update_stats():
    if random.random() > 0.8:
        assert False, "Bad luck!"
    cache.set(utils.stats.cache_key, utils.stats(), 60)