chore(http_server): emit pre-request web event - #19799
Conversation
Codeowners resolved asResolved from the full PR diff against |
Dependency direction analysis
|
Circular import analysis
|
|
BenchmarksBenchmark execution time: 2026-08-20 21:37:47 Comparing candidate commit 5acedc0 in PR branch Found 0 performance improvements and 8 performance regressions! Performance is the same for 614 metrics, 10 unstable metrics.
|
There was a problem hiding this comment.
Pull request overview
Adds default-enabled http.server instrumentation that emits the pre-request event without creating spans.
Changes:
- Wraps successful
BaseHTTPRequestHandler.parse_requestcalls. - Registers configuration, auto-patching, documentation, and test-suite metadata.
- Adds patch lifecycle and event-dispatch coverage.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
ddtrace/contrib/internal/http_server/patch.py |
Implements patching and event dispatch. |
ddtrace/contrib/internal/http_server/__init__.py |
Documents the integration. |
ddtrace/_monkey.py |
Enables automatic patching. |
supported-configurations.json |
Registers the enable flag. |
ddtrace/internal/settings/_supported_configurations.py |
Updates generated configuration data. |
scripts/supported_configurations.py |
Supports integrations without service configuration. |
scripts/integration_registry/registry.yaml |
Registers integration metadata. |
docs/integrations.rst |
Adds documentation discovery. |
riotfile.py |
Defines the test environment. |
tests/contrib/suitespec.yml |
Adds suite-selection metadata. |
tests/contrib/http_server/__init__.py |
Marks the test package. |
tests/contrib/http_server/test_http_server_patch.py |
Tests patch lifecycle. |
tests/contrib/http_server/test_microvm_identity_refresh.py |
Tests event dispatch behavior. |
.riot/requirements/180047f.txt |
Adds Python 3.9 test dependencies. |
.riot/requirements/3cb8c3c.txt |
Adds Python 3.10 test dependencies. |
.riot/requirements/13ed954.txt |
Adds Python 3.11 test dependencies. |
.riot/requirements/1362718.txt |
Adds Python 3.12 test dependencies. |
.riot/requirements/43423a3.txt |
Adds Python 3.13 test dependencies. |
.riot/requirements/1638d0f.txt |
Adds Python 3.14 test dependencies. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
|
|
||
| def _get_http_server() -> ModuleType: | ||
| # DEV: When patch() is called from the on-import hook, we're running from inside |
Description
Follow-up to #19779. Adds a stdlib
http_serverintegration for rawhttp.serverhandlers that need to emitWEB_REQUEST_STARTINGbefore request handling continues.The integration wraps
http.server.BaseHTTPRequestHandler.parse_requestand dispatches the event with(method, path)after the request line parses successfully. It does not create spans. It is default-enabled like other auto-patched integrations and can be disabled withDD_TRACE_HTTP_SERVER_ENABLED=false; it intentionally has no service-name config.This PR also adds the integration metadata needed for auto-patching, docs discovery, suite selection, and supported-configuration validation. The
.riot/requirements/*.txtfiles are generated locks for the newhttp_serverRiot env across the Python versions selected byselect_pys(). The supported-configuration checker now allows no-span integrations to skipDD_{NAME}_SERVICE[_NAME]entries.Testing
scripts/lint fmt ddtrace/_monkey.py ddtrace/contrib/internal/http_server/__init__.py ddtrace/contrib/internal/http_server/patch.py ddtrace/internal/settings/_supported_configurations.py riotfile.py scripts/supported_configurations.py tests/contrib/http_server/__init__.py tests/contrib/http_server/test_http_server_patch.py tests/contrib/http_server/test_microvm_identity_refresh.pyscripts/lint style ddtrace/_monkey.py ddtrace/contrib/internal/http_server/__init__.py ddtrace/contrib/internal/http_server/patch.py ddtrace/internal/settings/_supported_configurations.py riotfile.py scripts/supported_configurations.py tests/contrib/http_server/__init__.py tests/contrib/http_server/test_http_server_patch.py tests/contrib/http_server/test_microvm_identity_refresh.pyscripts/lint supported-config-checkscripts/run-tests --venv 13ed954 tests/contrib/http_serverRelease note
No Reno fragment. This is internal runtime-identity plumbing for a no-span integration and does not change trace output by itself. Use
changelog/no-changelog.Additional Notes
Depends on #19779 and #19778.