After you list a Compute Nest service on Alibaba Cloud Marketplace with the pay-as-you-go billing method, you must report usage data for each service instance so that Alibaba Cloud Marketplace can calculate charges. This topic describes how to report usage data and modify the reporting method.
Background information
Usage reporting is the process of pushing usage data from a Compute Nest service instance to Alibaba Cloud Marketplace. The marketplace then calculates charges for the service instance based on the product's predefined billing information and deducts the fees.
For pay-as-you-go services, Alibaba Cloud Marketplace provides 11 metering dimensions:
Frequency,Period,Storage,NetworkOut,NetworkIn,Character,DailyActiveUser,PeriodMin,VirtualCpu,Memory, andUnit.Pay-as-you-go services support two usage reporting methods: active reporting by the service provider and automatic reporting by Compute Nest. For the
Period,PeriodMin,VirtualCpu, andStoragedimensions, both methods are supported. For all other metering dimensions, only active reporting by the service provider is supported.
Service provider data reporting
Service providers report usage data by integrating the reporting API into their applications and making API calls. The procedure is as follows.
Obtain the region ID of the ECS instance where your application is deployed.
Access the following URL to get the region ID. Make a note of this ID for a later step.
http://100.100.100.200/latest/meta-data/region-idExample response:
curl http://100.100.100.200/latest/meta-data/region-id cn-wulanchabuMake the reporting API call.
The call parameters follow the same format as the Alibaba Cloud Marketplace API, but you do not need to specify the
InstanceIdparameter.The format for the
PushMeteringDatacall is as follows:curl -H "Content-Type: application/json" -XPOST https://<regionId>.axt.aliyun.com/computeNest/marketplace/push_metering_data -d '{"Metering":"[{\"StartTime\":\"100000000\",\"EndTime\":\"100000010\",\"Entities\":[{\"Key\":\"Frequency\",\"Value\":\"96\"}]}]"}'Replace
<regionId>with the region ID that you obtained in Step 1 and make the API call.curl -H "Content-Type: application/json" -XPOST https://cn-wulanchabu.axt.aliyun.com/computeNest/marketplace/push_metering_data -d '{"Metering":"[{\"StartTime\":\"1664451045\",\"EndTime\":\"1664451198\",\"Entities\":[{\"Key\":\"Frequency\",\"Value\":\"6\"}]}]"}'Responses
Successful response
curl -H "Content-Type: application/json" -XPOST https://cn-wulanchabu.axt.aliyun.com/computeNest/marketplace/push_metering_data {"Code":"200","RequestId":"e6862d3a-9385-4289-8dd3-9c52a6802280","StartTime":"1664451045","EndTime":"1664451228","instanceId":"0-ij1d5hy53xfy81nwu16cZ","Entities":[{"Key":"Frequency","Value":"6"}]} {"Code":"200","RequestId":"0E070CDCA-16F9-113E-AD14-4B618ECD6F68","result":{"1":"0j1d5hy53xfy81nwu16cZ"},"PushMeteringDataRequestId":"1106d44C-E003-5169-79137007CB5","Token":"05130a063e6ac1883280d2316989894d*","Success":true}Failed responses
Data reporting is not supported for the current service instance because it is not a pay-as-you-go instance.
curl -H "Content-Type: application/json" -XPOST https://cn-wulanchabu.axt.aliyun.com/computeNest/marketplace/push_metering_data -d '{"Metering":"{\"StartTime\":\"V6644531237\",\"EndTime\":\"V6644531237\",\"Entities\":[{\"Key\":\"KeyDomain\",\"Value\":\"1\"}]}"}' {"Code":"400","RequestId":"1f9b0b19-596b7192-3906-41e8-80b0e-b7e0b6ca3fcf3","InstanceId":"si-4j|1564mproo9nomixntiZ","errCode":"NotSupportPushMeteringData","errMsg":"NotSupportPushMeteringData : The ServiceInstance si-4d0009e39c394379b2ee does not supported push metering data.\r\nRequestId: 93C64F0A-222F-1E99-9785-88ACB5022D74\r\n"}The current metering dimension is reported by Compute Nest, so the service provider cannot report data for it.
curl -H "Content-Type: application/json" -XPOST https://cn-wulanchabu.axt.aliyun.com/computeNest/marketplace/push_metering_data \ -d '{"Metering":"[{\"StartTime\":\"1664451123\",\"EndTime\":\"1664451198\",\"Entities\":[{\"Key\":\"Period\",\"Value\":\"xxx\"}]}]"}'Example error response:
{"code":400,"requestId":"bcbd7604-1f0a-4569-b244-b6bf6def4ca2","instanceId":"i-0xxx","errCode":"NotSupportPushMeteringData","errMsg":"NotSupportPushMeteringData : Not support push metering data entity \"Period\"."}The specified metering dimension is invalid. If the
Keyvalue of Entities in the request body is invalid, such asPeriodMin123, the API returns theInvalid.Parameter.Meteringerror.curl -H "Content-Type: application/json" -XPOST https://cn-wulanchabu.xxx.aliyun.com/computeNest/marketplace/push_metering_data \ -d '{"Metering":"[{\"StartTime\":\"1664451123\",\"EndTime\":\"1664451198\",\"Entities\":[{\"Key\":\"PeriodMin123\",\"Value\":\"1\"}]}]"}' {"code":400,"requestId":"a3bc4111-5df7-46ea-937d-f8fc14316535","instanceId":"i-0jxxx","errCode":"Invalid.Parameter.Metering","errMsg":"Invalid.Parameter.Metering : The specified Metering parameter is invalid.\r\nRequestId : 2E6299F7-B3B3-1572-B6F2-11AED28499B6"}
Automatic reporting by Compute Nest
Compute Nest collects and reports usage data for the defined metering dimensions every hour on the hour. Currently, this method supports only the Period, PeriodMin, VirtualCpu, and Storage dimensions.
Compute Nest reports data as long as the service instance exists, regardless of the ECS instance's status. The measurement units for each dimension are consistent with those on Alibaba Cloud Marketplace.
The following table describes the metering dimensions that Compute Nest supports for automatic reporting.
Parameter | Description |
Period | Usage duration, measured in hours. For the first report after a service instance is created, Compute Nest calculates the time elapsed since the instance was created. If the duration is less than 0.5 hours, Compute Nest reports 0 hours, and no fee is charged. If the duration is 0.5 hours or more, Compute Nest reports 1 hour. When the service instance is deleted, Compute Nest submits a final report using the same rounding logic before the resources are deleted. |
PeriodMin | Usage duration, measured in minutes. For the first report after a service instance is created, Compute Nest calculates the time elapsed since the instance was created. The value is rounded to the nearest minute. For example, if the calculated duration is 35.3 minutes, Compute Nest reports 35 minutes. If the duration is 35.7 minutes, it reports 36 minutes. When the service instance is deleted, Compute Nest submits a final report using the same rounding logic before the resources are deleted. |
VirtualCpu | Number of vCPU cores, measured in core-hours. At the time of reporting, Compute Nest calculates and reports the total number of vCPU cores. For example, if a service instance has 10 ECS instances with a total of 48 vCPU cores, the reported quantity is 48 core-hours. The reported value is a snapshot of the vCPU count at the time of reporting, regardless of past fluctuations. When the service instance is deleted, Compute Nest submits a final report based on the final vCPU count. |
Storage | Used storage space, measured in bytes. At the time of reporting, Compute Nest calculates the total storage space and reports this value. For example, if a service instance has 10 ECS instances with a total storage space of 200 GB, the reported quantity is the equivalent value in bytes (214,748,364,800). The reported value is a snapshot of the storage space at the time of reporting, regardless of past fluctuations. When the service instance is deleted, Compute Nest submits a final report based on the final storage space. |
Modify the reporting method
Compute Nest automatically reports usage for the Period, PeriodMin, VirtualCpu, and Storage dimensions every hour. By default, the reporting method for these four dimensions is set to automatic reporting by Compute Nest. If you prefer to report usage data yourself (active reporting), you can change the reporting method in the Compute Nest console. The procedure is as follows.
Log on to the Compute Nest console.
In the left-side navigation pane, choose . On the My Services page, select the My Published Services tab and click Create Service.
NoteIf the current version of your service has not been published, you can edit the pay-as-you-go reporting method only if a previous version of the service is already published on Alibaba Cloud Marketplace.
Click the name of the service to open its service details page.
Click Modify Report Mode.
In the Modify Report Mode dialog box, modify the reporting method.
NoteAn error occurs if a service provider attempts to report data for a dimension already configured for automatic reporting by Compute Nest.
In the Edit Pay-As-You-Go Reporting Method dialog box, you can select the reporting method for each metering dimension, such as
PeriodMin,Period,VirtualCpu,NetworkIn,Character, andNetworkOut. Choose either Service Provider or Compute Nest for each dimension.Click OK to confirm your selections.