-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor startup process and instrument
httpx
- Loading branch information
1 parent
84adb8e
commit 19e3ec8
Showing
3 changed files
with
27 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from contextlib import suppress | ||
|
||
with suppress(ModuleNotFoundError): | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv(override=True) | ||
|
||
from .utils.config import env | ||
|
||
if env.logfire_token: | ||
import logfire | ||
|
||
logfire.configure() | ||
logfire.info("app started", **env.model_dump()) | ||
logfire.instrument_httpx() | ||
logfire.instrument_openai() | ||
logfire.instrument_anthropic() | ||
|
||
from .entry import app | ||
|
||
logfire.instrument_fastapi(app) | ||
|
||
from .utils.load import generate_pyi | ||
|
||
generate_pyi() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters