Skip to content

Conversation

@NVJKKartik
Copy link
Contributor

@NVJKKartik NVJKKartik commented Jun 17, 2025

Pull Request

Description

Describe the changes in this pull request:

  • What feature/bug does this PR address?
  • Provide any relevant links or screenshots.

Checklist

  • Code compiles correctly.
  • Created/updated tests.
  • Linting and formatting applied.
  • Documentation updated.

Related Issues

Closes #<issue_number>

Summary by CodeRabbit

  • New Features

    • Introduced TraceAI Portkey Instrumentation for Python, enabling automatic tracing and observability for Portkey AI API calls.
    • Added comprehensive extraction of request and response attributes for enhanced telemetry and trace detail.
    • Provided utilities for input/output serialization and robust span management.
    • Published package metadata and versioning for the new instrumentation module.
  • Documentation

    • Added a README with setup instructions and usage examples for TraceAI Portkey Instrumentation.
  • Chores

    • Incremented package versions for Python and TypeScript components to reflect new changes.

@coderabbitai
Copy link

coderabbitai bot commented Jun 17, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces a new Portkey AI instrumentation package for Python, including its implementation, utilities, and documentation. It adds classes and functions for tracing Portkey AI requests and responses using OpenTelemetry, along with attribute extractors and wrappers. Version numbers are incremented for related Python and TypeScript packages, and minor constants are added for improved traceability.

Changes

File(s) Change Summary
python/frameworks/portkey/traceai_portkey/__init__.py Added PortkeyInstrumentor class for Portkey AI tracing instrumentation.
python/frameworks/portkey/traceai_portkey/_request_attributes_extractor.py Added _RequestAttributesExtractor for extracting request attributes for tracing.
python/frameworks/portkey/traceai_portkey/_response_attributes_extractor.py Added _ResponseAttributesExtractor for extracting response attributes for tracing.
python/frameworks/portkey/traceai_portkey/_utils.py Added utility functions and _ValueAndType for input/output attribute handling and span finalization.
python/frameworks/portkey/traceai_portkey/_with_span.py Added _WithSpan class to manage OpenTelemetry span lifecycle and attributes.
python/frameworks/portkey/traceai_portkey/_wrappers.py Added tracing wrappers and helpers for instrumenting Portkey AI calls.
python/frameworks/portkey/traceai_portkey/version.py Added __version__ = "0.1.0".
python/frameworks/portkey/README.md Added documentation for TraceAI Portkey Instrumentation setup and usage.
python/frameworks/portkey/pyproject.toml Added package metadata and dependencies for traceAI-portkey.
python/fi_instrumentation/fi_types.py Added constant PROMPT_ID to SpanAttributes class.
python/pyproject.toml Bumped fi-instrumentation-otel version to 0.1.8.
typescript/packages/fi-core/package.json Bumped @traceai/fi-core version to 0.1.12.

Sequence Diagram(s)

sequenceDiagram
    participant UserApp as User Application
    participant PortkeyInstrumentor as PortkeyInstrumentor
    participant PortkeyClient as Portkey Client
    participant OpenTelemetry as OpenTelemetry

    UserApp->>PortkeyInstrumentor: Apply instrumentation
    PortkeyInstrumentor->>OpenTelemetry: Set up tracer and wrappers
    UserApp->>PortkeyClient: Send chat completion request
    PortkeyClient->>PortkeyInstrumentor: Wrapped create() call
    PortkeyInstrumentor->>OpenTelemetry: Start span, extract request attrs
    PortkeyClient-->>PortkeyInstrumentor: Return response
    PortkeyInstrumentor->>OpenTelemetry: Extract response attrs, finish span
    PortkeyInstrumentor-->>UserApp: Return response
Loading

Poem

Oh, what a hop through Portkey land,
With tracing tools now close at hand!
Spans and attributes, all in a row,
Each chat completion, we now bestow.
Version bumps and docs anew—
A bunny’s work, precise and true!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 42a3f94 and 9d08b62.

📒 Files selected for processing (12)
  • python/fi_instrumentation/fi_types.py (1 hunks)
  • python/frameworks/portkey/README.md (1 hunks)
  • python/frameworks/portkey/pyproject.toml (1 hunks)
  • python/frameworks/portkey/traceai_portkey/__init__.py (1 hunks)
  • python/frameworks/portkey/traceai_portkey/_request_attributes_extractor.py (1 hunks)
  • python/frameworks/portkey/traceai_portkey/_response_attributes_extractor.py (1 hunks)
  • python/frameworks/portkey/traceai_portkey/_utils.py (1 hunks)
  • python/frameworks/portkey/traceai_portkey/_with_span.py (1 hunks)
  • python/frameworks/portkey/traceai_portkey/_wrappers.py (1 hunks)
  • python/frameworks/portkey/traceai_portkey/version.py (1 hunks)
  • python/pyproject.toml (1 hunks)
  • typescript/packages/fi-core/package.json (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@JayaSurya-27 JayaSurya-27 changed the base branch from main to dev June 17, 2025 15:03
@JayaSurya-27 JayaSurya-27 merged commit 5bb5121 into dev Jun 17, 2025
1 check was pending
@nik13 nik13 deleted the feature/Readme-Portkey branch July 1, 2025 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants