当前位置: 首页>>代码示例>>Python>>正文


Python StatsClient.decr方法代码示例

本文整理汇总了Python中statsd.StatsClient.decr方法的典型用法代码示例。如果您正苦于以下问题:Python StatsClient.decr方法的具体用法?Python StatsClient.decr怎么用?Python StatsClient.decr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在statsd.StatsClient的用法示例。


在下文中一共展示了StatsClient.decr方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: StatsdStatsLogger

# 需要导入模块: from statsd import StatsClient [as 别名]
# 或者: from statsd.StatsClient import decr [as 别名]
    class StatsdStatsLogger(BaseStatsLogger):

        def __init__(self, host='localhost', port=8125,
                     prefix='superset', statsd_client=None):
            """
            Initializes from either params or a supplied, pre-constructed statsd client.

            If statsd_client argument is given, all other arguments are ignored and the
            supplied client will be used to emit metrics.
            """
            if statsd_client:
                self.client = statsd_client
            else:
                self.client = StatsClient(host=host, port=port, prefix=prefix)

        def incr(self, key):
            self.client.incr(key)

        def decr(self, key):
            self.client.decr(key)

        def timing(self, key, value):
            self.client.timing(key, value)

        def gauge(self, key):
            # pylint: disable=no-value-for-parameter
            self.client.gauge(key)
开发者ID:tan31989,项目名称:caravel,代码行数:29,代码来源:stats_logger.py

示例2: StatsdStatsLogger

# 需要导入模块: from statsd import StatsClient [as 别名]
# 或者: from statsd.StatsClient import decr [as 别名]
    class StatsdStatsLogger(BaseStatsLogger):
        def __init__(self, host, port, prefix='superset'):
            self.client = StatsClient(host=host, port=port, prefix=prefix)

        def incr(self, key):
            self.client.incr(key)

        def decr(self, key):
            self.client.decr(key)

        def gauge(self, key):
            # pylint: disable=no-value-for-parameter
            self.client.gauge(key)
开发者ID:alanmcruickshank,项目名称:caravel,代码行数:15,代码来源:stats_logger.py

示例3: StatsDBackend

# 需要导入模块: from statsd import StatsClient [as 别名]
# 或者: from statsd.StatsClient import decr [as 别名]
class StatsDBackend(BaseBackend):

    name = 'statsd'

    def __init__(self, config):
        self.config = config
        self.config.setdefault('STATSD_HOST', 'localhost')
        self.config.setdefault('STATSD_PORT', 8125)
        self.config.setdefault('STATSD_PREFIX', None)

        self.statsd = StatsClient(self.config['STATSD_HOST'],
                                  self.config['STATSD_PORT'],
                                  self.config['STATSD_PREFIX'])

    def timing(self, stat_name, delta):
        return self.statsd.timing(stat_name, delta, self.config['STATS_RATE'])

    def incr(self, stat_name, count=1):
        return self.statsd.incr(stat_name, count, self.config['STATS_RATE'])

    def decr(self, stat_name, count=1):
        return self.statsd.decr(stat_name, count, self.config['STATS_RATE'])

    def gauge(self, stat_name, value, delta=False):
        return self.statsd.gauge(stat_name, value, self.config['STATS_RATE'], delta)
开发者ID:gabrielpjordao,项目名称:flask-stats,代码行数:27,代码来源:flask_stats.py

示例4: StatsD

# 需要导入模块: from statsd import StatsClient [as 别名]
# 或者: from statsd.StatsClient import decr [as 别名]
class StatsD(object):
    def __init__(self, app=None, config=None):
        self.config = None
        self.statsd = None
        if app is not None:
            self.init_app(app)
        else:
            self.app = None

    def init_app(self, app, config=None):
        if config is not None:
            self.config = config
        elif self.config is None:
            self.config = app.config

        self.config.setdefault('STATSD_HOST', 'localhost')
        self.config.setdefault('STATSD_PORT', 8125)
        self.config.setdefault('STATSD_PREFIX', None)

        self.app = app

        self.statsd = StatsClient(self.config['STATSD_HOST'],
            self.config['STATSD_PORT'], self.config['STATSD_PREFIX'])

    def timer(self, *args, **kwargs):
        return self.statsd.timer(*args, **kwargs)

    def timing(self, *args, **kwargs):
        return self.statsd.timing(*args, **kwargs)

    def incr(self, *args, **kwargs):
        return self.statsd.incr(*args, **kwargs)

    def decr(self, *args, **kwargs):
        return self.statsd.decr(*args, **kwargs)

    def gauge(self, *args, **kwargs):
        return self.statsd.gauge(*args, **kwargs)

    def set(self, *args, **kwargs):
        return self.statsd.set(*args, **kwargs)
开发者ID:adsabs,项目名称:flask-statsd,代码行数:43,代码来源:flask_statsd.py

示例5: StatsD

# 需要导入模块: from statsd import StatsClient [as 别名]
# 或者: from statsd.StatsClient import decr [as 别名]
class StatsD(object):
    def __init__(self, app=None, config=None):
        self.config = None
        self.statsd = None
        if app is not None:
            self.init_app(app)
        else:
            self.app = None

    def init_app(self, app, config=None):
        if config is not None:
            self.config = config
        elif self.config is None:
            self.config = app.config

        self.config.setdefault("STATSD_HOST", "localhost")
        self.config.setdefault("STATSD_PORT", 8125)
        self.config.setdefault("STATSD_PREFIX", None)

        self.app = app

        self.statsd = StatsClient(
            host=self.config["STATSD_HOST"], port=self.config["STATSD_PORT"], prefix=self.config["STATSD_PREFIX"]
        )

    def timer(self, *args, **kwargs):
        return self.statsd.timer(*args, **kwargs)

    def timing(self, *args, **kwargs):
        return self.statsd.timing(*args, **kwargs)

    def incr(self, *args, **kwargs):
        return self.statsd.incr(*args, **kwargs)

    def decr(self, *args, **kwargs):
        return self.statsd.decr(*args, **kwargs)

    def gauge(self, *args, **kwargs):
        return self.statsd.gauge(*args, **kwargs)
开发者ID:tarzan0820,项目名称:flask-statsd,代码行数:41,代码来源:flask_statsd.py

示例6: StatsClient

# 需要导入模块: from statsd import StatsClient [as 别名]
# 或者: from statsd.StatsClient import decr [as 别名]
#!/usr/bin/python

from statsd import StatsClient
import os

statsd = StatsClient(host='metrics.ccs.neu.edu')

if os.getenv('PAM_TYPE') == 'open_session':
  statsd.incr('ccs.linux.102.logins')
else:
  statsd.decr('ccs.linux.102.logins')

开发者ID:pranav,项目名称:metrics3,代码行数:13,代码来源:client.py


注:本文中的statsd.StatsClient.decr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。