Skip to content

Commit 3bb209a

Browse files
authored
chore(metrics): add prometheus query interval
1 parent 467ef80 commit 3bb209a

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

rootfs/api/monitor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ async def last_metrics(namespace):
119119
if not settings.DRYCC_METRICS_CONFIG:
120120
return
121121
promql = query_last_metrics_promql_tpl % (
122-
'|'.join(settings.DRYCC_METRICS_CONFIG.keys()), namespace, '1m')
122+
'|'.join(settings.DRYCC_METRICS_CONFIG.keys()),
123+
namespace,
124+
settings.DRYCC_METRICS_INTERVAL)
123125
url = urljoin(settings.DRYCC_PROMETHEUS_URL, "/api/v1/query")
124126
params = {"query": promql, "start": int(time.time() - 60)}
125127
async with aiohttp.ClientSession() as session:

rootfs/api/settings/production.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@
281281
with open(DRYCC_METRICS_CONFIG_PATH) as fd:
282282
DRYCC_METRICS_CONFIG = json.load(fd)
283283
DRYCC_METRICS_EXPIRY = int(os.environ.get('DRYCC_METRICS_EXPIRY', '20'))
284+
DRYCC_METRICS_INTERVAL = os.environ.get('DRYCC_METRICS_INTERVAL', '5m')
284285

285286
# security keys and auth tokens
286287
random_secret = 'CHANGEME_sapm$s%upvsw5l_zuy_&29rkywd^78ff(qi*#@&*^'

0 commit comments

Comments
 (0)