##// END OF EJS Templates
fix(caching): fixed problems with Cache query for users....
fix(caching): fixed problems with Cache query for users. The old way of querying caused the user get query to be always cached, and returning old results even in 2fa forms. The new limited query doesn't cache the user object resolving issues

File last commit:

r5320:2dcf7cd2 default
r5365:ae8a165b default
Show More
__init__.py
53 lines | 1.5 KiB | text/x-python | PythonLexer
py3: synced _vendor with vcsserver py3 changes
r4909
app: added statsd calls for monitoring.
r4632
import logging
from .stream import TCPStatsClient, UnixSocketStatsClient # noqa
from .udp import StatsClient # noqa
HOST = 'localhost'
PORT = 8125
IPV6 = False
PREFIX = None
MAXUDPSIZE = 512
log = logging.getLogger('rhodecode.statsd')
def statsd_config(config, prefix='statsd.'):
_config = {}
vendor: python3 fixes
r5041 for key in list(config.keys()):
app: added statsd calls for monitoring.
r4632 if key.startswith(prefix):
_config[key[len(prefix):]] = config[key]
return _config
def client_from_config(configuration, prefix='statsd.', **kwargs):
from pyramid.settings import asbool
_config = statsd_config(configuration, prefix)
feat(statsd): added extra logging into statsd initalization
r5320 statsd_flag = _config.get('enabled')
app: added statsd calls for monitoring.
r4632 statsd_enabled = asbool(_config.pop('enabled', False))
if not statsd_enabled:
feat(statsd): added extra logging into statsd initalization
r5320 log.debug('statsd client not enabled by statsd.enabled = %s flag, skipping...', statsd_flag)
app: added statsd calls for monitoring.
r4632 return
host = _config.pop('statsd_host', HOST)
port = _config.pop('statsd_port', PORT)
prefix = _config.pop('statsd_prefix', PREFIX)
maxudpsize = _config.pop('statsd_maxudpsize', MAXUDPSIZE)
ipv6 = asbool(_config.pop('statsd_ipv6', IPV6))
log.debug('configured statsd client %s:%s', host, port)
statsd: use safe mode and disable statsd if we can't connect
r4886 try:
client = StatsClient(
host=host, port=port, prefix=prefix, maxudpsize=maxudpsize, ipv6=ipv6)
except Exception:
log.exception('StatsD is enabled, but failed to connect to statsd server, fallback: disable statsd')
client = None
return client
app: added statsd calls for monitoring.
r4632
def get_statsd_client(request):
return client_from_config(request.registry.settings)