Skip to content

[usage] Add BillingService with UpdateInvoices RPC #11650

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

Merged
merged 1 commit into from
Jul 26, 2022

Conversation

easyCZ
Copy link
Member

@easyCZ easyCZ commented Jul 26, 2022

Description

To move the logic into an RPC, and decouple it from the Usage logic

Related Issue(s)

How to test

CI runs

Release Notes

NONE

Documentation

Werft options:

  • /werft with-preview

@easyCZ easyCZ requested a review from a team July 26, 2022 11:10
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Jul 26, 2022
Comment on lines +15 to +21
google.protobuf.Timestamp start_time = 1;
google.protobuf.Timestamp end_time = 2;

repeated BilledSession sessions = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

As a client of this RPC I would assume I can:

  • Give a start time and an end time and have invoices updated for all instances that ran in that time (maybe I'd like to give attributionIds too, so that I only update invoices for that team/user).

but here I can pass a list of BilledSessions as inputs (presumably intended to be those returned by the ListBilledUsage RPC on the usage service. What happens if I pass billed sessions that lie outside the time range?

Copy link
Member Author

Choose a reason for hiding this comment

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

So this is not a general purpose RPC, in a way, it's an internal RPC. I can clarify in comments.

You're correct, this only makes sense in the context of another thing which produces the sessions. I'm not sure how to rename or better convey this but the intended usage is not outside callers without context, but the "usage reconcile run"

Copy link
Contributor

Choose a reason for hiding this comment

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

I think some comments above the service to that effect would be good 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

When we do have authN in depth, I would've also encoded that the only caller of this RPC can be a service account which has the perms to generate usage reports, which I believe would've helped.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a comment on the proto

@andrew-farries andrew-farries self-assigned this Jul 26, 2022
@easyCZ easyCZ force-pushed the mp/usage-billing-service branch from 578c317 to 8d604b7 Compare July 26, 2022 13:38
@roboquat roboquat merged commit 91c61f4 into main Jul 26, 2022
@roboquat roboquat deleted the mp/usage-billing-service branch July 26, 2022 14:23
@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.

3 participants