All Products
Search
Document Center

Application Real-Time Monitoring Service:QueryCommercialUsage

Last Updated:Sep 20, 2024

Queries the amount of data written to Application Monitoring, Managed Service for OpenTelemetry, Managed Service for Prometheus, and Real User Monitoring (RUM).

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
arms:QueryCommercialUsageget
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
IntervalInSecintegerYes

The time interval between data slices. Unit: seconds. Minimum value: 3600.

Valid values:

  • 3600: hours
  • 86400: days
3600
StartTimelongYes

The start of the time range to query. Unit: milliseconds.

1699200000000
EndTimelongYes

The end of the time range to query. Unit: milliseconds.

1699286400000
OrderBystringNo

The dimension by which data is sorted.

Valid value:

  • dataType

dataType
MetricstringYes

The name of the metric. Valid value: USAGEFEE.STAT.

USAGEFEE.STAT
OrderstringNo

The order in which data is sorted. Valid value:

  • ASC: ascending order
  • DESC: descending order
ASC
AdvancedFiltersarray<object>No

The filter conditions.

objectNo
KeystringNo

The key of the filter condition.

regionId
ValuestringNo

The value of the filter condition.

cn-hangzhou
OpTypestringNo

The operator. Valid values: eq and in.

eq
DimensionsarrayNo

The dimensions of the metric that you want to query. Valid values:

  • dataType: data type
  • productType: product type
  • instanceId: instance ID
  • instanceName: instance name
  • instanceType: instance type
stringNo

The dimension of the metric.

dataType
MeasuresarrayNo

The measures of the metric that you want to query.

stringNo

The measure of the metric. Valid value: byte_sum.

byte_sum
QueryTypestringYes

The data type. Valid values:

  • instantQuery: non-time series
  • timeSeriesQuery: time series
instantQuery

Response parameters

ParameterTypeDescriptionExample
object
Codestring

The response status. Valid values: 2XX: The request is successful. 3XX: A redirection message is returned. 4XX: The request is invalid. 5XX: A server error occurs.

200
Messagestring

The error message returned if the request failed.

success
RequestIdstring

The request ID.

99A663CB-8D7B-4B0D-A006-03C8EE38E7BB
Successboolean

Indicates whether the request was successful. Valid values:

  • true
  • false
true
Dataobject

The returned struct.

Completeboolean

Indicates whether a multi-region query is complete. Valid values:

  • true
  • false
true
Itemsarray<object>

The returned struct.

object

The queried data.

{ "date": "1697108400", "dataType": "metrics", "byte_sum": 9497922 }

Examples

Sample success responses

JSONformat

{
  "Code": "200",
  "HttpStatusCode": 0,
  "Message": "success",
  "RequestId": "99A663CB-8D7B-4B0D-A006-03C8EE38E7BB",
  "Success": true,
  "Data": {
    "Complete": true,
    "Items": [
      {
        "date": "1697108400",
        "dataType": "metrics",
        "byte_sum": 9497922
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400ParameterMetricIllegalThe specified metric is invalid.The specified metric is invalid.
400ParameterMeasuresIllegalThe specified Measures is invalid.The specified Measures is invalid.
400ParameterTimeStampIllegalThe specified timeStamp is invalid.The specified timeStamp is invalid.
400ParameterOrderIllegalThe specified order is invalid.The specified order is invalid.
400ParameterPageSizeIllegalThe specified PageSize is invalid.The specified PageSize is invalid.
400ParameterIntervalIllegalThe specified interval is invalid.The specified interval is invalid.
400ParameterMeasuresMissingYou must specify measures.You must specify measures.
400ParameterDimensionsIllegalThe specified dimensions is invalid.The specified dimensions is invalid.
400ParameterRegionIdIllegalThe specified RegionId is invalid.The specified RegionId is invalid.
400InternalErrorInternal error. Please try again. Contact the DingTalk service account if the issue persists after multiple retries.Internal error. Please try again. Contact the DingTalk service account if the issue persists after multiple retries.
403APINotAuthorizeThe current user is not authorized to access the interface.The current user is not authorized to access the interface.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-07-25The Error code has changed. The response structure of the API has changedView Change Details