Skip to content

feat: integrate httrace HTTP traffic capture middleware - #52

Merged
yezz123 merged 1 commit into
yezz123:mainfrom
imLostify:feat/httrace-integration
May 4, 2026
Merged

yezz123 merged 1 commit into
yezz123:mainfrom
imLostify:feat/httrace-integration

Conversation

@imLostify

Copy link
Copy Markdown
Contributor

Closes #30

Integrates httrace as a feature-gated optional integration, following the existing FEATURE_* pattern used by audit-log, rate-limiting, logfire, etc.

What was added

  • FEATURE_HTTRACE flag (default: false) - zero runtime cost when disabled
  • HTTRACE_API_KEY, HTTRACE_SERVICE, HTTRACE_SAMPLE_RATE settings
  • httrace optional dependency (uv sync --extra httrace)
  • Middleware registered in create_app() only when flag and API key are set

Usage

FEATURE_HTTRACE=true
HTTRACE_API_KEY=ht_...
HTTRACE_SERVICE=ai-template
HTTRACE_SAMPLE_RATE=0.1

Files changed

  • backend/src/dogeapi/settings.py - 4 new settings
  • backend/src/dogeapi/main.py - middleware block after FEATURE_AI_CHAT
  • backend/pyproject.toml - httrace optional dependency and mypy override

Adds httrace as a feature-gated optional integration following the
existing FEATURE_* pattern. When FEATURE_HTTRACE=true and
HTTRACE_API_KEY is set, the HttraceCaptureMiddleware is registered to
capture HTTP traffic and auto-generate integration tests.

New settings:
- FEATURE_HTTRACE (default: false)
- HTTRACE_API_KEY
- HTTRACE_SERVICE (default: ai-template)
- HTTRACE_SAMPLE_RATE (default: 0.1)

Install with: uv sync --extra httrace

@yezz123 yezz123 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✨

@yezz123
yezz123 merged commit e0a194e into yezz123:main May 4, 2026
2 checks passed
@imLostify
imLostify deleted the feat/httrace-integration branch May 5, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

I added httrace to DogeAPI and got 13 integration tests without writing a single one

2 participants