Commit Graph

25 Commits

Author SHA1 Message Date
Adrian Turjak 4fe7f644f8 DB Managment Transformer to use flavor and prefix
Change-Id: I72f430a948cc9122ee17581b37ca8b5f39928cc7
2020-07-20 14:23:04 +12:00
Adrian Turjak 0a0c7e12ef add transformers for trove
slightly alter how config is loaded to transformers.

Change-Id: I32bf34d270604e8c755160a7dac71e99a38f2a74
2020-07-07 09:23:50 +12:00
Adrian Turjak 226ceacf90 Add support for object storage policies
Introduce a new ObjectStorageMax transformer which
takes a container and bases the service for it on the
policy used for it in swift so that we can charge differently
for each policy.

Change-Id: Id1a0d7783ae72de0a2da36245badbd770508be81
2019-11-07 14:05:43 +13:00
Zuul aafa2c0038 Merge "Support JSON file as an ERP driver" 2019-03-11 22:54:15 +00:00
Feilong Wang 5770bef95e Support JSON file as an ERP driver
Change-Id: I080082a9d8e2f458336985ca996fdf3d71a7d629
2019-03-08 15:47:57 +13:00
Feilong Wang 873ceaba3a Add new transformer for Magnum pollster
Change-Id: If45b8b822cc9469135501cea9ab0c1cfab9a5121
2018-10-26 15:48:49 +13:00
Feilong Wang 8219bdbe6c Add oslo.cache to distil.conf
Change-Id: I5ff4bc88c8ea37e65d6a3564358c90f3bf29e03f
2017-08-09 14:03:52 +12:00
Lingxian Kong 00638fa410 Fix policy check for distil
To keep consistent with other projects and enable 'admin_or_owner' rule
in policy.json, this patch adds neccessary fields for policy check
target and use correct method to get context dictionary.

To be clear, the rule in policy.json 'project_id:%(project_id)s' comes
from Nova originally, the policy module will get project_id from
request URL to Nova service andn compare with project_id in the user
credential. For other projects which don't contain project_id in URL,
just get it from user credential to make the rule work properly.

Change-Id: I5979f2c5204e373cc4a84b1f6997845aabc891cb
2017-06-21 13:53:25 +12:00
Fei Long Wang 41593343a4 Open API to tenant users
Currently, only admin user can consume the billing REST
API which means tenant user can't monitor/audit their usage/cost
via API. This patch opens the API by making the project id as
optional for admin user and getting the project id from context
for non-admin user.

Change-Id: I497348dfae882892826ec8bcd2303195e4fe2b31
2017-06-20 12:10:33 +12:00
Fei Long Wang bf19284348 Add /credits API
Support /credits API so that project users can track their current
credit by API. And the credits info can be also shown on the
distil panel.

Change-Id: I5b44d8b05b551c5db3416c00b7caf472c3350be8
2017-06-19 16:55:33 +12:00
Jenkins 1223668db8 Merge "Fix getting host name from instances" 2017-06-16 00:12:38 +00:00
Lingxian Kong 4fb95009c4 Improve get_health API
Query database directly using filtering mechanism to make logic
in API layer clear and simple.

Make the API only accessible to admin only for the time being.

Currently, we only check usage collection to achieve feature parity
with current monitoring requirements. In future, we could add running
status for ERP system, etc.

Change-Id: I044cd10780f2305775d05b107be5e87c41ce7826
2017-06-14 16:33:49 +12:00
Lingxian Kong 9f90b6ce8a Fix getting host name from instances
Distil will update instance metadata using the last sample metadata
from Ceilometer in each collect window loop. Sometimes, the last sample
is not valid, which will lead to wrong property(e.g. 'host') in
database.

This change will wash the data points during trasformation to make
sure it contains valid information in the data points.

Also, make Distil get instance host name from 'node' propery first then
'host', because in notification samples Ceilometer will override the value
using publisher id. 'node' field doesn't exist for samples generated by
Nova API query.

This change only touch the Distil V2 code. Fix for Distil V1 will be
covered in a seperate patch.

Change-Id: I7346f928f8f7356a47403429e09f0b1495aa82c4
2017-05-24 13:01:25 +12:00
Lingxian Kong 2ff5b1518c Add /quotations rest api
Allow user get current month estimated cost. The output data
structure is the same with /invoices api.

Also remove the unused /costs api and rater module.

Change-Id: I582afa6cf7e5b86cc54db58ead501793e727bfd6
2017-05-12 14:30:26 +12:00
Lingxian Kong 7285c5a109 Add /invoices rest api
Allow end user query history invoices from ERP server.

Change-Id: I06776b26c8565bb3e9735ffceeab0bd399ca487a
2017-05-08 16:34:04 +12:00
Fei Long Wang a311817795 Rename /usages to /measurements
The plural format of usage is not proper in the context of billing.
measures could be a better name, especially given that the data in
Distil has been transformed, reflecting a time-based measurement.

Change-Id: Iece7bdb44fc6b80623477c55064998c6b0d75140
2017-04-12 14:22:55 +12:00
Fei Long Wang 99ead19a91 Fix wrong policy.json.sample
Change-Id: I6310aa8c2ea0988fb5a1d0839b43ce3c50cca63b
2017-03-21 15:20:21 +13:00
adrian-turjak b2e57549e9 Collecting host info for instance
Currently the mapping to collect host info of instance is not correct,
and unfortunately, we can only get a hexdigest of project_id + host_name.
But we can get the correct host name by using the same algorithm when
doing billing.

Closes-Bug: #1665191

Change-Id: I0585c1e9a01250e6b34f3c1d060b76db34fcd6bf
2017-02-16 02:21:04 +00:00
Lingxian Kong 3284497cf7 Transformer improvement
- Use InstanceUptime transformer instead of Uptime(Uptime is not used
  anywhere).
- Get instance flavor name direct from instance metadata to avoiding
  calling nova api.
- Fix empty sequence error in NetworkServiceTransformer.
- Add unit tests for new transformer code.

Change-Id: I22e1f854ac26dba3824a7e1df0850522aa2ea774
2017-01-25 15:04:13 +13:00
Lingxian Kong 20654fb2b2 Make transformer entry point names consistent with config file
Change-Id: Ic8956170d9f6c03c16e69ecb11b69ff24ba99aaf
2017-01-10 16:01:41 +13:00
Fei Long Wang 09b03931eb Add policy support
Using oslo.policy to support access control for Distil API
access, which will follow the community way.

Change-Id: I670d9fde4f5c368e82c26b512b7c1e46c2e380ec
2016-10-06 14:21:06 +13:00
Fei Long Wang 678f69b479 Support generating config automatically
Change-Id: I245cd34d595293556b7c9b006ea912d0ad562e95
2016-06-27 21:26:55 +12:00
Fei Long Wang 9024534306 Implement /costs on new service
Change-Id: I12469ec39fcaa79d6588d396367f14107cf4299f
2016-06-03 15:07:52 +12:00
Lingxian Kong 2fc9f9084a Refactor collect_usage function
TODO:
- implement get_meter function in CeilometerCollector
- implement _get_projects function in CollectorService
- implement usages_add function in db layer
- split tenants handling in different thread
- more rigorous testing

Change-Id: I0235c78c7dc520e4bf08405ebf8e06875868daab
2016-05-19 10:02:16 +12:00
Fei Long Wang 0d20c80a6e Refactor Distil API to support new endpoints
Change-Id: I4d456f9228e879234898177d1f2d791d2ffbbf46
2016-05-05 15:20:17 +12:00