-
Notifications
You must be signed in to change notification settings - Fork 2
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
PR for appcat on change-billing #512
Conversation
4df6eb5
to
aa24b01
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
But please be sure that the metrics on mimir are identical. Ideally roll it out to the lab and run the odoo job then verify with tobru.
class/defaults.yml
Outdated
@@ -55,7 +55,7 @@ parameters: | |||
appcat: | |||
registry: ghcr.io | |||
repository: vshn/appcat | |||
tag: v4.98.0 | |||
tag: change-billing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't break it with git push --force
:D
aa24b01
to
9a2b6b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing and then LGTM
component/billing.jsonnet
Outdated
@@ -157,8 +157,8 @@ local generateCloudAndManaged = function(name) | |||
// For postgresql we have a missmatch between the label and the name in our definition. | |||
local queryName = if name == 'postgres' then name + 'ql' else name; | |||
|
|||
local managedQuery = 'appcat:metering{label_appuio_io_billing_name="appcat-' + queryName + '",label_appcat_vshn_io_sla="%s", tenant_name!="APPUiO"}'; | |||
local cloudQuery = 'appcat:metering{label_appuio_io_billing_name="appcat-' + queryName + '",label_appcat_vshn_io_sla="%s", tenant_name="APPUiO"} * on(label_appuio_io_organization) group_left(sales_order) label_replace(appuio_control_organization_info{namespace="appuio-control-api-production"}, "label_appuio_io_organization", "$1", "organization", "(.*)")'; | |||
local managedQuery = 'sum_over_time(appcat:metering{label_appuio_io_billing_name="appcat-' + queryName + '",label_appcat_vshn_io_sla="%s", tenant_name!="APPUiO"}[60:1])/60'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just remembered something:
When we do this exact query via the golang prometheus client, it will be slightly off compared to the GUI and recording rules.
For some weird obscure reason we have to use [59:1]
instead of ´[60:1]´.
Refs:
Aldebaran has that in every of their cronjobs: https://github.com/vshn/package-appuio-reporting-aldebaran/blob/master/main.yml#L1015
Note about this the legacy AppCat query: https://github.com/vshn/component-appcat/blob/master/component/promql/appcat.promql#L63
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting
9a2b6b9
to
fbfa96c
Compare
fbfa96c
to
083d8f5
Compare
Summary
Currently we are getting data for billing from the workloads (deployments and statefulsets) special label
appcat.io/billing=true
. This approach proved to be ineffective for some services such as VSHNPostgreSQL which is managed by Stackgres. Unfortunately the operator sometimes is managing the pods directly, by passing the workload. In this particular case we end up without the necessary label in the pod definition.This new approach manages differently the billing architecture. If previously we were having one prometheus rule which would gather unnecessarily difficult specific data, now we have one rule per each instance namespace and it is managed directly by the composition function where we get reliable data from the source.
Checklist
bug
,enhancement
,documentation
,change
,breaking
,dependency
as they show up in the changelog
Link: vshn/appcat#246