Rauhan commited on
Commit
6b7ee72
·
1 Parent(s): 3f68b77

UPDATE: exportToDashboard

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -4,6 +4,7 @@ from api_analytics.fastapi import Analytics
4
  from supabase import create_client
5
  from fastapi import FastAPI
6
  import uvicorn
 
7
  import os
8
 
9
  client = create_client(
@@ -32,6 +33,13 @@ app.add_middleware(
32
  api_key = os.environ["FASTAPI_ANALYTICS_KEY"]
33
  )
34
 
 
 
 
 
 
 
 
35
  app.include_router(authentication.router, prefix = "/auth", tags = ["Authentication"])
36
  app.include_router(projectManager.router, prefix = "/projects", tags = ["Project Management"])
37
  app.include_router(dataLoader.router, prefix = "/loaders", tags = ["Data Loader"])
 
4
  from supabase import create_client
5
  from fastapi import FastAPI
6
  import uvicorn
7
+ import psutil
8
  import os
9
 
10
  client = create_client(
 
33
  api_key = os.environ["FASTAPI_ANALYTICS_KEY"]
34
  )
35
 
36
+ @app.on_event("startup")
37
+ async def stats():
38
+ memory = psutil.virtual_memory()
39
+ cpu_usage = psutil.cpu_percent(interval=1, percpu=True)
40
+ print(f"RAM Usage Percentage: {memory.percent}%")
41
+ print(f"Total CPU Usage Per Core: {cpu_usage}")
42
+
43
  app.include_router(authentication.router, prefix = "/auth", tags = ["Authentication"])
44
  app.include_router(projectManager.router, prefix = "/projects", tags = ["Project Management"])
45
  app.include_router(dataLoader.router, prefix = "/loaders", tags = ["Data Loader"])