Updated on 2025-02-13 GMT+08:00

Obtaining the Trend Graph

Function

This API is used to obtain the trend graph.

URI

POST /v1/apm2/openapi/view/metric/trend

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

x-business-id

Yes

Long

Application ID.

X-Auth-Token

Yes

String

User token obtained from IAM.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

view_config

No

TrendView object

View configuration information.

instance_id

No

Long

Instance ID.

monitor_item_id

No

Long

Monitoring item ID.

env_id

No

Long

Environment ID.

start_time

No

String

Start time.

end_time

No

String

End time.

Table 3 TrendView

Parameter

Mandatory

Type

Description

view_type

No

String

View type.

Enumeration values:

  • trend
  • sumtable
  • rawtable

collector_name

No

String

Collector name.

metric_set

No

String

Name of the metric set corresponding to the view.

title

No

String

Title to be displayed.

table_direction

No

String

Direction of the table heading. Options: H (default): horizontal. V: vertical.

Enumeration values:

  • H
  • V

group_by

No

String

Group.

filter

No

String

Filter list model.

field_item_list

No

Array of FieldItem objects

Field list models to be displayed.

span

No

Boolean

Span.

span_field

No

String

Attribute of the span field.

order_by

No

String

Sorting order.

latest

No

String

Whether to display only the latest data.

Table 4 FieldItem

Parameter

Mandatory

Type

Description

function

No

String

Expression.

as

No

String

As.

default_value

No

String

Default value.

trace

No

Boolean

Trace or not.

precision

No

Integer

Percentage.

unit

No

String

Unit.

visible

No

Boolean

Visible or not.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

line_list

Array of FrontLine objects

Trend graph data list.

latest_data_Time

Long

Last date and time.

Table 6 FrontLine

Parameter

Type

Description

point_list

Array of FrontPoint objects

Data point set.

title

String

Title.

unit

String

Unit.

precision

Integer

Percentage.

data_type

String

Date.

visible

Boolean

Visible or not.

Table 7 FrontPoint

Parameter

Type

Description

time

Long

Time.

value

Object

Value.

Example Requests

Obtain the trend graph. Input parameter view_type is set to trend.

/v1/apm2/openapi/view/metric/trend

{
  "end_time" : "2022-10-25 15:40:00",
  "env_id" : "11",
  "monitor_item_id" : 78,
  "start_time" : "2022-10-25 15:20:00",
  "view_config" : {
    "latest" : null,
    "span" : true,
    "collector_name" : "Url",
    "metric_set" : "url",
    "title" : "Calls",
    "table_direction" : null,
    "group_by" : "",
    "filter" : "url=/apm2/health/v1/health-check^method=GET",
    "field_item_list" : [ {
      "trace" : null,
      "function" : "SUM(invokeCount)",
      "as" : "Calls",
      "default_value" : null,
      "precision" : null,
      "unit" : null,
      "visible" : true
    } ],
    "span_field" : "source",
    "view_type" : "trend"
  }
}

Example Responses

None

Status Codes

Status Code

Description

200

OK: The request is successful.

400

Bad Request: Semantic or parameter error.

401

Unauthorized: No permissions.

403

Forbidden: Access forbidden.

404

Not Found: The requested resource is not found.

Error Codes

See Error Codes.