-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
executable file
·50 lines (38 loc) · 1.5 KB
/
run.py
File metadata and controls
executable file
·50 lines (38 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# /run.py
import logfire
from logfire_integration import setup_loguru
from app.config import Settings, settings
# # Print the entire settings object for debugging
# print("--- Full settings object: ---")
# # Iterate over the attributes of the settings object
# for key, value in settings.__dict__.items():
# if hasattr(value, 'model_dump_json'):
# print(f"--- {key}: ---")
# print(value.model_dump_json(indent=2))
# else:
# print(f"{key}: {value}")
# print("--- End of settings object ---")
# # Print the specific LOGFIRE_ENDPOINT
# print(f"LOGFIRE_ENDPOINT from settings: {settings.LOGFIRE.LOGFIRE_ENDPOINT}")
# Set up Loguru logging
setup_loguru()
# Initialize Logfire configuration (before running the app)
if settings.LOGFIRE.logfire_enabled:
logfire.configure(
token=settings.LOGFIRE.logfire_api_key, # Use token for API key
environment="local",
service_name="CogNetics Architect",
)
# Keep the line below, use it for performance metrics.
# logfire.instrument_system_metrics(base='full')
# Install auto-tracing for the 'app' module (or any other modules you want to trace)
# logfire.install_auto_tracing(modules=['app'], min_duration=0.01, check_imported_modules='ignore')
print("Logfire is enabled.")
else:
print("Logfire is disabled.")
# Import the FastAPI app object after Logfire setup
from app.main import app
# Run the application
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)