fix(telemetry): send X-SDK-Language and X-Client-Type headers#40
Conversation
Every SDK request must identify itself to the API for adoption tracking.
The sync and async clients already sent X-SDK-Name and X-SDK-Version but
omitted X-SDK-Language and X-Client-Type, so 0/166 recent requests could be
attributed to the Python SDK vs raw python-httpx/python-requests calls.
Add the two missing telemetry headers to both OilPriceAPI (sync) and
AsyncOilPriceAPI clients:
X-SDK-Language: python
X-Client-Type: sdk
Change is additive (4 lines) and does not alter existing behavior.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 38 minutes and 50 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Every SDK request must identify itself to the API for adoption tracking.
The sync and async clients already sent X-SDK-Name and X-SDK-Version but
omitted X-SDK-Language and X-Client-Type, so 0/166 recent requests could be
attributed to the Python SDK vs raw python-httpx/python-requests calls.
Add the two missing telemetry headers to both OilPriceAPI (sync) and
AsyncOilPriceAPI clients:
X-SDK-Language: python
X-Client-Type: sdk
Change is additive (4 lines) and does not alter existing behavior.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Closes #4
What
The sync (
OilPriceAPI) and async (AsyncOilPriceAPI) clients already sentX-SDK-NameandX-SDK-Version, but omitted the two telemetry headers the API uses to distinguish SDK traffic from rawpython-httpx/python-requestscalls. As reported in #4, 0/166 recent Python requests carriedX-SDK-LanguageandX-Client-Type.This adds the two missing headers to both clients (additive, 4 lines):
X-SDK-Versionwas already present and is retained.How (strict TDD: red → green → refactor)
tests/test_telemetry_headers.pyencoding the issue's acceptance criteria for both sync and async clients: headers are configured AND actually transmitted on the wire (viahttpx.MockTransportcapturing the outbound request). 6 of 8 assertions failed against the unpatched clients.X-SDK-Language: pythonandX-Client-Type: sdkto the header dict inclient.pyandasync_client.py. All 8 new tests pass.Test evidence
Note: a full-tree
mypy oilpriceapi/run in this local env errors only inside the third-partynumpy/__init__.pyistub under Python 3.14 (typestatement support); this failure is identical on the unmodified baseline and is unrelated to this change. The changed files type-check cleanly, and CI runs on the supported Python 3.8–3.12 targets.Scope
Additive only. No migrations, Stripe, auth, routes, or customer-facing copy touched.
🤖 Generated with Claude Code