Skip to content

feat: Allow passing X-Apify-Request-ID via charge() method - #1155

Open
vdusek wants to merge 2 commits into
masterfrom
feat/charge-apify-request-id
Open

vdusek wants to merge 2 commits into
masterfrom
feat/charge-apify-request-id

Conversation

@vdusek

@vdusek vdusek commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Adds an optional apify_request_id argument to RunClient.charge() and RunClientAsync.charge(). The client sends it as requestId in the charge request body. A multi-tenant Standby run passes the X-Apify-Request-ID header of the incoming request here, and the platform bills the event to the caller who made that request.

✍️ Drafted by Claude Code

@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Oct 20, 2026
@vdusek vdusek self-assigned this Oct 20, 2026
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.53%. Comparing base (ed76532) to head (64cb9a3).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1155   +/-   ##
=======================================
  Coverage   95.53%   95.53%           
=======================================
  Files          61       61           
  Lines        5974     5980    +6     
=======================================
+ Hits         5707     5713    +6     
  Misses        267      267           
Flag Coverage Δ
integration 90.53% <66.66%> (-0.26%) ⬇️
unit 89.79% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek
vdusek requested a review from janbuchar October 20, 2026 07:14
@vdusek
vdusek marked this pull request as ready for review October 20, 2026 07:14
@apify-service-account apify-service-account added the tested Temporary label used only programatically for some analytics. label Oct 20, 2026
@vdusek vdusek changed the title feat: Allow passing X-Apify-Request-Id via charge() method feat: Allow passing X-Apify-Request-ID via charge() method Oct 20, 2026
@vdusek
vdusek requested a review from Pijukatel October 20, 2026 10:32
timestamp_ms = int(time.time() * 1000)
idempotency_key = f'{self._resource_id}-{event_name}-{timestamp_ms}-{random_suffix}'

body: dict[str, Any] = {

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.

Super tiny detail. Why so permissive value type? dict[str, Any]

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants