Naming Scheme for Billing
This page specifies various aspects of the AppCatalog billing.
Product Naming in the Database
In order to support all future AppCatalog services and its subproducts, we need to define a naming scheme to differentiate between them. Each AppCatalog service will have multiple variations.
-
PostgreSQL standalone without SLA
-
PostgreSQL standalone with SLA
-
PostgreSQL replicated without SLA
-
PostgreSQL replicated with SLA
-
PostgreSQL CloudSQL
-
PostgreSQL RDS
-
PostgreSQL Exoscale
Every permutation will need an identifier, as it will be associated with a product in the product dimension of the billing database. Also, depending on the cluster where a given service is running, there could be different prices and discounts.
To accommodate for all these variations, the default identifier of each product in the database should be as follows:
$servicename:$provider:$tenant:$namespace:$architecture-$sla
-
servicename
: The name of the AppCatalog service, in this example PostgreSQL -
provider
: The provider type of the service, for exampleexoscale
orvshn
. -
sla
: The name of the applied SLA. There are two valuesBestEffort
andGuaranteed
. The SLA might be omitted for cloud provider instances if they do not apply. -
architecture
: The architecture of the service. For cloud providers this can be plans (for example Exoscale startup-4). For VSHN Managed Services it’s the architecture (for example standalone, cluster, replicated). -
tenant
: The customer who’s invoiced. Usually maps to theorganization
label. -
namespace
: The namespace where the resource is running.
More specific product identifiers for special cases are added as needed. See the "examples" section of the system idea for more information about how the matching works.
Query Names for Reporting
The query names in the reporting tool should match the naming for the product.
-
appcat_postgresql_vshn_standalone_besteffort
-
appcat_postgresql_vshn_standalone_guaranteed
Trivial Prometheus Query Example
The following is a trivial query that contains all information that is needed to bill a service:
label_replace(
label_replace(
label_replace(
vector(42), (1)
"category", "my-provider:my-namespace", "", "" (2)
),
"product", "my-product:my-provider:my-tenant:my-namespce:my-architecture-my-sla", "", "" (3)
),
"tenant", "my-tenant", "", "" (4)
)
1 | Actual query that creates the billable values, for most AppCatalog services, this will be "instance hours" |
2 | Category, this value is used for grouping on the invoice |
3 | Product source string, this string will be used to do various matching operations during further reporting and enrichment operations |
4 | Tenant ID, for matching the tenant |
This example should not be used as a query template, it’s only to illustrate what information is required by the billing framework. Depending on the exporter, the available labels could already contain all necessary information, thus simplifying the query.