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

New billing cloud #64

Merged
merged 10 commits into from
Dec 20, 2023
Merged

New billing cloud #64

merged 10 commits into from
Dec 20, 2023

Conversation

zugao
Copy link
Contributor

@zugao zugao commented Nov 29, 2023

Summary

This PR changes the way we bill our cloud services.
Instead of writing our billing metrics to a billing database, we now export the billing metrics directly into our Odoo.

Checklist

  • The PR has a meaningful title. It will be used to auto generate the
    changelog.
    The PR has a meaningful description that sums up the change. It will be
    linked in the changelog.
  • PR contains a single logical change (to build a better changelog).
  • Update the documentation.
  • Categorize the PR by adding one of the labels:
    bug, enhancement, documentation, change, breaking, dependency
    as they show up in the changelog.
  • Link this PR to related issues or PRs.

@zugao zugao marked this pull request as draft November 29, 2023 08:24
Copy link
Contributor

@Kidswiss Kidswiss left a comment

Choose a reason for hiding this comment

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

Some things I found while looking at this

@@ -17,7 +17,6 @@ See the [component documentation](https://hub.syn.tools/billing-collector-clouds
## Getting started for developers

In order to run this tool, you need
* An instance of the billing database
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we would need some Odoo16 endpoint somewhere?

But on the other hand we could probably have a small go tool that would just print all JSON that get posted to it to act as a mock endpoint.

pkg/cloudscale/metrics.go Outdated Show resolved Hide resolved
pkg/cloudscale/metrics.go Outdated Show resolved Hide resolved
pkg/cmd/exoscale.go Outdated Show resolved Hide resolved
@zugao zugao force-pushed the new-billing-cloud branch 5 times, most recently from 7ddb29b to 4fb4f61 Compare December 5, 2023 09:06
@TheBigLee TheBigLee force-pushed the new-billing-cloud branch 2 times, most recently from 4322919 to fcd0672 Compare December 14, 2023 14:56
@TheBigLee TheBigLee requested a review from Kidswiss December 15, 2023 08:32
Copy link
Contributor

@Kidswiss Kidswiss left a comment

Choose a reason for hiding this comment

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

LGTM, just a few comments that still say billing database and some ideas for the future

collectInterval = 23
}

wg.Add(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just an idea for the future: we could change this to a select statement and use tickers. This way we could also integrate proper kill signal handling to exit the loop.

pkg/exoscale/dbaas.go Outdated Show resolved Hide resolved
pkg/exofixtures/types.go Outdated Show resolved Hide resolved
@TheBigLee TheBigLee marked this pull request as ready for review December 15, 2023 12:32
@Kidswiss Kidswiss self-requested a review December 18, 2023 13:58
pkg/control/control.go Outdated Show resolved Hide resolved
pkg/control/control.go Outdated Show resolved Hide resolved
pkg/kubernetes/client.go Show resolved Hide resolved
@TheBigLee TheBigLee requested a review from Kidswiss December 18, 2023 14:25
Copy link
Contributor

@Kidswiss Kidswiss left a comment

Choose a reason for hiding this comment

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

Please fixup your f commits.

The rest LGTM.

This commit removes any integration with the billing database. The
metrics will be provided via an exporter. This integrates more nicely
with the rest of the billing system.

Metrics that are provided once a day, like for object storage, are
only scraped after a specified time. Then the value will be divided by
the rest of hours for the given day.

Exoscale DBaaS metrics are provided as is.

The metrics exported have the name `appcat:raw:billing` as they can't
be used directly for the billing. A set of prometheus rules will do
some aggregation and properly export them as `appcat:billing`. These
rules are part of the component and not included in this commit.
@TheBigLee TheBigLee force-pushed the new-billing-cloud branch 9 times, most recently from 42398b8 to 44b9cd6 Compare December 19, 2023 10:20
Signed-off-by: Nicolas Bigler <[email protected]>
Signed-off-by: Nicolas Bigler <[email protected]>
@TheBigLee TheBigLee force-pushed the new-billing-cloud branch 2 times, most recently from 92af2ee to 16133f2 Compare December 19, 2023 15:30
Signed-off-by: Nicolas Bigler <[email protected]>
pkg/exoscale/dbaas.go Outdated Show resolved Hide resolved
@TheBigLee TheBigLee force-pushed the new-billing-cloud branch 2 times, most recently from 155fd38 to f918e63 Compare December 20, 2023 09:27
@TheBigLee TheBigLee requested a review from Kidswiss December 20, 2023 09:27
@TheBigLee TheBigLee added the enhancement New feature or request label Dec 20, 2023
Signed-off-by: Nicolas Bigler <[email protected]>
@TheBigLee TheBigLee merged commit c362853 into master Dec 20, 2023
3 checks passed
@TheBigLee TheBigLee deleted the new-billing-cloud branch December 20, 2023 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants