Gero Posmyk-Leinemann
0a83195769
[usage] Dummy implementation of UsageService
2022-07-12 16:02:00 +02:00
Milan Pavlik
9e747b67b9
[usage] Billing controller returns error
2022-07-12 11:56:59 +05:30
Milan Pavlik
8768f9549f
[usage] Set reconcile duration buckets to 30s, up to 300s
2022-07-12 11:51:59 +05:30
Andrew Farries
82bf49c797
Remove unnecessary method
...
Already implemented by the embedded struct.
2022-07-11 13:50:58 +05:30
Andrew Farries
5932df564f
Placeholder implementation of usage gRPC server
2022-07-11 13:50:58 +05:30
Andrew Farries
c83333fc3a
Add usage-api component
...
Add Placeholder .proto files and script to generate Go client/server
SDKs.
Adapted from the `public-api` component.
2022-07-08 16:25:55 +05:30
JenTing Hsiao
856371178d
Revert "Update k8s dependencies to v0.24.2"
...
This reverts commit 2911bc3283c2b79aacde0d16bce056de62eb696b.
2022-07-05 11:11:01 +02:00
Manuel Alejandro de Brito Fontes
2911bc3283
Update k8s dependencies to v0.24.2
2022-07-05 03:37:52 +05:30
Milan Pavlik
e8ab39e3e7
[usage] Use a config file to configure usage component
2022-07-04 20:44:51 +05:30
Milan Pavlik
8b88f26cb6
[usage] Use workspace class when computing credits used
2022-06-30 20:41:38 +05:30
Milan Pavlik
e6602f7ffa
[usage] Refactor server start into a function, specify config
2022-06-30 17:58:39 +05:30
Milan Pavlik
7c567bfa19
[usage] Refactor credit calculation into a WorkspacePricer
2022-06-30 17:30:38 +05:30
Milan Pavlik
70150e2893
[usage] Add WorkspaceClass field to WorkspaceInstance model (in go)
2022-06-30 17:19:38 +05:30
Milan Pavlik
3cd0cf270d
[usage] Ensure controlle ticks are not concurrent
2022-06-29 16:44:37 +05:30
Milan Pavlik
b5afbce0cc
[usage] Expose metrics for reconciles started and duration
2022-06-29 16:12:37 +05:30
Milan Pavlik
2e7d2ef5ab
[usage] Use attribution ID to reduce DB queries for usage report
2022-06-28 21:23:37 +05:30
Milan Pavlik
247205ccd0
[usage] Fix flakes by deleting records created by each test, not deleting all
2022-06-28 18:56:37 +05:30
Milan Pavlik
b0170eca47
[usage] Add usageAttributionID to WorksapceInstance model (in go)
2022-06-28 15:17:36 +05:30
Andrew Farries
db870a5b44
Make client init take a config struct not a path
...
* Rename the function to `New`.
* Lift config file unmarshaling out of the package and into the
consumer.
2022-06-27 13:45:36 +05:30
Andrew Farries
136d46e675
Make run command use new Stripe client
...
Give an instance of the stripe client to the stripe billing controller.
2022-06-27 13:45:36 +05:30
Andrew Farries
64060888a5
Make stripe package return clients
...
`Authenticate` now returns a Client object rather than acting as a
singleton. Change the `UpdateUsage` function to be a method on the
client type.
See:
https://github.com/stripe/stripe-go#with-a-client
2022-06-27 13:45:36 +05:30
Andrew Farries
95e32871e0
[usage] Make Stripe payment integration optional
...
Enable stripe integration iff a Stripe secret is configured.
2022-06-27 11:46:35 +05:30
Jan Keromnes
df32c3bd05
[usage] Update formula: 1 credit = 6 minutes, rounded up
2022-06-23 12:42:32 +05:30
Milan Pavlik
3e14918eca
[usage] Temporarily remove flaky test
2022-06-22 18:24:31 +05:30
Milan Pavlik
af8cb456b7
[usage] Fix flaky test for ListWorkspacesByID
2022-06-22 17:34:31 +05:30
Milan Pavlik
2800756032
[usage] Do not run tests with SQL debug mode
2022-06-22 14:54:31 +05:30
Milan Pavlik
3b0942d0f3
[usage] Batch list workspace instances in range
2022-06-21 15:39:30 +05:30
Milan Pavlik
006dfb62e9
[usage] Fix querying workspace instances to use startedTime existence to filter
2022-06-21 13:50:30 +05:30
Milan Pavlik
08a02d6505
[usage] Batch lookup Workspaces to fix too many placeholders error
2022-06-21 12:49:30 +05:30
Andrew Farries
9554966982
Update subscription item with usage
...
* Convert the usage report so that it contains one entry for each team
that registered usage during the billing period.
* For each team, query Stripe to find the corresponding Customer.
* Update each Customer's subscription with their used credits.
2022-06-17 15:06:26 +05:30
Andrew Farries
0001dc60d6
Add godoc comment to Authenticate method
2022-06-17 15:06:26 +05:30
Andrew Farries
27de293182
Add schedule flag to run command
...
To allow overriding the default scheduler when testing the reconciler
locally.
Change default to 1 hour.
2022-06-16 20:50:25 +05:30
Andrew Farries
060c4f5c63
Query Stripe API to find customers for each teamId
...
For each teamId in the usage report, query the Stripe API to find Stripe
Customer records that correspond to those teamIds.
2022-06-16 18:05:26 +05:30
Andrew Farries
2d9f9d03d7
Add stripe customer query builder to stripe pkg
...
Build and test the query that will be used to retrieve a list of stripe
customers matching a given set of teamIds.
2022-06-16 18:05:26 +05:30
Andrew Farries
d87da28d46
Authenticate to the Stripe API
...
When the `run` subcommand is invoked, authenticate to the Stripe API
using API keys.
2022-06-16 18:05:26 +05:30
Andrew Farries
cf8d8a3fd9
Add .gitignore file
...
Ignore `apikeys` file, used for local testing.
2022-06-16 18:05:26 +05:30
Andrew Farries
3b721cbbba
go get github.com/stripe/stripe-go/v72
2022-06-16 18:05:26 +05:30
Milan Pavlik
ae50163c9f
[usage] Round
2022-06-13 19:50:22 +05:30
Milan Pavlik
e3f9ca5858
[usage] Fix report generation
2022-06-10 19:43:20 +05:30
Milan Pavlik
5176a908d7
[usage] Generate usage report
2022-06-10 17:18:20 +05:30
Milan Pavlik
e396ad0e19
[usage] Attribute workspaces to a team
2022-06-09 21:20:19 +05:30
Milan Pavlik
41f4820124
[usage] Add listing of memberships by UserID
2022-06-09 13:21:18 +05:30
Milan Pavlik
b1a36659fd
[usage] Simplify Workspace record creation for tests
2022-06-09 12:49:19 +05:30
Milan Pavlik
9121279030
[usage] List workspaces for each workspace instance in usage period
2022-06-09 12:12:19 +05:30
Milan Pavlik
f200b86edb
[usage] Add db model for TeamMembership
2022-06-08 15:50:18 +05:30
Milan Pavlik
61e7ffdb14
[usage] Validate workspace instance records for usage
2022-06-08 14:54:18 +05:30
Milan Pavlik
a56fffbd94
[usage] List workspace instances
2022-06-07 21:26:17 +05:30
Milan Pavlik
7d6a91c3c9
[usage] Automatically cleanup records between test DB connections
2022-06-07 17:29:17 +05:30
Milan Pavlik
4a5f8ec4fb
[usage] Handle empty value varchar time
2022-06-07 16:51:17 +05:30
Milan Pavlik
fa36e39b69
[usage] Log db with standard logger
2022-06-07 16:15:17 +05:30