settings: don't use explicitly statsd because it's optional
This commit is contained in:
parent
119c3c406b
commit
f18966f6ea
1 changed files with 12 additions and 6 deletions
|
|
@ -19,9 +19,10 @@
|
|||
# and proprietary license terms, please see https://rhodecode.com/licenses/
|
||||
|
||||
import os
|
||||
import re
|
||||
import hashlib
|
||||
import logging
|
||||
import re
|
||||
import time
|
||||
from collections import namedtuple
|
||||
from functools import wraps
|
||||
import bleach
|
||||
|
|
@ -34,7 +35,7 @@ from rhodecode.lib.vcs.backends import base
|
|||
from rhodecode.lib.statsd_client import StatsdClient
|
||||
from rhodecode.model import BaseModel
|
||||
from rhodecode.model.db import (
|
||||
RepoRhodeCodeUi, RepoRhodeCodeSetting, RhodeCodeUi, RhodeCodeSetting, CacheKey)
|
||||
RepoRhodeCodeUi, RepoRhodeCodeSetting, RhodeCodeUi, RhodeCodeSetting)
|
||||
from rhodecode.model.meta import Session
|
||||
|
||||
|
||||
|
|
@ -256,11 +257,16 @@ class SettingsModel(BaseModel):
|
|||
}
|
||||
return settings
|
||||
|
||||
statsd = StatsdClient.statsd
|
||||
with statsd.timer('rhodecode_settings_timing.histogram', auto_send=True) as tmr:
|
||||
result = _get_all_settings('rhodecode_settings', cache_key)
|
||||
start = time.time()
|
||||
result = _get_all_settings('rhodecode_settings', cache_key)
|
||||
compute_time = time.time() - start
|
||||
|
||||
statsd = StatsdClient.statsd
|
||||
if statsd:
|
||||
elapsed_time_ms = round(1000.0 * compute_time) # use ms only
|
||||
statsd.timing("rhodecode_settings_timing.histogram", elapsed_time_ms,
|
||||
use_decimals=False)
|
||||
|
||||
compute_time = tmr.ms / 1000.
|
||||
log.debug('Fetching app settings for key: %s took: %.4fs', cache_key, compute_time)
|
||||
|
||||
return result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue