Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[usage] Add ReconcileUsage RPC #11676

Merged
merged 2 commits into from
Jul 27, 2022
Merged

[usage] Add ReconcileUsage RPC #11676

merged 2 commits into from
Jul 27, 2022

Conversation

easyCZ
Copy link
Member

@easyCZ easyCZ commented Jul 27, 2022

Description

Adds RPC definition for Collecting usage

Related Issue(s)

How to test

Release Notes

NONE

Documentation

Werft options:

  • /werft with-preview

@easyCZ easyCZ requested a review from a team July 27, 2022 08:26
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Jul 27, 2022
Comment on lines 12 to 14

// CollectUsage collects usage for the specified time period, and stores the usage records in the database, returning the records.
rpc CollectUsage(CollectUsageRequest) returns (CollectUsageResponse) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

There is potential for confusion between this new RPC and the ListBilledUsage RPC above.

AIUI, ListBilledUsage retrieves usage records (within a time range, for an attribution id) that have already been computed.

This new RPC actually triggers the usage collection that will populate usage records that are then available to ListBilledUsage.

Maybe calling this one StartUsageReconciliation or something similar, to emphasise its imperative nature would be better?

Copy link
Member Author

Choose a reason for hiding this comment

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

In theory, calling either should be fine as the end result is going to be some (accurate) records in the DB. The main difference is one is a pure read, while the other is an Upsert in a way.

If the RPC is called Start.., then I would expect it's an async job which it is not. Perhaps UpdateUsage?

Copy link
Member Author

Choose a reason for hiding this comment

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

Or ReconcileUsage, as that's probs most accurate

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed in 7119163

Copy link
Contributor

@andrew-farries andrew-farries left a comment

Choose a reason for hiding this comment

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

/hold for rename

@easyCZ easyCZ changed the title [usage] Add CollectUsage RPC [usage] Add ReconcileUsage RPC Jul 27, 2022
@easyCZ
Copy link
Member Author

easyCZ commented Jul 27, 2022

/unhold

@roboquat roboquat merged commit 66578f1 into main Jul 27, 2022
@roboquat roboquat deleted the mp/usage-collect-usage-proto branch July 27, 2022 09:35
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/XXL team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants