Collecting Summary Statistics
Sample Code
You can use the API to collect summary statistics on users' jobs and prices. Sample code is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 | import com.huaweicloud.cs.java.v1.client.ApiException;
import com.huaweicloud.cs.java.v1.StatisticsApi;
StatisticsApi apiInstance = new StatisticsApi(apiClient);//apiClient is created when initializing a CS API client.
String xProjectId = "xProjectId_example"; // String | Project ID used for obtaining the token for the project.
try {
OverviewResponse result = apiInstance.overview(xProjectId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling StatisticsApi#overview");
System.err.println(e.getResponseBody());
e.printStackTrace();
}
|
Parameter Description
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| xProjectId | Yes | String | Project ID. This parameter is used to obtain the token for the project. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| messageId | No | String | Message type ID. |
| message | No | String | Message content. |
| currentTime | No | Long | Current time, expressed by milliseconds. |
| payload | No | OverviewEntity | For details about parameter types, see Table 3. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| totalCost | No | Double | Total price. |
| jobOverview | No | JobOverviewEntity | For details about parameter types, see Table 4. |
| clusterOverview | No | ClusterOverviewEntity | For details about parameter types, see Table 5. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| totalJobs | No | Integer | Total number of jobs. |
| runningJobsCount | No | Integer | Number of running jobs. |
| finishedJobCount | No | Integer | Number of completed jobs. |
| exceptionJobCount | No | Integer | Number of jobs experiencing exceptions. |
| otherJobCount | No | Integer | Number of jobs in other status. |
| runningJobCharge | No | Double | Total price charged for running jobs. |
| runningJobPrice | No | Double | Sum of prices per hour charged for all running jobs. |
| runningJobTotalSpu | No | Integer | Total number of SPUs consumed by running jobs. |
| runningJobTotalTime | No | Double | Total running duration of running jobs. |
| billingUnit | No | String | Settlement currency. Possible values are:
|
| timeUnit | No | String | Time unit. The value is HOUR. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| totalClusters | No | Integer | Total number of clusters. |
| runningClusterCount | No | Integer | Total number of running clusters. |
| exceptionClusterCount | No | Integer | Total number of completed clusters. |
| otherClusterCount | No | Integer | Total number of abnormal clusters. |
| runningClusterCharge | No | Double | Total price charged for running clusters. |
| runningClusterPrice | No | Double | Sum of prices per hour charged for all running clusters. |
| runningClusterTotalSpu | No | Integer | Total number of SPUs consumed by running clusters. |
| runningClusterTotalTime | No | Double | Total running duration of running clusters. |
| billingUnit | No | String | Settlement currency. Possible values are:
|
| timeUnit | No | String | Time unit. The value is HOUR. |
Last Article: Querying the APIG Address of a Job
Next Article: Running a Job
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.