A metered feature object represents two things:
- the feature whose entitlement is consumed based on measured usage.
- the configuration that measures that usage.
Meter configuration examples
The following response excerpts show how query, column_definitions, and group_by represent the metering configuration.
Availability
Support for adding GROUP BY to metered features and retrieving usage grouped by attributes is an upcoming capability and is not generally available yet. It will be made available in the coming weeks.
When query includes a GROUP BY clause, the response includes group_by as an ordered list of the group-by attributes. Their order matches the order in the GROUP BY clause. The group_by attribute is not returned when the query does not include a GROUP BY clause.
Without group-by attributes
With group-by attributes
Group-by attributes used only in the GROUP BY clause are returned in group_by and do not require column_definitions entries.
Sample Metered featureJSON
Metered features attributes
The type of meter. Determines how usage is measured for the metered feature.
Usage is computed from a SQL query over usage_event properties.
Usage is computed from a mathematical formula combining other meters.
The current status of the metered feature.
The metered feature is active and new entitlements and subscription entitlements can be created for it.
No new entitlements and subscription entitlements can be created for the metered feature. However, any pre-existing entitlements and subscription entitlements remain effective.
The metered feature has been permanently deleted.
The SQL query used to calculate usage from usage_event properties. For example: SELECT SUM(api_calls) FROM events WHERE status = 'completed'.
To group usage by attribute values, include a GROUP BY clause. Each distinct set of group-by attribute values forms a separate usage group. For example: SELECT SUM(hours) FROM events WHERE status = 'completed' GROUP BY gpu_type, region. The response returns the group-by attribute names in group_by, in the same order.
Availability
Support for adding GROUP BY to metered features and retrieving usage grouped by attributes is an upcoming capability and is not generally available yet. It will be made available in the coming weeks.
Constraints
- Properties used in the aggregate expression or
WHEREclause must be listed incolumn_definitions.column_name. - A group-by attribute used only in the
GROUP BYclause does not require acolumn_definitionsentry. Its value is treated as a string. - The
GROUP BYclause can contain up to 5 group-by attributes. - Exact duplicate group-by attribute names are not allowed. Names are case-sensitive, so
region, regionis invalid, whileregion, Regionidentifies two different attributes.
Usage reporting and subscription billing
For a metered feature whose query includes a GROUP BY clause, grouped usage is available in Retrieve usage summary for a subscription and Retrieve usages for an invoice as PDF. These groups are for reporting only. Subscription billing uses the overall aggregate for the metered feature and does not bill each group separately.
For example, a SUM query can return 60 hours for region=us-east and 40 hours for region=eu-west. The reporting operations can display both groups. Subscription billing uses the overall aggregate of 100 hours.
An ordered list of the group-by attributes in the GROUP BY clause of query. This attribute is returned only when query includes a GROUP BY clause.
Availability
Support for adding GROUP BY to metered features and retrieving usage grouped by attributes is an upcoming capability and is not generally available yet. It will be made available in the coming weeks.
For example, when query is SELECT SUM(hours) FROM events WHERE status = 'completed' GROUP BY gpu_type, region, group_by is ["gpu_type", "region"].
The feature associated with this metered feature. This array has only one element since any given metered feature is associated with only one feature.
Feature attributes
The current status of the feature.
The feature is active. Any entitlements or subscription entitlements defined for the feature take effect immediately.
No new entitlements or subscription entitlements can be created for the feature. However, any pre-existing entitlements and subscription entitlements remain effective.
This value is not applicable for metered features.
The type of feature. The value is always range.
This value is not applicable for metered features.
This value is not applicable for metered features.
This value is not applicable for metered features.
The feature is quantity based, with entitlement levels between 1 and unlimited.