##// END OF EJS Templates
settings: don't use explicitly statsd because it's optional
super-admin -
r4834:fd731ff9 default
parent child Browse files
Show More
@@ -19,9 +19,10 b''
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 import os
21 import os
22 import re
22 import hashlib
23 import hashlib
23 import logging
24 import logging
24 import re
25 import time
25 from collections import namedtuple
26 from collections import namedtuple
26 from functools import wraps
27 from functools import wraps
27 import bleach
28 import bleach
@@ -34,7 +35,7 b' from rhodecode.lib.vcs.backends import b'
34 from rhodecode.lib.statsd_client import StatsdClient
35 from rhodecode.lib.statsd_client import StatsdClient
35 from rhodecode.model import BaseModel
36 from rhodecode.model import BaseModel
36 from rhodecode.model.db import (
37 from rhodecode.model.db import (
37 RepoRhodeCodeUi, RepoRhodeCodeSetting, RhodeCodeUi, RhodeCodeSetting, CacheKey)
38 RepoRhodeCodeUi, RepoRhodeCodeSetting, RhodeCodeUi, RhodeCodeSetting)
38 from rhodecode.model.meta import Session
39 from rhodecode.model.meta import Session
39
40
40
41
@@ -256,11 +257,16 b' class SettingsModel(BaseModel):'
256 }
257 }
257 return settings
258 return settings
258
259
260 start = time.time()
261 result = _get_all_settings('rhodecode_settings', cache_key)
262 compute_time = time.time() - start
263
259 statsd = StatsdClient.statsd
264 statsd = StatsdClient.statsd
260 with statsd.timer('rhodecode_settings_timing.histogram', auto_send=True) as tmr:
265 if statsd:
261 result = _get_all_settings('rhodecode_settings', cache_key)
266 elapsed_time_ms = round(1000.0 * compute_time) # use ms only
267 statsd.timing("rhodecode_settings_timing.histogram", elapsed_time_ms,
268 use_decimals=False)
262
269
263 compute_time = tmr.ms / 1000.
264 log.debug('Fetching app settings for key: %s took: %.4fs', cache_key, compute_time)
270 log.debug('Fetching app settings for key: %s took: %.4fs', cache_key, compute_time)
265
271
266 return result
272 return result
General Comments 0
You need to be logged in to leave comments. Login now