[opentelemetry-instrumentation-genai-portkey] Add initial boilerplate / setup - #443
[opentelemetry-instrumentation-genai-portkey] Add initial boilerplate / setup#443DylanRussell wants to merge 7 commits into
opentelemetry-instrumentation-genai-portkey] Add initial boilerplate / setup#443Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new instrumentation package, opentelemetry-instrumentation-genai-portkey, and wires it into the repo’s workspace, tox matrix, and typecheck scope. The package scaffolding includes an instrumentor, patching entrypoints, tests, conformance harness stubs, documentation, and examples, but the actual telemetry mapping is currently unimplemented.
Changes:
- Add the new
opentelemetry-instrumentation-genai-portkeypackage (project metadata, instrumentor, patch/unpatch plumbing, README, license, changelog fragment). - Wire Portkey into the monorepo (uv workspace lock entry, root tox envs, root pyright include/excludes).
- Add initial tests, conformance test harness, and manual examples.
Reviewed changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Adds the new Portkey instrumentation package to the uv workspace lock and resolves new transitive deps. |
| tox.ini | Adds {oldest,latest,conformance} test envs for Portkey and installs the package in typecheck deps. |
| pyproject.toml | Includes Portkey in pyright include and excludes its tests/examples from typechecking. |
| instrumentation/opentelemetry-instrumentation-genai-portkey/pyproject.toml | Defines the new package’s metadata, deps, extras, and entrypoint registration. |
| instrumentation/opentelemetry-instrumentation-genai-portkey/src/opentelemetry/instrumentation/genai/portkey/init.py | Adds PortkeyInstrumentor and wires TelemetryHandler + patching. |
| instrumentation/opentelemetry-instrumentation-genai-portkey/src/opentelemetry/instrumentation/genai/portkey/patch.py | Adds Portkey SDK monkey-patch hooks (currently placeholder wrappers). |
| instrumentation/opentelemetry-instrumentation-genai-portkey/src/opentelemetry/instrumentation/genai/portkey/package.py | Declares the instrumented dependency string for instrumentation_dependencies(). |
| instrumentation/opentelemetry-instrumentation-genai-portkey/src/opentelemetry/instrumentation/genai/portkey/version.py | Adds package version module. |
| instrumentation/opentelemetry-instrumentation-genai-portkey/README.rst | Documents installation/usage and completion-hook configuration. |
| instrumentation/opentelemetry-instrumentation-genai-portkey/LICENSE | Adds Apache-2.0 license file for the new package. |
| instrumentation/opentelemetry-instrumentation-genai-portkey/CHANGELOG.md | Adds towncrier-managed changelog scaffold for the package. |
| instrumentation/opentelemetry-instrumentation-genai-portkey/.changelog/443.added | Adds a changelog fragment announcing Portkey instrumentation. |
| instrumentation/opentelemetry-instrumentation-genai-portkey/tests/conftest.py | Registers shared test-util-genai fixtures + VCR config and provides instrument/uninstrument fixtures. |
| instrumentation/opentelemetry-instrumentation-genai-portkey/tests/test_instrumentor.py | Adds basic unit tests for instrumentor construction and lifecycle. |
| instrumentation/opentelemetry-instrumentation-genai-portkey/tests/test_completion_hook.py | Tests that completion_hook is forwarded and defaults to load_completion_hook(). |
| instrumentation/opentelemetry-instrumentation-genai-portkey/tests/test_conformance.py | Adds conformance test entrypoint using run_conformance(...). |
| instrumentation/opentelemetry-instrumentation-genai-portkey/tests/requirements.oldest.txt | Adds oldest-factor requirements file (currently only explanatory comments). |
| instrumentation/opentelemetry-instrumentation-genai-portkey/tests/requirements.latest.txt | Adds latest-factor requirements file and editable installs for local packages. |
| instrumentation/opentelemetry-instrumentation-genai-portkey/tests/init.py | Marks tests as a package. |
| instrumentation/opentelemetry-instrumentation-genai-portkey/tests/conformance/init.py | Marks conformance tests as a package. |
| instrumentation/opentelemetry-instrumentation-genai-portkey/tests/conformance/chat.py | Adds a chat conformance scenario using VCR cassette replay. |
| instrumentation/opentelemetry-instrumentation-genai-portkey/examples/manual/requirements.txt | Adds dependencies for the manual example. |
| instrumentation/opentelemetry-instrumentation-genai-portkey/examples/manual/README.rst | Documents how to run the manual examples. |
| instrumentation/opentelemetry-instrumentation-genai-portkey/examples/manual/main.py | Adds a manual instrumentation example that performs a chat completion. |
| instrumentation/opentelemetry-instrumentation-genai-portkey/examples/manual/custom_hook.py | Adds a manual example showing a custom CompletionHook. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Pull request dashboard statusWaiting on the author · refreshed 2026-08-22 18:37 UTC Respond to 2 review items (e.g. link a commit, explain why not, ask a follow-up): Status above doesn't look right?
|
|
@DylanRussell do you want to try stacked PRs ? They don't work on forks, but you should be able to push to origin with your github alias as prefix and then they start working. I'm a bit worried that we created a lot of empty skeletons, but we'renot populating them with instrumentations and I'd prefer us to merge real instrumentations. Stacked PRs allow to review individual stages in isolation, but merge them together |
|
Question(non-blocking): Should we emit inference spans? Can we just emit agent, workflow and tool spans? |
Description
This PR adds initial boilerplate / setup stuff. This is another open inference library port..
Portkey wraps around the model APIs (instead of the SDKs which we instrument) and provide the user with a single interface to call any model provider API. The portkey SDK sends the request to portkey's endpoint where they do the translation to the API call (adds the users API key) and does various other stuff.. It then makes the call and returns the response to the user.. They support streaming and sync/async. There are just 4 methods which we need to monkey patch on the portkey SDK..
This instrumentation will just emit inference spans..
Type of change
How has this been tested?
Unit tests
Checklist