lazy-load loadfire and ldap lib for faster startup time

This commit is contained in:
Nick Sweeting 2024-10-03 17:39:39 -07:00
parent 563e4de678
commit 1492c02bfa
No known key found for this signature in database
4 changed files with 71 additions and 52 deletions

View file

@ -823,15 +823,15 @@ def setup_django(out_dir: Path | None=None, check_db=False, config: benedict=CON
bump_startup_progress_bar()
# https://docs.pydantic.dev/logfire/integrations/django/ Logfire Debugging
if settings.DEBUG_LOGFIRE:
from opentelemetry.instrumentation.sqlite3 import SQLite3Instrumentor
SQLite3Instrumentor().instrument()
# if settings.DEBUG_LOGFIRE:
# from opentelemetry.instrumentation.sqlite3 import SQLite3Instrumentor
# SQLite3Instrumentor().instrument()
import logfire
# import logfire
logfire.configure()
logfire.instrument_django(is_sql_commentor_enabled=True)
logfire.info(f'Started ArchiveBox v{CONSTANTS.VERSION}', argv=sys.argv)
# logfire.configure()
# logfire.instrument_django(is_sql_commentor_enabled=True)
# logfire.info(f'Started ArchiveBox v{CONSTANTS.VERSION}', argv=sys.argv)
except KeyboardInterrupt:
raise SystemExit(2)