Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ stripe = [
logfire = [
"logfire[fastapi,sqlalchemy,redis,httpx]>=4.32.1",
]
httrace = [
"httrace>=0.1.1",
]
all = [
"dogeapi[email,oauth,ai,stripe,logfire]",
"dogeapi[email,oauth,ai,stripe,logfire,httrace]",
]

[dependency-groups]
Expand Down Expand Up @@ -114,7 +117,7 @@ disallow_untyped_defs = true
exclude = ["alembic/versions/", "tests/"]

[[tool.mypy.overrides]]
module = ["resend.*", "stripe.*", "authlib.*", "logfire.*", "fastapi_llm_gateway.*"]
module = ["resend.*", "stripe.*", "authlib.*", "logfire.*", "fastapi_llm_gateway.*", "httrace.*"]
ignore_missing_imports = true

[tool.pytest.ini_options]
Expand Down
11 changes: 11 additions & 0 deletions backend/src/dogeapi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,17 @@ async def root() -> dict[str, str]:

app.include_router(ai_router)

if settings.FEATURE_HTTRACE and settings.HTTRACE_API_KEY:
from httrace import HttraceCaptureMiddleware

app.add_middleware(
HttraceCaptureMiddleware,
api_key=settings.HTTRACE_API_KEY,
service=settings.HTTRACE_SERVICE,
sample_rate=settings.HTTRACE_SAMPLE_RATE,
exclude_paths=["/healthz", "/metrics", "/favicon.ico"],
)

# Admin endpoints are always-on; the dependency rejects non-superadmins.
from dogeapi.admin.router import router as admin_router

Expand Down
5 changes: 5 additions & 0 deletions backend/src/dogeapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ class Settings(BaseSettings):
FEATURE_AI_CHAT: bool = False
FEATURE_LOGFIRE: bool = False
FEATURE_STRIPE: bool = False
FEATURE_HTTRACE: bool = False

HTTRACE_API_KEY: str = ""
HTTRACE_SERVICE: str = "ai-template"
HTTRACE_SAMPLE_RATE: float = 0.1

EMAIL_PROVIDER: EmailProvider = "smtp"
EMAIL_FROM: str = "AI Template <noreply@dogeapi.local>"
Expand Down