##// 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 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import os
22 import re
22 23 import hashlib
23 24 import logging
24 import re
25 import time
25 26 from collections import namedtuple
26 27 from functools import wraps
27 28 import bleach
@@ -34,7 +35,7 b' from rhodecode.lib.vcs.backends import b'
34 35 from rhodecode.lib.statsd_client import StatsdClient
35 36 from rhodecode.model import BaseModel
36 37 from rhodecode.model.db import (
37 RepoRhodeCodeUi, RepoRhodeCodeSetting, RhodeCodeUi, RhodeCodeSetting, CacheKey)
38 RepoRhodeCodeUi, RepoRhodeCodeSetting, RhodeCodeUi, RhodeCodeSetting)
38 39 from rhodecode.model.meta import Session
39 40
40 41
@@ -256,11 +257,16 b' class SettingsModel(BaseModel):'
256 257 }
257 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 264 statsd = StatsdClient.statsd
260 with statsd.timer('rhodecode_settings_timing.histogram', auto_send=True) as tmr:
261 result = _get_all_settings('rhodecode_settings', cache_key)
265 if statsd:
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 270 log.debug('Fetching app settings for key: %s took: %.4fs', cache_key, compute_time)
265 271
266 272 return result
General Comments 0
You need to be logged in to leave comments. Login now