Querying Resources by Time Segment
Function
This API is used to query resources by time segment.
URI
POST /v2/{project_id}/lts/timeline-traffic-statistics
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain a project ID, see Obtaining the Project ID, Account ID, Log Group ID, and Log Stream ID. Minimum: 32 Maximum: 32 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
timezone |
Yes |
String |
Time zone, for example, Asia/Shanghai, Europe/Paris, or Africa/Cairo. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token obtained from IAM. For details about how to obtain a user token, see Obtaining a User Token. Minimum: 1000 Maximum: 2000 |
Content-Type |
Yes |
String |
Set this parameter to application/json;charset=UTF-8. Minimum: 30 Maximum: 30 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
start_time |
Yes |
Long |
Start timestamp of the query, in milliseconds. A maximum of 30 days are supported. |
end_time |
Yes |
Long |
End timestamp, in milliseconds. |
period |
Yes |
Integer |
Query interval, in hours. The value ranges from 1 to 24. |
resource_type |
Yes |
String |
Resource type: The value is log_group / log_stream / tenant. |
search_type |
Yes |
String |
Type of traffic to be queried: write, index, or storage. |
resource_id |
No |
String |
Resource ID. When resource type is set to log_group, resource_id indicates the log group ID. When resource type is set to log_stream, resource_id indicates the log stream ID. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
results |
Array of Resulits objects |
Response result. |
Parameter |
Type |
Description |
---|---|---|
timestamp |
Long |
Timestamp, in milliseconds. |
value |
Double |
Traffic, in bytes. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
errorCode |
String |
Error code. |
errorMessage |
String |
Error message. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
errorCode |
String |
Error code. |
errorMessage |
String |
Error message. |
Example Requests
Querying Resources by Time Segment
POST v2/2a473356cca5487f8373be891bffc1cf/lts/timeline-traffic-statistics?timezone=XX/XX { "start_time" : 1668614400000, "end_time" : 1668787200000, "search_type" : "write", "period" : 1, "resource_type" : "tenant" }
Example Responses
Status code: 200
Query succeeded.
{ "results" : [ { "timestamp" : 1669046400000, "value" : 8.24859442E7 }, { "timestamp" : 1669071600000, "value" : 0 }, { "timestamp" : 1669161600000, "value" : 9.06895742E7 }, { "timestamp" : 1669215600000, "value" : 8.81524816E7 } ] }
Status code: 400
Invalid request. Modify the request based on the description in error_msg before a retry.
{ "errorCode" : "LTS.0009", "errorMessage" : "resource_id must not be empty" }
Status code: 500
The server has received the request but encountered an internal error.
{ "errorCode" : "LTS.0203", "errorMessage" : "Internal Server Error" }
Status Codes
Status Code |
Description |
---|---|
200 |
Query succeeded. |
400 |
Invalid request. Modify the request based on the description in error_msg before a retry. |
500 |
The server has received the request but encountered an internal error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot