Преглед изворни кода

chore: Add processId field for metrics of threads/db-pool-stat/health (#6797)

Co-authored-by: 老潮 <zhangyongsheng@3vjia.com>
Co-authored-by: takatost <takatost@users.noreply.github.com>
Co-authored-by: takatost <takatost@gmail.com>
tags/0.6.16
Ever пре 1 година
родитељ
комит
545d3c5a93
No account linked to committer's email address
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3
    0
      api/app.py

+ 3
- 0
api/app.py Прегледај датотеку

@app.route('/health') @app.route('/health')
def health(): def health():
return Response(json.dumps({ return Response(json.dumps({
'pid': os.getpid(),
'status': 'ok', 'status': 'ok',
'version': app.config['CURRENT_VERSION'] 'version': app.config['CURRENT_VERSION']
}), status=200, content_type="application/json") }), status=200, content_type="application/json")
}) })


return { return {
'pid': os.getpid(),
'thread_num': num_threads, 'thread_num': num_threads,
'threads': thread_list 'threads': thread_list
} }
def pool_stat(): def pool_stat():
engine = db.engine engine = db.engine
return { return {
'pid': os.getpid(),
'pool_size': engine.pool.size(), 'pool_size': engine.pool.size(),
'checked_in_connections': engine.pool.checkedin(), 'checked_in_connections': engine.pool.checkedin(),
'checked_out_connections': engine.pool.checkedout(), 'checked_out_connections': engine.pool.checkedout(),

Loading…
Откажи
Сачувај