feat(copaw): add CoPaw instrumentation, LoongSuite CI, and bootstrap mapping#162
feat(copaw): add CoPaw instrumentation, LoongSuite CI, and bootstrap mapping#162Cirilla-zmh wants to merge 8 commits intoalibaba:mainfrom
Conversation
Change-Id: I8d06200cd5339d346ab52a324936be397faf153d Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I8bdf89aaa10e11bc83905ef13a86d742ce129624 Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: Id69b2e64718a2fff833b65f7719392a459245745 Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: Id06932c4f84250a4eb9c7d9ad0737b738ce29fcb Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: Id97f3af859508e8e49cc70901642b3e566ca1e98 Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I6a1d48bee3a171ed0301d48b699edd2a04f8c7d5 Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I82f811fac4c7a1665efd9f420545e187d4f27eb0 Co-developed-by: Cursor <noreply@cursor.com>
There was a problem hiding this comment.
Pull request overview
Adds a new LoongSuite instrumentation package for CoPaw and wires it into LoongSuite’s CI/tox and distro bootstrap auto-install mapping, alongside a set of test-requirements reshuffles/standardization across existing instrumentations.
Changes:
- Introduce
loongsuite-instrumentation-copawimplementing Entry-span telemetry forAgentRunner.query_handler, plus tests and package metadata. - Extend
tox-loongsuite.ini+ GitHub Actions workflows to run CoPaw tests/lint in CI and realign some existing test-requirements paths (e.g., mem0). - Update distro bootstrap mapping (
bootstrap_gen.py) to include CoPaw and bump pinned instrumentation versions; update docs/README listings accordingly.
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tox-loongsuite.ini | Adds CoPaw test/lint envs and updates some dependency file paths (notably mem0). |
| README.md | Lists CoPaw instrumentation; adds extra blank lines near the bottom. |
| README-zh.md | Lists CoPaw instrumentation in the Chinese README. |
| loongsuite-distro/src/loongsuite/distro/bootstrap_gen.py | Adds CoPaw mapping and bumps pinned instrumentation versions across bootstrap mappings. |
| instrumentation-loongsuite/README.md | Adds CoPaw (and other newer packages) to instrumentation package index. |
| instrumentation-loongsuite/loongsuite-instrumentation-mem0/tests/requirements.oldest.txt | New “oldest” test requirements file under tests/. |
| instrumentation-loongsuite/loongsuite-instrumentation-mem0/tests/requirements.latest.txt | New “latest” test requirements file under tests/ with non-hermetic warning. |
| instrumentation-loongsuite/loongsuite-instrumentation-mem0/test-requirements-oldest.txt | Removes legacy root-level oldest requirements file. |
| instrumentation-loongsuite/loongsuite-instrumentation-mem0/test-requirements-latest.txt | Removes legacy root-level latest requirements file. |
| instrumentation-loongsuite/loongsuite-instrumentation-litellm/tests/test-requirements.txt | Minor documentation/comment tweak. |
| instrumentation-loongsuite/loongsuite-instrumentation-langgraph/tests/requirements.oldest.txt | Adds license header + clarifies “oldest” requirements intent. |
| instrumentation-loongsuite/loongsuite-instrumentation-langgraph/tests/requirements.latest.txt | Adds license header + non-hermetic warning text. |
| instrumentation-loongsuite/loongsuite-instrumentation-google-adk/tests/requirements.oldest.txt | Adds license header + clarifies “oldest” requirements intent. |
| instrumentation-loongsuite/loongsuite-instrumentation-google-adk/tests/requirements.latest.txt | Adds license header + non-hermetic warning text. |
| instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/test_instrument_smoke.py | Smoke tests for instrument/uninstrument and a minimal query path. |
| instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/test_entry_utils.py | Unit tests for argument parsing and EntryInvocation helpers. |
| instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/test_entry_span.py | Integration-style test asserting Entry span attributes and TTFT. |
| instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/requirements.txt | Test environment requirements for CoPaw instrumentation tests. |
| instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/conftest.py | Pytest fixtures for tracer/span exporter and instrumentation setup. |
| instrumentation-loongsuite/loongsuite-instrumentation-copaw/src/opentelemetry/instrumentation/copaw/version.py | Defines package version. |
| instrumentation-loongsuite/loongsuite-instrumentation-copaw/src/opentelemetry/instrumentation/copaw/patch.py | Implements the query_handler wrapper that drives Entry telemetry. |
| instrumentation-loongsuite/loongsuite-instrumentation-copaw/src/opentelemetry/instrumentation/copaw/package.py | Declares instrumentation dependency metadata. |
| instrumentation-loongsuite/loongsuite-instrumentation-copaw/src/opentelemetry/instrumentation/copaw/_entry_utils.py | Utilities to build EntryInvocation and map messages/chunks. |
| instrumentation-loongsuite/loongsuite-instrumentation-copaw/src/opentelemetry/instrumentation/copaw/init.py | Adds CoPawInstrumentor wiring wrapt patches to the handler. |
| instrumentation-loongsuite/loongsuite-instrumentation-copaw/README.md | Usage documentation (site-bootstrap recommended approach) and scope/attributes. |
| instrumentation-loongsuite/loongsuite-instrumentation-copaw/pyproject.toml | New package metadata, deps, and entry point registration. |
| instrumentation-loongsuite/loongsuite-instrumentation-copaw/CHANGELOG.md | Initial changelog for the new package. |
| instrumentation-loongsuite/loongsuite-instrumentation-claude-agent-sdk/tests/requirements.latest.txt | Adds non-hermetic warning/commentary section. |
| instrumentation-loongsuite/loongsuite-instrumentation-agentscope/tests/requirements.oldest.txt | Adds license header + clarifies “oldest” requirements intent. |
| instrumentation-loongsuite/loongsuite-instrumentation-agentscope/tests/requirements.latest.txt | Adds license header + non-hermetic warning text. |
| dev-requirements.txt | Loosens requests pin to >= with a comment about CoPaw. |
| .github/workflows/loongsuite_test_0.yml | Adds CI jobs to run CoPaw tests across Python 3.10–3.13. |
| .github/workflows/loongsuite_lint_0.yml | Adds CI job to run CoPaw lint target. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| copaw: -r {toxinidir}/instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/requirements.txt | ||
| lint-loongsuite-instrumentation-copaw: -r {toxinidir}/instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/requirements.oldest.txt | ||
|
|
There was a problem hiding this comment.
lint-loongsuite-instrumentation-copaw installs tests/requirements.oldest.txt, but that file does not exist in loongsuite-instrumentation-copaw/tests/ (only requirements.txt is present). This will make the lint tox env (and CI lint job) fail during dependency resolution. Add the missing requirements.oldest.txt (and update tox to use it), or change the tox deps to reference an existing requirements file.
| loongsuite-crewai: -r {toxinidir}/instrumentation-loongsuite/loongsuite-instrumentation-crewai/tests/test-requirements.txt | ||
|
|
||
| copaw: -r {toxinidir}/instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/requirements.txt | ||
| lint-loongsuite-instrumentation-copaw: -r {toxinidir}/instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/requirements.oldest.txt |
There was a problem hiding this comment.
The dependency selector copaw: matches both py3*-test-loongsuite-instrumentation-copaw and lint-loongsuite-instrumentation-copaw env names (they both include the copaw factor), so the lint env will also install the full CoPaw test requirements (including copaw==1.0.0). If the intent is to keep lint lightweight / conflict-free (as is done for other packages), scope this to the test env factors (e.g., test-loongsuite-instrumentation-copaw:) or introduce explicit copaw-oldest/copaw-latest factors similar to other instrumentations.
| ; loongsuite-instrumentation-copaw | ||
| py3{10,11,12,13}-test-loongsuite-instrumentation-copaw | ||
| lint-loongsuite-instrumentation-copaw |
There was a problem hiding this comment.
The PR description mentions py3{10,11,12,13}-test-loongsuite-instrumentation-copaw-{oldest,latest} environments, but the envlist adds only py3{10,11,12,13}-test-loongsuite-instrumentation-copaw (no oldest/latest split). Either update the tox env naming to match the documented oldest/latest pattern, or adjust the PR description so CI expectations match what tox actually defines.
| dependencies = [ | ||
| "opentelemetry-api >= 1.37", | ||
| "opentelemetry-instrumentation >= 0.58b0", | ||
| "opentelemetry-semantic-conventions >= 0.58b0", | ||
| "opentelemetry-util-genai", | ||
| "wrapt >= 1.17.3", |
There was a problem hiding this comment.
This package uses opentelemetry-api >= 1.37 while other LoongSuite instrumentation packages in this repo constrain it with ~= 1.37 (e.g., agentscope/mem0). Using >= risks pulling in a future incompatible major/minor API. Consider aligning with the repo’s pattern (opentelemetry-api ~= 1.37) unless there is a tested compatibility guarantee across future versions.
| markupsafe>=2.0.1 | ||
| codespell==2.1.0 | ||
| requests==2.32.3 | ||
| requests>=2.32.3 # LoongSuite Extension: Copaw requires requests>=2.32.3 |
There was a problem hiding this comment.
dev-requirements.txt is otherwise fully pinned for reproducible dev environments, but requests was changed from an exact pin to >=. If CoPaw needs a newer minimum, consider keeping an exact pin here (and updating the pinned version) while expressing the minimum in the CoPaw package/test requirements instead, to avoid non-deterministic tooling installs.
| requests>=2.32.3 # LoongSuite Extension: Copaw requires requests>=2.32.3 | |
| requests==2.32.3 # LoongSuite Extension: Copaw requires requests>=2.32.3 |
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| """Wrap ``AgentRunner.query_handler`` with LongSuite Entry telemetry.""" |
There was a problem hiding this comment.
Docstring says "LongSuite" but the project/package name elsewhere is "LoongSuite". Please fix the spelling for consistency in user-facing docs.
| """Wrap ``AgentRunner.query_handler`` with LongSuite Entry telemetry.""" | |
| """Wrap ``AgentRunner.query_handler`` with LoongSuite Entry telemetry.""" |
| """ | ||
| LongSuite CoPaw instrumentation (``copaw >= 0.1.0``). | ||
|
|
||
| Instruments ``AgentRunner.query_handler`` with ``ExtendedTelemetryHandler.entry`` | ||
| (``enter_ai_application_system``). Agent / tool / LLM spans come from AgentScope | ||
| and other instrumentations. |
There was a problem hiding this comment.
Docstring uses "LongSuite" in multiple places, but the project name is "LoongSuite". Please correct the spelling to avoid confusion in generated docs and help text.
|
|
||
|
|
There was a problem hiding this comment.
There are two extra blank lines added just before the "## Resources" heading. This creates trailing whitespace/formatting noise and can cause unnecessary diffs later; please remove the extra empty lines.
Description
What changed
CoPaw instrumentation package
New package under
instrumentation-loongsuite/loongsuite-instrumentation-copaw/:CoPawInstrumentorwraps CoPaw’s runner conversation path withExtendedTelemetryHandlerentry lifecycle (start_entry/stop_entry/fail_entry), buildsEntryInvocationfrom request/session/channel and stream chunks (_entry_utils+patch.py), and records streaminggen_ai.response.time_to_first_tokenwhere applicable. Depends onopentelemetry-util-genai; forwardstracer_provider/meter_provider/logger_providerfrominstrument().CI and tox
tox-loongsuite.ini: environments forpy3{10,11,12,13}-test-loongsuite-instrumentation-copaw-{oldest,latest}andlint-loongsuite-instrumentation-copaw(lint intentionally does not merge copawrequirements.oldestwithdev-requirements—documented resolver conflict)..github/workflows/loongsuite_test_0.ymlandloongsuite_lint_0.ymlregenerated so CI runs those tox targets.Distro bootstrap
bootstrap_gen.py: addscopaw >= 0.1.0→loongsuite-instrumentation-copawmapping forloongsuite-bootstrapauto-install, and bumps pinnedopentelemetry-instrumentation-*versions broadly to0.62b0.devfor consistency with the current contrib line.Cross-package test requirements & mem0 layout
Tightens or realigns
requirements.latest.txt/requirements.oldest.txt(and related pins) for Agentscope, Claude Agent SDK, Google ADK, Langgraph, LiteLLM tests. mem0: moves towardtests/requirements.latest.txt/tests/requirements.oldest.txtand removes legacytest-requirements-*.txtroots—keeps tox env wiring in sync with other packages.Documentation & housekeeping
README for the CoPaw package (Getting Started with Site-bootstrap, what is instrumented). CHANGELOG trimmed for release notes style. instrumentation-loongsuite/README.md lists the new package;
dev-requirements.txtminor bump.Tests
instrumentation-loongsuite/loongsuite-instrumentation-copaw/tests/test_entry_span.py— real CoPaw + monkeypatched approval path; asserts Entry span name, operation, kind, session/user, copaw attributes, TTFT.tests/test_entry_utils.py— parsing andEntryInvocationhelpers without full app.tests/test_instrument_smoke.py— instrument/uninstrument round-trip and log/smoke path with a single finished span.tests/conftest.py— exporter +CoPawInstrumentorwith GenAI stability opt-in.Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.