Add cost service type to service type definitions#60
Conversation
Introduces the `cost` service type as a fifth DCM service type alongside vm, container, database, and cluster. Unlike the four compute-oriented types, cost provisions visibility (metering, overhead distribution, financial tracking) rather than infrastructure. Includes the CostSpec schema with target, cost_model (rates, markup, distribution), and currency fields. Supports three tiers: basic metering, distribution, and full cost. See the Cost Management Service Provider enhancement for the full SP proposal. Signed-off-by: Pau Garcia Quiles <pgarciaq@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
…st type End-to-end proof that the dcm-project/enhancements#60 'cost' serviceType maps onto UDLM, and the first use of the Process entityType in the registry. - family=Resource, entityType=Process (a long-running observational process realized by a cost provider, e.g. Koku) — not infrastructure, not Knowledge - target = a typed `references` relationship to the compute types; the resource id is resolved on the instance, not baked into the type spec - costModel (rates/markup/distribution) + currency = declarative spec data - three-tier model = a real JSON-Schema presence-conditional (E3): tier-3 (rates present) requires currency; tier-1 basic metering passes. Verified with Draft202012Validator. - metered/computed figures = typed Realized outputs (E2: meteredUsage, computedCost, costBreakdown, period...) - 'cost = metering x rate' is prose in computedCost's description only — never an embedded expression (G2); the computation is the provider's act - README + design-notes §4a cross-reference the worked type validate.py: all 7 types + instance valid (0 invalid). Signed-off-by: Chris Roadfeldt <chris@roadfeldt.com>
|
Why: vendor-agnosticism is a core DCM/UDLM requirement — a service type should be implementable by any provider, not just one. This Rather than define a bespoke cost vocabulary (Koku's 40+ dimensions, Net: any FOCUS-emitting cost provider — not just Koku — can implement the same The underlying principle: adopt the external standard by reference rather than re-model it, which keeps the contract vendor-neutral and avoids reinventing a spec the ecosystem already maintains. |
There was a problem hiding this comment.
You may want to add a bullet in the goal section too: https://github.com/pgarciaq/enhancements/blob/92fc0d9cae2b63078ccac810b3d5d217f91e52e2/enhancements/service-type-definitions/service-type-definitions.md#goals
| | Field | Required | Type | Description | | ||
| | :------------ | :------- | :----- | :--------------------------------------------------- | | ||
| | resource_id | Yes | string | DCM instance ID of the resource to track costs for | | ||
| | resource_type | No | string | Type of the target resource (default: _cluster_) | |
There was a problem hiding this comment.
why resource_type is not mandatory and why defaulting to cluster? IIUC, this SP will monitor the a resource created by DCM and provide cost related data to the user (and DCM?)
So how is resource_type influencing this? I see nothing about that too
There was a problem hiding this comment.
So how is resource_type influencing this? I see nothing about that too
maybe this is out of the scope of this document and it will be for each SP enhancement (eg: #57 ) to define how this field's influence
There was a problem hiding this comment.
The possible values (cluster, vm, container) for resource_type is the same as service_type for the instance, no?
There was a problem hiding this comment.
that is my guess yes as the cost manager for DCM will look into resources created by DCM but it needs to be explicitly written here IMO
and as #57 is focused on cluster only, I really believe we should remove the default cluster value to avoid any confusiuon
There was a problem hiding this comment.
i'm thinking the field names might be confusing and since the cost resource itself targets other resources, maybe target_id and target_type might be better here? And definitely agree, these should be required. And all default values are set in the catalog item and not on the service type level so the doc should give examples instead.
| The initial implementation is backed by | ||
| [Red Hat Lightspeed Cost Management](https://github.com/project-koku/koku) | ||
| (Project Koku). See the | ||
| [Cost Management Service Provider enhancement](https://github.com/dcm-project/enhancements/blob/main/enhancements/cost-sp/cost-sp.md) | ||
| for the full proposal. |
There was a problem hiding this comment.
Is there any need to mention this? This cost type is generic and can be implemented by any cost SP/product
| | :--------- | :------- | :----------------------------------- | :--------------------------------------------------- | | ||
| | target | Yes | [Target](#cost-target-object) | The resource to track costs for | | ||
| | cost_model | No | [CostModel](#cost-costmodel-object) | Rate configuration (absent = basic metering only) | | ||
| | currency | No | string | Currency code (default: _USD_) | |
There was a problem hiding this comment.
| | currency | No | string | Currency code (default: _USD_) | | |
| | currency | No | string | Currency code (e.g: _USD_, _GBP_) | |
Examples can be given here because default values are set on the catalog item by the catalog author.
| | :----------- | :------- | :-------------------------------------- | :----------------------------------------------- | | ||
| | rates | No | array[[Rate](#cost-rate-object)] | Tiered rate definitions (absent = distribution only) | | ||
| | markup | No | [Markup](#cost-markup-object) | Markup percentage | | ||
| | distribution | No | string | Distribution method: _cpu_ or _memory_ (default: _cpu_) | |
There was a problem hiding this comment.
| | distribution | No | string | Distribution method: _cpu_ or _memory_ (default: _cpu_) | | |
| | distribution | No | string | Distribution method: _cpu_ or _memory_ (e.g: _cpu_) | |
| | :-------- | :------- | :----- | :------------------------------------------------------------- | | ||
| | metric | Yes | string | Rate metric (e.g., _cpu\_core\_usage\_per\_hour_, _node\_cost\_per\_month_) | | ||
| | cost_type | No | string | _Infrastructure_ or _Supplementary_ (default: _Infrastructure_) | | ||
| | value | Yes | number | Rate value (≥ 0) | |
There was a problem hiding this comment.
for consistency across the document, this should be integer?
Summary
Adds the
costservice type as a fifth DCM service type alongsidevm,container,database, andcluster.Unlike the four compute-oriented types,
costprovisions visibility (metering, overhead distribution, financial tracking) rather than infrastructure.Changes
costto the service type enum and listsCostSpecschema with:target(resource_id, resource_type)cost_model(rates, markup, distribution)currencyContext
This service type is used by the Cost Management Service Provider enhancement, which was asked to define its service type in a separate PR to the service-type-definitions document (consistent with how other SPs reference existing type definitions rather than defining them inline).
The initial implementation is backed by Red Hat Lightspeed Cost Management (Project Koku).
Test plan
Made with Cursor