Skip to content

[opentelemetry-instrumentation-genai-portkey] Add initial boilerplate / setup - #443

Open
DylanRussell wants to merge 7 commits into
open-telemetry:mainfrom
DylanRussell:portkey
Open

[opentelemetry-instrumentation-genai-portkey] Add initial boilerplate / setup#443
DylanRussell wants to merge 7 commits into
open-telemetry:mainfrom
DylanRussell:portkey

Conversation

@DylanRussell

@DylanRussell DylanRussell commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

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

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

How has this been tested?

Unit tests

Checklist

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

Copilot AI lite review requested due to automatic review settings August 21, 2026 15:32
@DylanRussell
DylanRussell requested a review from a team as a code owner August 21, 2026 15:32

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

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-portkey package (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.

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Aug 21, 2026

Copy link
Copy Markdown

Pull request dashboard status

Waiting 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):

  • Top-level threads: 1, 2
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.
  • Should this be with reviewers? Comment /dashboard route:reviewers to route it to them.
  • Anything wrong — including the routing? Report it with what you expected; it helps us improve the dashboard.

@lmolkova

Copy link
Copy Markdown
Member

@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

@eternalcuriouslearner

Copy link
Copy Markdown
Contributor

Question(non-blocking): Should we emit inference spans? Can we just emit agent, workflow and tool spans?

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.

4 participants