Skip to content

[usage] Find running and stopped instances in ledger reconciler #12645

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
Sep 5, 2022

Conversation

easyCZ
Copy link
Member

@easyCZ easyCZ commented Sep 5, 2022

Description

Ledger Reconciler finds running and stopped instances. Reconciler will be extended in subsequent PRs.

Related Issue(s)

Fixes #

How to test

Unit tests

Release Notes

NONE

Documentation

Werft options:

  • /werft with-preview

@easyCZ easyCZ requested a review from a team September 5, 2022 10:19
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Sep 5, 2022

client := v1.NewUsageServiceClient(conn)

_, err = client.ReconcileUsageWithLedger(context.Background(), &v1.ReconcileUsageWithLedgerRequest{
Copy link
Member Author

Choose a reason for hiding this comment

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

Doesn't assert the right instances were found because we don't yet update the records in any way. Once we start updating, the test here will be extended to do that.

@easyCZ easyCZ force-pushed the mp/ledger-collect-instances branch from 84d3aad to c825b27 Compare September 5, 2022 11:39
type Usage struct {
ID uuid.UUID `gorm:"primary_key;column:id;type:char;size:36;" json:"id"`
AttributionID AttributionID `gorm:"column:attributionId;type:varchar;size:255;" json:"attributionId"`
Description string `gorm:"column:description;type:varchar;size:255;" json:"description"`
CreditCents int64 `gorm:"column:creditCents;type:bigint;" json:"creditCents"`
EffectiveTime VarcharTime `gorm:"column:effectiveTime;type:varchar;size:255;" json:"effectiveTime"`
Kind string `gorm:"column:kind;type:char;size:10;" json:"kind"`
Kind UsageKind `gorm:"column:kind;type:char;size:10;" json:"kind"`
Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

logger.WithError(err).Errorf("Failed to find all draft usage records.")
return nil, status.Errorf(codes.Internal, "failed to find all draft usage records")
}
logger.Infof("Found %d draft usage records.", len(usageDrafts))
Copy link
Member

Choose a reason for hiding this comment

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

We'll also need to fetch the instances for the drafts and then combine the three slices of instances. But that's part of the next iteration I guess?

@roboquat roboquat merged commit 536a13d into main Sep 5, 2022
@roboquat roboquat deleted the mp/ledger-collect-instances branch September 5, 2022 11:52
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Sep 6, 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/M team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants