コード例 #1
0
ファイル: log.py プロジェクト: mozilla-services/qdo
def configure(settings, debug=False):
    """Configure a :term:`metlog` client and sender, either based on the
    passed in :py:attr:`settings` or as a debug sender.
    """
    if debug:
        debug_config = {'sender': {
            'class': 'metlog.senders.dev.DebugCaptureSender'}}
        get_client('qdo-worker', debug_config)
    else:
        logger = get_client('qdo-worker')
        # don't reconfigure an already configured debug logger
        if not isinstance(logger.sender, DebugCaptureSender):
            get_client('qdo-worker', settings)
def configure(settings, debug=False):
    """Configure a :term:`metlog` client and sender, either based on the
    passed in :py:attr:`settings` or as a debug sender.
    """
    if debug:
        debug_config = {
            'sender': {
                'class': 'metlog.senders.dev.DebugCaptureSender'
            }
        }
        get_client('qdo-worker', debug_config)
    else:
        logger = get_client('qdo-worker')
        # don't reconfigure an already configured debug logger
        if not isinstance(logger.sender, DebugCaptureSender):
            get_client('qdo-worker', settings)
def get_logger():
    """Get a global :term:`metlog` client.

    :rtype: :py:class:`metlog.client.MetlogClient`
    """
    return get_client('qdo-worker')
コード例 #4
0
ファイル: log.py プロジェクト: mozilla-services/qdo
def get_logger():
    """Get a global :term:`metlog` client.

    :rtype: :py:class:`metlog.client.MetlogClient`
    """
    return get_client('qdo-worker')
コード例 #5
0
'''
metlog demo
'''
import datetime
from metlog.holder import get_client
import random
import time

cfg = {'sender': {'class': 'metlog.senders.zmq.ZmqPubSender',
    #'bindstrs': 'tcp://aitc1.web.mtv1.dev.svc.mozilla.com:5565'}}
    'bindstrs': 'tcp://192.168.20.2:5565'}}


client = get_client('myapp', cfg)


def test_incr_pegs():
    """
    Just a check for increment counts
    """
    cluster_name = 'colo1'
    host_name = 'mozhost2'
    for k in ['syncstorage.request_rate.200',
            'syncstorage.request_rate.302',
            'syncstorage.request_rate.401',
            'syncstorage.request_rate.404',
            'syncstorage.request_rate.503']:

        min = random.randint(10, 200)
        max = random.randint(min, min + 500)