Add QwenPaw instrumentation - #311
Conversation
Traces each AgentRunner.query_handler turn as an invoke_agent span per the GenAI semantic conventions, with unit and Weaver conformance tests. Model and tool execution are delegated to AgentScope, so this package emits no chat or execute_tool spans. Change-Id: I11606f53aab9d7f90acd8c712a17337bbf3b67a4 Co-developed-by: Cursor <noreply@cursor.com> Assisted-by: Claude Fable 5
Change-Id: I387b13c54797040a9b37fdf4af1f39b5dd4a5391 Co-developed-by: Cursor <noreply@cursor.com>
Pull request dashboard statusWaiting on the author · refreshed 2026-08-12 11:25 UTC Respond to 1 review item (e.g. link a commit, explain why not, ask a follow-up):
Status above doesn't look right?
|
There was a problem hiding this comment.
Pull request overview
Adds a new GenAI instrumentation package, opentelemetry-instrumentation-genai-qwenpaw, to trace QwenPaw AgentRunner.query_handler turns as invoke_agent operations using opentelemetry-util-genai, and wires the package into the monorepo’s test/release automation.
Changes:
- Introduces the new QwenPaw instrumentor implementation (async-generator wrapping + message mapping helpers).
- Adds unit tests and a conformance scenario for the single emitted semconv operation (
invoke_agent), plus tox env wiring. - Registers the new package in workspace deps, release workflows, and per-package tooling configs.
Reviewed changes
Copilot reviewed 29 out of 32 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tox.ini | Adds tox envs/deps/commands for qwenpaw oldest/latest/conformance + lint; adjusts typecheck install. |
| pyproject.toml | Adds qwenpaw workspace dependency and pyright include/exclude entries. |
| instrumentation/README.md | Lists the new qwenpaw instrumentation in the workspace table. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/test_query_handler.py | End-to-end async tests for query_handler span/metric behavior and error cases. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/test_message_mapping.py | Unit tests for call parsing + message mapping utilities. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/test_instrumentor.py | Tests instrumentation dependency metadata and uninstrument behavior. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/test_conformance.py | Runs the per-scenario conformance runner for qwenpaw. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/requirements.oldest.txt | Defines oldest-factor test-only dependency pins (currently none). |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/requirements.latest.txt | Pins latest qwenpaw and installs editable util/instrumentation for tests. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/harness.py | Test harness to drive query_handler without real model/tool execution. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/conftest.py | Registers shared fixtures and defines package-local test fixtures. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/conformance/invoke_agent.py | Conformance scenario for one invoke_agent turn. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/conformance/init.py | Marks conformance package. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/init.py | Marks tests package. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/src/opentelemetry/instrumentation/genai/qwenpaw/version.py | Adds package version module. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/src/opentelemetry/instrumentation/genai/qwenpaw/utils.py | Adds helpers for parsing/mapping input/output messages. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/src/opentelemetry/instrumentation/genai/qwenpaw/patch.py | Implements async stream wrapper + wrapt wrapper for query_handler. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/src/opentelemetry/instrumentation/genai/qwenpaw/package.py | Declares instruments metadata for the instrumentor. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/src/opentelemetry/instrumentation/genai/qwenpaw/init.py | Adds QwenPawInstrumentor implementation + package docstring. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/README.rst | Adds package README for PyPI long description. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/pyproject.toml | Adds package build metadata, deps, and instrumentor entry point. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/LICENSE | Adds Apache 2.0 license file for the new package. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/.changelog/311.added | Adds towncrier fragment for the new instrumentation. |
| instrumentation/opentelemetry-instrumentation-genai-qwenpaw/.changelog/.gitignore | Ensures the changelog directory is retained in git. |
| eachdist.ini | Adds qwenpaw to per-dist tooling configuration. |
| dev-requirements-conformance.txt | Adds OTLP meta/proto-http pins needed by some conformance dependencies. |
| .github/workflows/release-package.yml | Adds qwenpaw to the release workflow package choice list. |
| .github/workflows/prepare-release.yml | Adds qwenpaw to the prepare-release workflow package choice list. |
| .github/workflows/prepare-backport-patch.yml | Adds qwenpaw to the backport patch workflow package choice list. |
| .github/workflows/bump-package-minor.yml | Adds qwenpaw to the bump-minor workflow package choice list. |
| .github/workflows/bump-package-major.yml | Adds qwenpaw to the bump-major workflow package choice list. |
Change-Id: I46107eb41fbacc8c5d6e846e8a9f6cd96dbb8cd9 Co-developed-by: Cursor <noreply@cursor.com>
- Wire the GenAI completion hook through instrument(), matching the other instrumentations, and document it. - Fix the documented content-capture values: the util expects a ContentCapturingMode name, not "true". - Close the wrapped async generator when the caller raises inside "async with", which previously leaked a suspended generator. - Mark the instruments extra with the Python range qwenpaw supports so it stays installable on 3.14 tooling interpreters. - Ignore "astroid" in codespell; it is a locked transitive dependency name. Change-Id: I06dc0f24f110bf8a28a9a7693cfd8efc39a0888d Co-developed-by: Cursor <noreply@cursor.com> Assisted-by: Claude Opus 4.6
|
Hi @123liuziming — just a friendly reminder that this pull request is waiting on you. There are still items that need your attention. See the dashboard status comment for the full list. You don't need to push a code change to hand it back — replying to move each discussion forward is enough, whether that's answering a question, explaining why no change is needed, or asking a follow-up. The dashboard then automatically routes it back to reviewers. If you believe this pull request is incorrectly routed as waiting on the author, comment |
- Ship the standard examples/manual (with custom_hook.py) and examples/zero-code layouts and link them from the README. - Drop the feature-specific validate() override from the conformance scenario; conformance validates the telemetry shape and the specific attribute values are already covered by unit tests. - Start the new package at 1.0b0.dev like the other unreleased packages. Change-Id: Ifc74679047aec04f06fe3dad8be85bece499c5cf Co-developed-by: Qoder <noreply@qoder.com> Assisted-by: Claude Opus 4.6
…tation Change-Id: I867f7aa66287d1ebd69211f64309e68e5fb8c3b3 Co-developed-by: Qoder <noreply@qoder.com>
After merging main, util-genai records time_to_first_chunk for streamed invocations; declare it in the scenario along with the known gen_ai.provider.name gap (QwenPaw delegates model calls to AgentScope, so no provider applies to invoke_agent). Change-Id: I9a74da28a3cef297c62efec511515a00c6e4f3bc Co-developed-by: Qoder <noreply@qoder.com> Assisted-by: Claude Opus 4.6
eternalcuriouslearner
left a comment
There was a problem hiding this comment.
LGTM!! Minor nit and can you please resolve the merge conflicts?
…tation Change-Id: I8f6c901c598dba0b04a2b1fffbff621506edd751 Co-developed-by: Qoder <noreply@qoder.com>
Annotate the runner instance as object instead of Any: the runner is only attribute-probed via getattr, and qwenpaw cannot be imported for typing on Python >= 3.14. Also apply the workspace's updated ruff rules to the package. Change-Id: Ibefdc830f39561963644504f97fb39e070a5d407 Co-developed-by: Qoder <noreply@qoder.com> Assisted-by: Qoder
- Drop gen_ai.agent.id: qwenpaw's agent_id is a local config key, not a provider-assigned stable identifier, and semconv recommends against recording transient/in-process agent ids on this attribute. - Narrow the remaining Any annotations on msgs/request/chunk to object. - Re-verify the conformance suppression: the invoke_agent span no longer requires gen_ai.provider.name, but the time_to_first_chunk metric still inherits it as required from the registry's shared metric attribute group, so the suppression stays with a metric-scoped explanation. Change-Id: I4fd76ada2efa1d1fcc775afb181a14b86988fade Co-developed-by: Qoder <noreply@qoder.com> Assisted-by: Qoder
…add-qwenpaw-instrumentation
…tation Change-Id: Idfad0c13dab8432638302f9f98f82886f9e2713a Co-developed-by: Qoder <noreply@qoder.com>
Description
Adds
opentelemetry-instrumentation-genai-qwenpaw, instrumentation for QwenPaw, a personal assistant application built on AgentScope. Each user turn handled byAgentRunner.query_handleris traced as oneinvoke_agentspan (gen_ai.agent.id,gen_ai.agent.name,gen_ai.conversation.id, and opt-in input/output message content), plus thegen_ai.client.operation.durationmetric, all throughopentelemetry-util-genai.QwenPaw delegates model (LLM) and tool execution to AgentScope, so this package intentionally emits no
chatorexecute_toolspans and the conformance suite covers none — those operations belong to the AgentScope instrumentation.Supported range is
qwenpaw >= 1.1.0, < 2.0.0(2.0 removedAgentRunner.query_handler).Type of change
How has this been tested?
tox -e py310-test-instrumentation-genai-qwenpaw-oldest(qwenpaw 1.1.0 via lowest-direct)tox -e py312-test-instrumentation-genai-qwenpaw-latest(qwenpaw 1.1.12.post3)tox -e py313-test-instrumentation-genai-qwenpaw-conformance(weaver live-check, 0 violations)tox -e lint-instrumentation-genai-qwenpaw,precommit,typecheck,readmeChecklist
See CONTRIBUTING.md
for the style guide, changelog guidance, and more.
Made with Cursor