Commit Graph
28 Commits
Author SHA1 Message Date
Jiahui 5cfeb599ca Optimize billing efficiency (#5362)
* billing reconciler changed from controller trigger to scheduled task execution.

* with manager runner

* with manager runner

* change cmv billing with manager runner

* optimize log

* fix reconcile

* add billing with wait group goroutine

* add logger

* get the user cr using the cacheless client

* optimize

* Removes mongo Aggregate processing data that is too slow and uses in-memory batch user metering data.

* fix

* remove the owner that does not need to be updated

* optimize log && fix the genGroupKey GenerateBillingDataFromRecords rules

* make format
2025-02-10 16:33:16 +08:00
Jiahui 3cd3d6dddd Feat: llm token account service (#5202)
* add get account with workspace id

* add charge billing

* add ReconcileUnsettledLLMBilling auto reconcile

* add HourlyLLMBillingArchive

* custom startReconcileLLMBilling ticker time

* Process timer tasks through queue tasks to prevent task accumulation from causing the timer to miss execution opportunities.

* Create a buffered channel interrupt and use the signal.

* reconcile user active task reward with clause Locking.

* change signal notify to SIGTERM

* add account service metrics
2024-11-20 17:48:48 +08:00
Jiahui 98395f7dc1 remove unused code (#5134) 2024-10-12 15:40:07 +08:00
Jiahui 351e761613 Feat/active task (#5121)
* feat active task & first recharge discount
* sort discount step & add lock for payment
2024-10-08 15:02:23 +08:00
Jiahui 2882addbbc Feat/invoice (#4988)
* add invoice service
2024-08-23 17:56:41 +08:00
xuziyiandjiahui cca4da935f feat: get os traffic from minio (#4968)
* get os traffic from minio

* optimize get obj traffic within the last hour

---------

Co-authored-by: jiahui <bxy4543@gmail.com>
2024-08-20 18:04:22 +08:00
Jiahui 594f3af2ac CostCenter api update (#4932)
* optimize monitoring app store

* add get app instance role

* add app instance billing

* add test

* fix

* add CheckPermission with kc

* add get-regions api

* change regions to slice

* add GetCostAppList GetCostOverview api

* fix check-auth user

* fix divisor to zero

* fix get cost overview

* add app type list api

* add init region info

* fix docs get cost app type list

* add service account ingress

* add check region auth

* fix region auth

* add skip tls client get api

* add debug mod

* add basic cost distribution api

* remove deprecated encrypt account field

* set default time range

* add GetAppCostTimeRange api

* add dao test

* make format && fix semgrep ci

* make format && fix semgrep ci

* fix GetCostAppList

* optimize account reconcile

* ignore user not found

* add used_amount result for get app cost

* Ignore that a user is not created for a long time, cause a lot of errors

* add app cost sort with time

* optimize cost app api

* optimize cost app api

* optimize cost app api

* optimize cost app api

* get namespace id and name

* remove debug print

* remove debug print

* terminal named by `app.kubernetes.io/part-of` label
2024-08-06 15:45:56 +08:00
Jiahui 708e977d11 feat: app cost svc (#4843)
* account service add app cost api

* add transfer all service

* optimize

* fix get user with id

* add white list k8s host for service auth

* add transfer from user id

* swag init

* rename transfer table to UserTransfer

* add transfer id

* swag init

* fix get transfer

* optimize log

* fix

* fix get user

* fix get transfer limit range

* add limitrange log

* fix time range

* fix limit req name
2024-07-04 17:28:45 +08:00
Jiahui 1ad3c7185c Feat/ add vms/email debt notification (#4763)
* optimize debt log & fix named kb cluster backup pvc named.
* add vms notification for debt
* add email notification for debt
2024-05-29 16:31:41 +08:00
Jiahui 26739d9a6c fix set account create region id (#4739)
* fix set account create region id

* fix null metrics client cause monitor error
2024-05-16 11:26:28 +08:00
Jiahui 8cb7b73400 Feat: Cloud Virtual Machine Billing (#4699)
* init vm billing
2024-04-24 15:22:41 +08:00
Jiahui 8d6e23fd7c add init job (#4629)
* fix init job

* fix init job

* fix init job

* fix init job

* fix
2024-03-27 14:24:09 +08:00
Jiahui 0755c905e0 License with accountv2 (#4600)
* adapt cockroachdb for license & init job
2024-03-19 15:03:11 +08:00
Jiahui 5e0ea541ca Transfer service (#4594)
* add transfer/invoice service
2024-03-15 14:34:29 +08:00
Jiahui 0350700b55 Unified account (#4576)
* accountv2 interface implementation:
use the cockroach distributed database as a multi-region unified account data storage source to replace the old CRD interaction format;
temporarily turn off account functions such as transfers and activities.

* create account v2 with cockroachdb

* add get account api service;
2024-03-11 15:13:50 +08:00
Jiahui 14e397c38d Fix/traffic db name (#4548)
* fix custom traffic db name

* optimize traffic speed
2024-03-04 15:47:31 +08:00
Jiahui e819739117 Optimize/monitor (#4481)
* add Traffic interface

* add sum traffic used

* remove useless code
2024-01-12 11:42:56 +08:00
Jiahui 4bea4eaf36 Feat/cost service (#4391)
* init account service

* rebase

* add properties query

# Conflicts:
#	service/go.work.sum

* add GetCostAmount query api

* format && add account service workflow

* add swagger api docment for account service

* rebase upstream
2023-12-13 10:53:49 +08:00
Jiahui 3eb6823238 feat: message notification (#4350)
* add ali sms service for debt message notification

* add notification crd && fix debt update notification
2023-11-29 15:27:34 +08:00
Jiahui 4efa9d802e Delete useless code (#4340)
* delete monitor-metering useless code

* delete monitor-metering ci workflow
2023-11-23 16:21:39 +08:00
Jiahui 07abd93e74 feat billing with app/type/ns (#3963)
* feat billing with app/type/ns

* optimize transfer saver && delete accountbalance cr

* init billingInfoquery crd to replace namespaceshistory, costcenter query

* add deploy.yaml.tmpl query crd

* query with order_id

* set resources.DefaultPropertyTypeLS
2023-09-22 11:50:45 +08:00
yy df817021de delete and mv pkg for controllers. (#3938)
* delete and mv pkg for controllers.

* fix ci

* go import
2023-09-15 19:07:42 +08:00
Jiahui 84b39f8183 add namespace billinghistory query for costcenter (#3902)
* add namespace billinghistory query for costcenter
2023-09-13 17:47:54 +08:00
Jiahui 6a2d9f7e83 Feat: adapt multi namespace account (#3828)
* account adapt user multi namespace

* add debt controller adapt

* fix billing controller get namespace;
fix set account && ns label cache

* account controller reconcile with owner user create

* multi ns suspend and resume by debt controller
2023-09-12 16:21:30 +08:00
Jiahui 8e55bc84b1 set the monitor collection retention time (#3737) 2023-09-04 11:53:55 +08:00
Jiahui c236f8cf7a add controllers license to Makefile: make license.controller (#3707) 2023-08-18 11:57:17 +08:00
Jiahui 0fc3f44fbb fix transfer self; (#3493)
add GetBillingCount db Interface
2023-07-12 14:59:16 +08:00
Jiahui 5207f95349 feat: resources monitor, metering controller, billing controller, billingrecordquery, pricequery controller (#3008)
* change accountbalance struct
add billing controller;
add new query CRD: billingresordquery and pricequery, and query controller;
modify the storage amount ratio to 1:1000000
optimize mongo query code

* hide the old metering controller

* add query gvk to debt webhook white list;
monitor data table by day, eg: monitor_20230517;
billing collection cancels the timing table and changes it to an index type table;
optimize the billing logic and bill by the hour;
optimize the use of gonanoid to generate 12-digit bill id;
payment crd adds the PaymentMethod field, which is used to identify wechat or other billing methods in the future.

* add resources controller workflow
fix payment controller panic error
add resources controller cluster image workflow
2023-05-25 11:56:47 +08:00