A meter captures the usage measurement configuration of a metered feature.
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 MeterJSON
Meters attributes
The type of meter that determines how usage is measured for the meter.
Usage is computed from the SQL query over usage_event properties.
Usage is computed from a mathematical formula combining other meters.
The current status of the meter.
The meter is active and new entitlements can be created towards it.
No new entitlements can be created towards the meter. However, any pre-existing entitlements from the time that the meter was active remain effective.
The meter 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.
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 meter. This array has only one element since any given meter is associated with only one feature.
Feature attributes
The current status of the feature.
The feature is published. 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 item or subscription entitlements from the time that the feature was active 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.