Skip to content

feat: re-enable aiohttp/psycopg2 and add falcon v3/sanic v2 plugins#389

Merged
wu-sheng merged 12 commits intomasterfrom
feat/plugin-coverage-3.12
Apr 12, 2026
Merged

feat: re-enable aiohttp/psycopg2 and add falcon v3/sanic v2 plugins#389
wu-sheng merged 12 commits intomasterfrom
feat/plugin-coverage-3.12

Conversation

@wu-sheng
Copy link
Copy Markdown
Member

Summary

Re-enable previously skipped plugins and add new plugins for modern framework versions. All changes verified locally with span data validation on Python 3.13.

Plugin changes

Plugin Change Tested Versions Verified
aiohttp Re-enable, fix _handle_request sig + yarl URL fallback 3.9, 3.11 PASSED
psycopg2 Re-enable with 2.9.* wildcard 2.9.* (→2.9.11) PASSED
falcon v3 New sw_falcon_v3.py, hooks falcon.App.__call__ 3.1, 4.0 PASSED (4.0)
sanic v2 New sw_sanic_v2.py, uses signal listeners 23.12, 24.12 PASSED

Key design decisions

sanic v2 — signal listeners instead of monkey-patch:
Sanic's touchup system recompiles handle_request at startup via compile() + exec() with Sanic's own module_globals, losing the patched function's closure variables (NameError: name 'Carrier' is not defined). Using @app.on_request / @app.on_response signal listeners avoids this — they are registered callbacks, not recompiled methods.

aiohttp — yarl URL fallback:
yarl >= 1.18 rejects Host containing : (e.g., 0.0.0.0:9090). request.url triggers URL.build(host=self.host) which fails. Added try/except fallback to construct URL from request.scheme, request.host, and request.path.

falcon v3 — falcon 3.1 skipped on 3.13+:
falcon 3.1 has no cp313 wheels and fails to build from source. Only falcon 4.0 is tested on Python 3.13+.

E2E flaky fix

tracing-cases.yaml and logging-cases.yaml: change endpointnames[0] to endpointnames[] in yq queries. The endpoint names array ordering from OAP is non-deterministic — using [] matches the endpoint at any position.

Test plan

  • aiohttp 3.9/3.11 — PASSED locally (Python 3.13, span validation)
  • psycopg2-binary 2.9.* — PASSED locally (Python 3.13, span validation)
  • falcon 4.0 — PASSED locally (Python 3.13, span validation)
  • sanic 23.12/24.12 — PASSED locally (Python 3.13, span validation)
  • CI: all existing tests still pass on 3.10/3.11/3.12
  • CI: new falcon v3 and sanic v2 tests pass
  • CI: E2E gRPC-single-process no longer flaky

🤖 Generated with Claude Code

Re-enable previously skipped plugins and add new plugins for modern
framework versions. Also fix flaky E2E test.

aiohttp (re-enabled):
- Add support_matrix: >=3.10 with versions 3.9, 3.11
- Fix _handle_request signature: add *args for forward compat
  (aiohttp added request_handler positional param)
- Fix request.url ValueError with yarl >= 1.18: fallback to
  manual URL construction when Host contains ':'
- Verified: aiohttp 3.9 and 3.11 PASSED on Python 3.13

psycopg2 (re-enabled):
- Change support_matrix from >=3.10: [] to >=3.10: ['2.9.*']
  (wildcard so pip resolves to 2.9.11 which has cp313 wheels)
- Verified: psycopg2-binary 2.9.* PASSED on Python 3.13

falcon v3 (new plugin):
- New sw_falcon_v3.py hooking falcon.App.__call__ (falcon.API
  removed in falcon 5.0)
- support_matrix: >=3.13: ['4.0'], >=3.10: ['3.1', '4.0']
  (falcon 3.1 has no cp313 wheels, only test 4.0 on 3.13+)
- New test directory with falcon-native services (wsgiref)
- Verified: falcon 4.0 PASSED on Python 3.13

sanic v2 (new plugin):
- New sw_sanic_v2.py using Sanic signal listeners (@app.on_request
  / @app.on_response) instead of monkey-patching handle_request
- Reason: Sanic's touchup system recompiles handle_request at
  startup via compile()+exec(), losing the patched function's
  globals (NameError: Carrier). Signal listeners avoid this.
- support_matrix: >=3.10: ['23.12', '24.12']
- New test directory with single_process=True services
- Verified: sanic 23.12 and 24.12 PASSED on Python 3.13

E2E flaky fix:
- tracing-cases.yaml and logging-cases.yaml: change
  endpointnames[0] to endpointnames[] in yq select queries
- The endpoint names array order is non-deterministic from OAP;
  using [] matches at any position instead of assuming index 0

Regenerate Plugins.md.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@wu-sheng wu-sheng requested a review from kezhenxu94 April 12, 2026 08:57
@wu-sheng wu-sheng added this to the 1.3.0 milestone Apr 12, 2026
@wu-sheng wu-sheng added enhancement New feature or request plugin Plugin labels Apr 12, 2026
wu-sheng and others added 6 commits April 12, 2026 17:04
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Convention: '4.2.*' lets pip resolve to the latest 4.2.x patch release,
instead of pinning to 4.2.0. Applied to all newly added/updated plugins.

Update plugin-test and new-plugin skills to document this convention.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use exact versions (e.g., '4.2.0') instead of wildcards ('4.2.*')
to ensure deterministic CI results. Wildcard versions could resolve
to different patches between runs, causing flaky failures.

Updated versions:
- falcon: 3.1.3, 4.2.0
- sanic: 23.12.2, 24.12.0
- aiohttp: 3.9.5, 3.11.18
- psycopg2-binary: 2.9.11

Update plugin-test and new-plugin skills with pinning convention.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use wildcard versions (e.g., '4.*', '3.11.*') so pip always resolves
to the latest patch. This keeps CI testing fresh and Plugins.md
doc meaningful — showing version ranges instead of stale pins.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The traces-list.yml expected '/artist-provider' in endpointnames,
but traces can have either '/artist-provider' or '/artist-consumer'
depending on reporting order. Use notEmpty check instead of
hardcoding a specific endpoint name.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The trace originates at the consumer (trigger sends POST to
/artist-consumer), so the trace's entry endpoint is /artist-consumer,
not /artist-provider. The previous expected data was incorrect —
it passed intermittently when the OAP happened to return
/artist-provider first.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@wu-sheng wu-sheng force-pushed the feat/plugin-coverage-3.12 branch 2 times, most recently from 7fc99d7 to 1ef4e89 Compare April 12, 2026 10:01
The endpointnames value is non-deterministic — different E2E test
configurations produce different entry endpoints (/artist-consumer
in gRPC tests, /artist-provider in profiling tests). Use notEmpty
check instead of hardcoding either endpoint name.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@wu-sheng wu-sheng force-pushed the feat/plugin-coverage-3.12 branch from 1ef4e89 to 2dc695b Compare April 12, 2026 10:04
wu-sheng and others added 4 commits April 12, 2026 19:23
sanic 23.12.* has 'protocol.connection_task uncaught' errors on
Python 3.14. Only test 24.12.* on 3.14+.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Plugin tests validate trace segments only. The log reporter sends
werkzeug/framework log data to the mock collector, which causes
/dataValidate to fail when expected.data.yml doesn't include log items.

Disable log reporting in the base docker-compose config so all
plugin tests only produce segment data for validation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The validate() method retried only once with 10s wait. For tests with
slow external services (e.g., happybase/HBase), segments may not be
reported to the collector in time. Increase to 3 retries with backoff
(5s, 10s, 15s = 30s total max wait).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@wu-sheng wu-sheng merged commit 71640af into master Apr 12, 2026
75 checks passed
@wu-sheng wu-sheng deleted the feat/plugin-coverage-3.12 branch April 12, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request plugin Plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants