Skip to content

[usage] Make billing optional in the usage component #10754

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
Jun 27, 2022

Conversation

andrew-farries
Copy link
Contributor

@andrew-farries andrew-farries commented Jun 20, 2022

Description

Make the payment processing part of the usage controller optional. If the secret containing Stripe API keys is configured then enable payments, otherwise disable it.

Usage metering and usage based billing are separate concepts that we will need to enable and disable independently of one another. In Gitpod SaaS we will want both, but for self-hosted installations, users will only care about usage metering.

At some point we will want to have the usage collection and billing integration in separate services but for now, while they both live in the usage component, let's at least be able to toggle billing integration on and off.

Related Issue(s)

Part of #9036

How to test

  • Trigger separate Werft builds, one setting with-payment=true and the other without.
  • Observe that when payment is enabled, the usage component runs with billing integration enabled:
    {"level":"info","message":"payment integration with Stripe is set to true","serviceContext":{"service":"usage","version":"commit-b5ca1b4eebb51424345134f6847f9d180bd7c44f"},"severity":"INFO","time":"2022-06-20T05:56:38Z"}
    
    and when payment is not enabled, observe that it runs with billing integration disabled:
    {"level":"info","message":"payment integration with Stripe is set to false","serviceContext":{"service":"usage","version":"commit-b5ca1b4eebb51424345134f6847f9d180bd7c44f"},"severity":"INFO","time":"2022-06-20T05:56:38Z"}
    

Release Notes

NONE

Documentation

None

@andrew-farries andrew-farries requested a review from a team June 20, 2022 08:29
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Jun 20, 2022
@andrew-farries andrew-farries force-pushed the af/usage-make-payment-integration-optional branch from b2ac268 to cb888d5 Compare June 20, 2022 08:31
@andrew-farries andrew-farries force-pushed the af/usage-make-payment-integration-optional branch 6 times, most recently from db23cb9 to 3d0814b Compare June 20, 2022 11:08
@andrew-farries
Copy link
Contributor Author

/hold

@andrew-farries andrew-farries requested a review from easyCZ June 21, 2022 06:04
Base automatically changed from af/add-configmap-for-usage-controller to main June 21, 2022 09:54
@roboquat roboquat requested a review from a team June 21, 2022 09:54
@andrew-farries andrew-farries force-pushed the af/usage-make-payment-integration-optional branch 2 times, most recently from ec2065e to 91b244b Compare June 21, 2022 11:09
@andrew-farries
Copy link
Contributor Author

andrew-farries commented Jun 21, 2022

/werft run

👍 started the job as gitpod-build-af-usage-make-payment-integration-optional.25
(with .werft/ from main)

Copy link
Member

@easyCZ easyCZ left a comment

Choose a reason for hiding this comment

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

LGTM % comments (up to you to address, if you think they are valid)

/hold

@andrew-farries
Copy link
Contributor Author

andrew-farries commented Jun 22, 2022

/werft run with-clean-slate-deployment=true

👍 started the job as gitpod-build-af-usage-make-payment-integration-optional.27
(with .werft/ from main)

@andrew-farries
Copy link
Contributor Author

andrew-farries commented Jun 22, 2022

I'm not sure why Werft is failing here 😕 .

There are no obvious error message in the logs. The last line of the output is:

[components/usage:app] === RUN   TestListWorkspaceInstancesInRange_InBatches

@easyCZ
Copy link
Member

easyCZ commented Jun 22, 2022

I'm not sure why Werft is failing here 😕 .

There are no obvious error message in the logs. The last line of the output is:

[components/usage:app] === RUN   TestListWorkspaceInstancesInRange_InBatches

That test may output a rather long log line. It's possible it doesn't sit well with werft. Main (which contains the same test) is happy however.

@andrew-farries
Copy link
Contributor Author

We should probably not run the tests for the usage component in verbose mode as they are very noisy.

@andrew-farries
Copy link
Contributor Author

This looks to be more widespread than just this branch.

https://werft.gitpod-dev.com/job/gitpod-build-af-add-timeout-show-command.8/raw now also failing at the same point.

@easyCZ
Copy link
Member

easyCZ commented Jun 22, 2022

Fix for the debug logging in #10815

@andrew-farries andrew-farries force-pushed the af/usage-make-payment-integration-optional branch from 4c0bcf1 to 9441c48 Compare June 22, 2022 09:26
@andrew-farries andrew-farries force-pushed the af/usage-make-payment-integration-optional branch 4 times, most recently from 548c7d7 to acd9a2f Compare June 22, 2022 13:40
Enable stripe integration iff a Stripe secret is configured.
@easyCZ
Copy link
Member

easyCZ commented Jun 24, 2022

@gitpod-io/engineering-self-hosted Would you be able to please help review this?

Copy link
Contributor

@corneliusludmann corneliusludmann left a comment

Choose a reason for hiding this comment

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

Went over the code and it looks good so far. Since we do not own code that is touched in this PR, let me know if you need me to review something in particular.

@andrew-farries
Copy link
Contributor Author

/unhold

@roboquat roboquat merged commit 95e3287 into main Jun 27, 2022
@roboquat roboquat deleted the af/usage-make-payment-integration-optional branch June 27, 2022 06:16
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Jun 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/L team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants