Skip to content

Otel integration#127

Merged
cb-alish merged 6 commits into
masterfrom
otel-integration
Jul 1, 2026
Merged

Otel integration#127
cb-alish merged 6 commits into
masterfrom
otel-integration

Conversation

@cb-karthikp

@cb-karthikp cb-karthikp commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

TBA

Added optional OpenTelemetry-compatible telemetry for Chargebee API calls. Introduced telemetry types/executor support, adapter configuration via Chargebee(..., telemetry_adapter=...) and update_telemetry_adapter(), and per-request resource/operation metadata to name spans and capture headers/errors. Updated README, CHANGELOG, tests, and bumped version to 3.25.0.

@snyk-io

snyk-io Bot commented Jul 1, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 37d4f0ae-ec53-47ec-91a5-4f3a54a8bf2b

📥 Commits

Reviewing files that changed from the base of the PR and between f51a745 and e6b9338.

📒 Files selected for processing (8)
  • CHANGELOG.md
  • VERSION
  • chargebee/main.py
  • chargebee/models/alert_status/operations.py
  • chargebee/models/hosted_page/operations.py
  • chargebee/models/offer_fulfillment/operations.py
  • chargebee/models/omnichannel_subscription/operations.py
  • chargebee/version.py
💤 Files with no reviewable changes (1)
  • chargebee/models/hosted_page/operations.py
✅ Files skipped from review due to trivial changes (3)
  • chargebee/version.py
  • VERSION
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • chargebee/main.py
  • chargebee/models/omnichannel_subscription/operations.py
  • chargebee/models/alert_status/operations.py
  • chargebee/models/offer_fulfillment/operations.py

Walkthrough

This PR adds optional OpenTelemetry-style telemetry to Chargebee API calls. It introduces telemetry contracts, helper/executor modules, client/request wiring, per-operation resource metadata across model methods, and documentation/tests. The SDK version is bumped to 3.25.0.

Changes

Telemetry Instrumentation

Layer / File(s) Summary
Telemetry data contracts
chargebee/telemetry/types.py
Defines telemetry constants, attribute keys, and frozen dataclasses for request telemetry error, context, result, and context input.
Telemetry support and execution
chargebee/telemetry/telemetry_support.py, chargebee/telemetry/telemetry_executor.py
Adds the telemetry adapter protocol, no-op adapter, span/attribute builders, error extraction helpers, and sync/async execution wrappers.
Client wiring and request plumbing
chargebee/telemetry/__init__.py, chargebee/__init__.py, chargebee/environment.py, chargebee/main.py, chargebee/request.py
Re-exports telemetry APIs, stores telemetry adapters on Environment and Chargebee, extends request helpers with telemetry arguments, and routes request execution through the telemetry executor.
Model request metadata, part 1
chargebee/models/addon/operations.py, chargebee/models/address/operations.py, chargebee/models/alert/operations.py, chargebee/models/attached_item/operations.py, chargebee/models/business_entity/operations.py, chargebee/models/card/operations.py, chargebee/models/comment/operations.py, chargebee/models/configuration/operations.py, chargebee/models/coupon/operations.py, chargebee/models/coupon_code/operations.py, chargebee/models/coupon_set/operations.py, chargebee/models/credit_note/operations.py, chargebee/models/currency/operations.py, chargebee/models/customer/operations.py, chargebee/models/customer_entitlement/operations.py, chargebee/models/differential_price/operations.py, chargebee/models/entitlement/operations.py, chargebee/models/entitlement_override/operations.py, chargebee/models/estimate/operations.py, chargebee/models/event/operations.py, chargebee/models/export/operations.py, chargebee/models/feature/operations.py, chargebee/models/gift/operations.py, chargebee/models/in_app_subscription/operations.py, chargebee/models/invoice/operations.py, chargebee/models/invoice_estimate/operations.py, chargebee/models/item/operations.py, chargebee/models/item_entitlement/operations.py, chargebee/models/item_family/operations.py, chargebee/models/item_price/operations.py, chargebee/models/offer_event/operations.py, chargebee/models/offer_fulfillment/operations.py, chargebee/models/omnichannel_one_time_order/operations.py
Adds resource and operation metadata to request calls across the first half of model operation files.
Model request metadata, part 2
chargebee/models/payment_source/operations.py, chargebee/models/payment_voucher/operations.py, chargebee/models/personalized_offer/operations.py, chargebee/models/plan/operations.py, chargebee/models/portal_session/operations.py, chargebee/models/price_variant/operations.py, chargebee/models/pricing_page_session/operations.py, chargebee/models/promotional_credit/operations.py, chargebee/models/purchase/operations.py, chargebee/models/quote/operations.py, chargebee/models/ramp/operations.py, chargebee/models/recorded_purchase/operations.py, chargebee/models/resource_migration/operations.py, chargebee/models/rule/operations.py, chargebee/models/site_migration_detail/operations.py, chargebee/models/subscription/operations.py, chargebee/models/subscription_entitlement/operations.py, chargebee/models/time_machine/operations.py, chargebee/models/transaction/operations.py, chargebee/models/unbilled_charge/operations.py, chargebee/models/usage/operations.py, chargebee/models/usage_charge/operations.py, chargebee/models/usage_event/operations.py, chargebee/models/usage_file/operations.py, chargebee/models/usage_summary/operations.py, chargebee/models/virtual_bank_account/operations.py, chargebee/models/webhook_endpoint/operations.py
Adds resource and operation metadata to request calls across the second half of model operation files.
Telemetry tests, docs, and version bump
tests/test_telemetry.py, tests/test_telemetry_support.py, README.md, CHANGELOG.md, VERSION, chargebee/version.py
Adds telemetry tests, updates the README and changelog with telemetry documentation, and bumps the SDK version to 3.25.0.

Estimated code review effort: 4 (Complex) | ~60 minutes

Suggested labels: enhancement, telemetry, documentation


Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
chargebee/models/omnichannel_subscription/operations.py (1)

126-149: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Inconsistent operation-name casing.

operation="omnichannel_transactionsForOmnichannelSubscription" mixes snake_case with camelCase, unlike every other operation string in this PR (all pure camelCase, e.g. retrieve, list, move). This will produce an oddly-cased span/operation name in telemetry dashboards vs. its siblings.

🏷️ Suggested fix
-            resource="omnichannelSubscription",
-            operation="omnichannel_transactionsForOmnichannelSubscription",
+            resource="omnichannelSubscription",
+            operation="omnichannelTransactionsForOmnichannelSubscription",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@chargebee/models/omnichannel_subscription/operations.py` around lines 126 -
149, The operation name passed from
omnichannel_transactions_for_omnichannel_subscription is inconsistently cased
and mixes snake_case with camelCase. Update the operation argument in the
request.send call for this method so it matches the other operation strings in
the codebase and uses a single pure camelCase name, keeping it consistent with
sibling operations like retrieve and list.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@chargebee/models/alert_status/operations.py`:
- Around line 38-39: The operation names in the AlertStatus operations
definitions are inconsistent with the rest of the PR and should be renamed to
clean camelCase. Update the `operation` values in the `AlertStatus` operations
module, including the entries for `alert_statusesForSubscription` and
`alert_statusesForAlert`, so they follow the same naming style as other
operation symbols like `createTransfers` and `addCouponCodes`. Keep the
`resource` unchanged and only normalize the operation identifiers used for
telemetry/span naming.

---

Nitpick comments:
In `@chargebee/models/omnichannel_subscription/operations.py`:
- Around line 126-149: The operation name passed from
omnichannel_transactions_for_omnichannel_subscription is inconsistently cased
and mixes snake_case with camelCase. Update the operation argument in the
request.send call for this method so it matches the other operation strings in
the codebase and uses a single pure camelCase name, keeping it consistent with
sibling operations like retrieve and list.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 3e3e7564-296f-4d79-b39f-f6cd7f95c1de

📥 Commits

Reviewing files that changed from the base of the PR and between ad66ecc and f51a745.

📒 Files selected for processing (81)
  • CHANGELOG.md
  • README.md
  • VERSION
  • chargebee/__init__.py
  • chargebee/environment.py
  • chargebee/main.py
  • chargebee/models/addon/operations.py
  • chargebee/models/address/operations.py
  • chargebee/models/alert/operations.py
  • chargebee/models/alert_status/operations.py
  • chargebee/models/attached_item/operations.py
  • chargebee/models/business_entity/operations.py
  • chargebee/models/card/operations.py
  • chargebee/models/comment/operations.py
  • chargebee/models/configuration/operations.py
  • chargebee/models/coupon/operations.py
  • chargebee/models/coupon_code/operations.py
  • chargebee/models/coupon_set/operations.py
  • chargebee/models/credit_note/operations.py
  • chargebee/models/currency/operations.py
  • chargebee/models/customer/operations.py
  • chargebee/models/customer_entitlement/operations.py
  • chargebee/models/differential_price/operations.py
  • chargebee/models/entitlement/operations.py
  • chargebee/models/entitlement_override/operations.py
  • chargebee/models/estimate/operations.py
  • chargebee/models/event/operations.py
  • chargebee/models/export/operations.py
  • chargebee/models/feature/operations.py
  • chargebee/models/gift/operations.py
  • chargebee/models/hosted_page/operations.py
  • chargebee/models/in_app_subscription/operations.py
  • chargebee/models/invoice/operations.py
  • chargebee/models/invoice_estimate/operations.py
  • chargebee/models/item/operations.py
  • chargebee/models/item_entitlement/operations.py
  • chargebee/models/item_family/operations.py
  • chargebee/models/item_price/operations.py
  • chargebee/models/offer_event/operations.py
  • chargebee/models/offer_fulfillment/operations.py
  • chargebee/models/omnichannel_one_time_order/operations.py
  • chargebee/models/omnichannel_subscription/operations.py
  • chargebee/models/omnichannel_subscription_item/operations.py
  • chargebee/models/order/operations.py
  • chargebee/models/payment_intent/operations.py
  • chargebee/models/payment_schedule_scheme/operations.py
  • chargebee/models/payment_source/operations.py
  • chargebee/models/payment_voucher/operations.py
  • chargebee/models/personalized_offer/operations.py
  • chargebee/models/plan/operations.py
  • chargebee/models/portal_session/operations.py
  • chargebee/models/price_variant/operations.py
  • chargebee/models/pricing_page_session/operations.py
  • chargebee/models/promotional_credit/operations.py
  • chargebee/models/purchase/operations.py
  • chargebee/models/quote/operations.py
  • chargebee/models/ramp/operations.py
  • chargebee/models/recorded_purchase/operations.py
  • chargebee/models/resource_migration/operations.py
  • chargebee/models/rule/operations.py
  • chargebee/models/site_migration_detail/operations.py
  • chargebee/models/subscription/operations.py
  • chargebee/models/subscription_entitlement/operations.py
  • chargebee/models/time_machine/operations.py
  • chargebee/models/transaction/operations.py
  • chargebee/models/unbilled_charge/operations.py
  • chargebee/models/usage/operations.py
  • chargebee/models/usage_charge/operations.py
  • chargebee/models/usage_event/operations.py
  • chargebee/models/usage_file/operations.py
  • chargebee/models/usage_summary/operations.py
  • chargebee/models/virtual_bank_account/operations.py
  • chargebee/models/webhook_endpoint/operations.py
  • chargebee/request.py
  • chargebee/telemetry/__init__.py
  • chargebee/telemetry/telemetry_executor.py
  • chargebee/telemetry/telemetry_support.py
  • chargebee/telemetry/types.py
  • chargebee/version.py
  • tests/test_telemetry.py
  • tests/test_telemetry_support.py

Comment thread chargebee/models/alert_status/operations.py Outdated
@cb-karthikp cb-karthikp marked this pull request as ready for review July 1, 2026 10:09
@cb-alish cb-alish merged commit 675450b into master Jul 1, 2026
5 checks passed
@cb-alish cb-alish deleted the otel-integration branch July 1, 2026 10:13
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.

2 participants