To utilize the metering API to obtain metering and billing data for Virtual Private Cloud OnDemand, the Metering Service requires the context for metering data collection.
The Metering Service must map resource usage for a specific instance to a service group. The Service Controller requires a mapping between serviceGroupId and instance id. The Metering Service passes the instance id to the Service Controller and the Service Controller responds with the serviceGroupId for that instance id. The Compute Service maintains the metering events for the instance id.
See About Plans, Instances, and the Compute Service for information about how an instance contains the serviceGoupId element.
The Metering Service operates using the following object hierarchy (with an ID for each object) to map a customer's company to their billed usage.
Metered entities provide a container for measurements and are directly managed by the Metering Service. The Metering Service defines two abstract containers for metering—L2 and L1. These containers correspond to entities in the Compute Service. An L1 entity is a primary container that the Metering Service monitors; an L2 entity is a container of L1 entities.
In the Compute Service, a virtual machine and a gateway are L1 entities and the virtual data center (VDC) that contains them is the corresponding L2 entity.
Current usage includes mid-cycle usage when an account is in between billing statements; you query for current usage by using date ranges. The Metering Service returns data for bill-to-date usage.
Billed usage includes usage, rates, and cost as invoiced by VMware. You query for billed usage by using the anniversary (month and year) date.
Getting current and billed usage across the same date range involves issuing separate calls to the current and billed usage endpoints with appropriate input dates.