Dev (#2476)
* refactor(chalice): upgraded dependencies * refactor(chalice): upgraded dependencies feat(chalice): support heatmaps * fix(chalice): fixed Math-operators validation refactor(chalice): search for sessions that have events for heatmaps * refactor(chalice): search for sessions that have at least 1 location event for heatmaps * refactor(chalice): upgraded dependencies * refactor(chalice): upgraded dependencies feat(chalice): support heatmaps * fix(chalice): fixed Math-operators validation refactor(chalice): search for sessions that have events for heatmaps * refactor(chalice): search for sessions that have at least 1 location event for heatmaps * refactor(chalice): upgraded dependencies refactor(crons): upgraded dependencies refactor(alerts): upgraded dependencies * feat(chalice): get top 10 values for autocomplete CH * refactor(chalice): cleaned code refactor(chalice): upgraded dependencies refactor(alerts): upgraded dependencies refactor(crons): upgraded dependencies * feat(chalice): autocomplete return top 10 with stats * fix(chalice): fixed autocomplete top 10 meta-filters * refactor(chalice): refactored heath-check package refactor(chalice): enhanced scope caching dev(chalice): reduced Spot JWT TTL for testing purposes
This commit is contained in:
parent
ae7ad43afe
commit
3e6a1e5468
9 changed files with 14 additions and 32 deletions
|
|
@ -11,7 +11,7 @@ from chalicelib.utils.TimeUTC import TimeUTC
|
|||
def app_connection_string(name, port, path):
|
||||
namespace = config("POD_NAMESPACE", default="app")
|
||||
conn_string = config("CLUSTER_URL", default="svc.cluster.local")
|
||||
return f"http://{'.'.join(filter(None,[name,namespace,conn_string]))}:{port}/{path}"
|
||||
return f"http://{'.'.join(filter(None, [name, namespace, conn_string]))}:{port}/{path}"
|
||||
|
||||
|
||||
HEALTH_ENDPOINTS = {
|
||||
|
|
@ -174,7 +174,7 @@ def __get_sessions_stats(*_):
|
|||
}
|
||||
|
||||
|
||||
def get_health():
|
||||
def get_health(tenant_id=None):
|
||||
health_map = {
|
||||
"databases": {
|
||||
"postgres": __check_database_pg
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import schemas
|
|||
from chalicelib.utils import helper
|
||||
from chalicelib.utils import pg_client
|
||||
|
||||
cache = TTLCache(maxsize=1, ttl=24 * 60 * 60)
|
||||
cache = TTLCache(maxsize=1, ttl=60)
|
||||
|
||||
|
||||
@cached(cache)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ JWT_REFRESH_SECRET="SET A RANDOM STRING HERE"
|
|||
JWT_SPOT_REFRESH_EXPIRATION=604800
|
||||
JWT_SPOT_REFRESH_SECRET="SET A RANDOM STRING HERE"
|
||||
JWT_SPOT_SECRET=SECRET
|
||||
JWT_SPOT_EXPIRATION=6000
|
||||
JWT_SPOT_EXPIRATION=300
|
||||
jwt_secret="SET A RANDOM STRING HERE"
|
||||
pg_dbname=postgres
|
||||
pg_host=postgresql.db.svc.cluster.local
|
||||
|
|
|
|||
|
|
@ -1,17 +1,20 @@
|
|||
from decouple import config
|
||||
from fastapi import Depends
|
||||
from fastapi import HTTPException, status
|
||||
|
||||
import schemas
|
||||
from chalicelib.core import health, tenants
|
||||
from or_dependencies import OR_context
|
||||
from routers.base import get_routers
|
||||
|
||||
public_app, app, app_apikey = get_routers()
|
||||
|
||||
|
||||
@app.get('/healthz', tags=["health-check"])
|
||||
def get_global_health_status():
|
||||
def get_global_health_status(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
if config("LOCAL_DEV", cast=bool, default=False):
|
||||
return {"data": ""}
|
||||
return {"data": health.get_health()}
|
||||
return {"data": health.get_health(context.tenant_id)}
|
||||
|
||||
|
||||
if not tenants.tenants_exists_sync(use_pool=False):
|
||||
|
|
|
|||
1
ee/api/.gitignore
vendored
1
ee/api/.gitignore
vendored
|
|
@ -275,3 +275,4 @@ Pipfile.lock
|
|||
/chalicelib/core/db_request_handler.py
|
||||
/routers/subs/spot.py
|
||||
/chalicelib/utils/or_cache/
|
||||
/routers/subs/health.py
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import schemas
|
|||
from chalicelib.utils import helper
|
||||
from chalicelib.utils import pg_client
|
||||
|
||||
cache = TTLCache(maxsize=1, ttl=24 * 60 * 60)
|
||||
cache = TTLCache(maxsize=1000, ttl=60)
|
||||
|
||||
|
||||
@cached(cache)
|
||||
|
|
|
|||
|
|
@ -95,4 +95,5 @@ rm -rf ./chalicelib/core/usability_testing/
|
|||
rm -rf ./chalicelib/core/db_request_handler.py
|
||||
rm -rf ./chalicelib/core/db_request_handler.py
|
||||
rm -rf ./routers/subs/spot.py
|
||||
rm -rf ./chalicelib/utils/or_cache
|
||||
rm -rf ./chalicelib/utils/or_cache
|
||||
rm -rf ./routers/subs/health.py
|
||||
|
|
@ -51,7 +51,7 @@ JWT_REFRESH_SECRET="SET A RANDOM STRING HERE"
|
|||
JWT_SPOT_REFRESH_EXPIRATION=604800
|
||||
JWT_SPOT_REFRESH_SECRET="SET A RANDOM STRING HERE"
|
||||
JWT_SPOT_SECRET=SECRET
|
||||
JWT_SPOT_EXPIRATION=6000
|
||||
JWT_SPOT_EXPIRATION=300
|
||||
jwt_secret="SET A RANDOM STRING HERE"
|
||||
KAFKA_SERVERS=kafka.db.svc.cluster.local:9092
|
||||
KAFKA_USE_SSL=false
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
from fastapi import Depends
|
||||
from fastapi import HTTPException, status
|
||||
|
||||
import schemas
|
||||
from chalicelib.core import health, tenants
|
||||
from or_dependencies import OR_context
|
||||
from routers.base import get_routers
|
||||
|
||||
public_app, app, app_apikey = get_routers()
|
||||
|
||||
|
||||
@app.get('/healthz', tags=["health-check"])
|
||||
def get_global_health_status(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": health.get_health(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
if not tenants.tenants_exists_sync(use_pool=False):
|
||||
@public_app.get('/health', tags=["health-check"])
|
||||
async def get_public_health_status():
|
||||
if await tenants.tenants_exists():
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=f"Not Found")
|
||||
|
||||
return {"data": health.get_health()}
|
||||
Loading…
Add table
Reference in a new issue