Skip to content

Add CoPawInstrumentor for QwenPaw's legacy copaw distribution - #312

Open
123liuziming wants to merge 11 commits into
open-telemetry:mainfrom
123liuziming:add-copaw-instrumentor
Open

Add CoPawInstrumentor for QwenPaw's legacy copaw distribution#312
123liuziming wants to merge 11 commits into
open-telemetry:mainfrom
123liuziming:add-copaw-instrumentor

Conversation

@123liuziming

Copy link
Copy Markdown
Contributor

Description

Depends on #311 (stacked on its branch; only the last commit is new).

QwenPaw was originally published as copaw (last release copaw 1.0.2) with the same AgentRunner.query_handler surface. This adds a CoPawInstrumentor plugin next to QwenPawInstrumentor — a thin subclass pair over a shared private base — so installations still pinned to copaw get identical invoke_agent telemetry. Like QwenPaw, copaw delegates model and tool execution to AgentScope, so no chat/execute_tool spans are emitted by this package.

The existing test suite now runs against whichever distribution is installed; a dedicated py310-test-instrumentation-genai-qwenpaw-copaw tox factor pins copaw==1.0.2.

Type of change

  • New feature (non-breaking change which adds functionality)

How has this been tested?

  • tox -e py310-test-instrumentation-genai-qwenpaw-copaw (copaw 1.0.2)
  • tox -e py310-test-instrumentation-genai-qwenpaw-oldest / py312-…-latest (unchanged, still green)
  • tox -e py313-test-instrumentation-genai-qwenpaw-conformance (0 violations)
  • precommit, typecheck, lint-instrumentation-genai-qwenpaw, readme

Checklist

See CONTRIBUTING.md
for the style guide, changelog guidance, and more.

  • Followed the style guidelines of this project
  • Changelog updated if the change requires an entry
  • Unit tests added
  • Documentation updated

Made with Cursor

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>
Change-Id: I46107eb41fbacc8c5d6e846e8a9f6cd96dbb8cd9
Co-developed-by: Cursor <noreply@cursor.com>
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Jul 26, 2026

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-08-04 16:29 UTC

Review the latest changes.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds support for QwenPaw’s legacy copaw distribution by introducing a CoPawInstrumentor alongside QwenPawInstrumentor, ensuring identical invoke_agent telemetry for AgentRunner.query_handler across both distributions. Updates repo wiring (tox, workflows, workspace deps) and extends the test matrix to validate against copaw==1.0.2.

Changes:

  • Add CoPawInstrumentor (legacy copaw) as a thin sibling instrumentor targeting the same runner surface as qwenpaw.
  • Extend tox/test wiring so the same suite runs against whichever runtime distribution is installed, with a dedicated qwenpaw-copaw factor.
  • Wire the new package into repo release/build tooling (workspace deps, eachdist, workflows) and add/adjust conformance coverage.

Reviewed changes

Copilot reviewed 31 out of 34 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tox.ini Adds qwenpaw/copup test and conformance env factors plus lint target.
pyproject.toml Adds qwenpaw package to workspace deps and pyright include/exclude.
instrumentation/README.md Registers qwenpaw instrumentation in the generated instrumentation table.
eachdist.ini Adds qwenpaw package to per-dist tooling config.
dev-requirements-conformance.txt Adds OTLP exporter meta/proto-http pins to keep conformance stack resolvable.
.github/workflows/release-package.yml Adds qwenpaw to release workflow package list.
.github/workflows/prepare-release.yml Adds qwenpaw to prepare-release workflow package list.
.github/workflows/prepare-backport-patch.yml Adds qwenpaw to backport-patch workflow package list.
.github/workflows/bump-package-minor.yml Adds qwenpaw to minor bump workflow package list.
.github/workflows/bump-package-major.yml Adds qwenpaw to major bump workflow package list.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/pyproject.toml Defines the new instrumentation package, deps, extras, and entry points for both instrumentors.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/README.rst Documents qwenpaw/copaw support and configuration.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/LICENSE Adds package license file.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/.changelog/311.added Towncrier fragment for initial qwenpaw instrumentation (stacked PR).
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/.changelog/312.added Towncrier fragment for adding CoPawInstrumentor.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/.changelog/.gitignore Ensures towncrier fragment dir is preserved.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/src/opentelemetry/instrumentation/genai/qwenpaw/init.py Implements instrumentors and wiring to patch AgentRunner.query_handler.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/src/opentelemetry/instrumentation/genai/qwenpaw/patch.py Wraps query_handler async generator to keep invocation open until stream ends/closes.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/src/opentelemetry/instrumentation/genai/qwenpaw/package.py Declares supported distributions and metrics support for README generation.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/src/opentelemetry/instrumentation/genai/qwenpaw/utils.py Provides argument parsing + message mapping helpers.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/src/opentelemetry/instrumentation/genai/qwenpaw/version.py Sets package version.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/conftest.py Selects runtime target (qwenpaw vs copaw) and sets up shared instrumentation fixtures.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/harness.py Adds test harness to stub the runner’s command path without network/model calls.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/test_query_handler.py Validates invoke_agent span/metric behavior including error/close cases.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/test_message_mapping.py Unit-tests for message mapping and argument parsing utilities.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/test_instrumentor.py Tests per-distribution instrumentor metadata and lifecycle behaviors.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/test_conformance.py Runs weaver conformance scenario(s) in conformance envs.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/requirements.oldest.txt Defines oldest-factor test dependency strategy (no pins yet).
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/requirements.latest.txt Pins latest supported qwenpaw and installs package/util in editable mode.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/requirements.copaw.txt Pins copaw==1.0.2 for the legacy distribution test factor.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/conformance/invoke_agent.py Adds conformance scenario for invoke_agent operation.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/conformance/init.py Marks conformance tests as a package.
instrumentation/opentelemetry-instrumentation-genai-qwenpaw/tests/init.py Marks tests as a package.

Comment thread instrumentation/opentelemetry-instrumentation-genai-qwenpaw/README.rst Outdated
@123liuziming 123liuziming changed the title Add CoPawInstrumentor for QwenPaw's legacy copaw distribution 【WIP】Add CoPawInstrumentor for QwenPaw's legacy copaw distribution Jul 26, 2026
- 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
QwenPaw was originally published as copaw (last release 1.0.2) with the
same AgentRunner surface. Ship one instrumentor plugin per distribution
and run the existing test suite against copaw via a dedicated tox factor.

Change-Id: I30635193029ba239b7baa21cb666a54707f78997
Co-developed-by: Cursor <noreply@cursor.com>
Assisted-by: Claude Fable 5
Change-Id: I24e41debc913487bcbd823cbb31b7d3f34539f5c
Co-developed-by: Cursor <noreply@cursor.com>
Both instrumentors share the hook wiring, so resolve the instrumentor
class from the runtime fixture instead of hardcoding QwenPawInstrumentor.

Change-Id: I6f9033ea1de521c783b86cc60c2e3b32af45ba7f
Co-developed-by: Cursor <noreply@cursor.com>
Assisted-by: Claude Opus 4.6
@123liuziming
123liuziming force-pushed the add-copaw-instrumentor branch from 5af9b69 to a77f4dc Compare July 27, 2026 07:54
@123liuziming

Copy link
Copy Markdown
Contributor Author

The failing changelog check is expected while this PR is stacked on #311: the workflow validates every changelog fragment added relative to main, so it sees both 311.added and 312.added and rejects 311.added for not matching this PR's number. Verified locally that both fragments render fine with towncrier (towncrier build --draft).It will resolve automatically once #311 merges and this branch is rebased onto main. I'd rather not drop 311.added from this branch since that would delete #311's fragment at merge time. Alternatively, a maintainer can add the Skip Changelog label while the stack is open.

@lmolkova
lmolkova marked this pull request as draft July 30, 2026 03:55
- 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
@123liuziming
123liuziming marked this pull request as ready for review August 4, 2026 05:28
@123liuziming 123liuziming changed the title 【WIP】Add CoPawInstrumentor for QwenPaw's legacy copaw distribution Add CoPawInstrumentor for QwenPaw's legacy copaw distribution Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants