Help Center/ Application Performance Management/ API Reference(2.0)/ APIs/ TOPOLOGY/ Querying the Topology of a Component Environment
Updated on 2023-08-02 GMT+08:00

Querying the Topology of a Component Environment

Function

This API is used to query the topology of a component environment.

URI

POST /v1/apm2/openapi/topology/env-search

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token obtained from IAM.

x-business-id

Yes

Long

Application ID.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

target_env_id

Yes

Long

Environment ID.

direction

No

String

Direction, which can be left empty.

end_time

Yes

String

End time.

start_time

Yes

String

Start time.

filter_user

No

Boolean

Filter or not.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

node_list

Array of TopoNode objects

List of component nodes.

line_list

Array of TopoLine objects

List of lines that indicate invocations between components.

collector_config

Map<String,CollectorConfigModel>

Collector configuration.

real_start_time

Long

Start time.

real_end_time

Long

End time.

Table 4 TopoNode

Parameter

Type

Description

node_type

String

Node type.

node_name

String

Node name.

node_id

String

Node ID.

env_id

Long

Environment ID.

Table 5 TopoLine

Parameter

Type

Description

from_node

String

Start node.

to_node

String

End node.

direction

String

Invocation direction.

collector

String

Collector name.

target_env_id

Long

Environment ID.

hints

Map<String,String>

Line prompt.

filter_value

String

Filtered value.

Table 6 CollectorConfigModel

Parameter

Type

Description

line_view_config

LineViewConfigModel object

Invocation line view configuration.

detail_view_config

DetailViewConfigModel object

Details view configuration.

Table 7 LineViewConfigModel

Parameter

Type

Description

metric_set

String

Name of the metric set corresponding to the view.

filter_prefix

String

Filtering parameter.

line_view_item_list

Array of LineViewItem objects

View function set.

Table 8 LineViewItem

Parameter

Type

Description

function

String

Expression.

as

String

As.

Table 9 DetailViewConfigModel

Parameter

Type

Description

metric_set

String

Name of the metric set corresponding to the view.

filter_prefix

String

Filtering parameter.

detail_view_item_list

Array of DetailViewItem objects

View function set.

Table 10 DetailViewItem

Parameter

Type

Description

function

String

Expression.

as

String

As.

Example Requests

Query the global topology of environment 4394, with the start timestamp set to 1667465258000 and end timestamp set to 1667466458000.

/v1/apm2/openapi/topology/env-search

{
  "direction" : "",
  "end_time" : 1667466458000,
  "start_time" : 1667465258000,
  "filter_user" : false,
  "target_env_id" : 4394
}

Example Responses

Status code: 200

OK: The request is successful.

{
  "node_list" : [ {
    "node_type" : "Env",
    "node_name" : "apm-archive:xx-xxx-xxx",
    "node_id" : "4394",
    "env_id" : 4394
  }, {
    "node_type" : "Kafka",
    "node_name" : "Kafka",
    "node_id" : "Kafka",
    "env_id" : null
  }, {
    "node_type" : "Env",
    "node_name" : "config-web:xx-xxx-204",
    "node_id" : "1927",
    "env_id" : 1927
  }, {
    "node_type" : "Env",
    "node_name" : "config-web:xx-xxx-xxx",
    "node_id" : "51",
    "env_id" : 51
  }, {
    "node_type" : "Env",
    "node_name" : "user",
    "node_id" : "user",
    "env_id" : null
  } ],
  "line_list" : [ {
    "from_node" : "user",
    "to_node" : "4394",
    "direction" : "in",
    "collector" : "Url",
    "target_env_id" : 4394,
    "hints" : {
      "rt" : "0.09",
      "count" : "680",
      "error" : "0"
    },
    "filter_value" : "user"
  }, {
    "from_node" : "4394",
    "to_node" : "51",
    "direction" : "out",
    "collector" : "HttpClient",
    "target_env_id" : 4394,
    "hints" : {
      "rt" : "33.27",
      "count" : "668",
      "error" : "0"
    },
    "filter_value" : "51"
  }, {
    "from_node" : "Kafka",
    "to_node" : "4394",
    "direction" : "in",
    "collector" : "KafkaConsumer",
    "target_env_id" : 4394,
    "hints" : {
      "bytes" : "-1448635860",
      "count" : "4163226"
    },
    "filter_value" : "Kafka"
  }, {
    "from_node" : "4394",
    "to_node" : "Kafka",
    "direction" : "out",
    "collector" : "KafkaProducer",
    "target_env_id" : 4394,
    "hints" : {
      "bytes" : "0",
      "count" : "0"
    },
    "filter_value" : "Kafka"
  }, {
    "from_node" : "4394",
    "to_node" : "1927",
    "direction" : "out",
    "collector" : "HttpClient",
    "target_env_id" : 4394,
    "hints" : {
      "rt" : "41.64",
      "count" : "170",
      "error" : "0"
    },
    "filter_value" : "1927"
  } ],
  "collector_config" : {
    "KafkaProducer" : {
      "line_view_config" : {
        "metric_set" : "total",
        "filter_prefix" : null,
        "line_view_item_list" : [ {
          "function" : "SUM(recordSendTotal)",
          "as" : "count"
        }, {
          "function" : "SUM(byteTotal)",
          "as" : "bytes"
        } ]
      },
      "detail_view_config" : {
        "metric_set" : "topic",
        "group_by" : "topic",
        "detail_view_item_list" : [ {
          "function" : "SUM(recordSendTotal)",
          "as" : "count"
        }, {
          "function" : "SUM(byteTotal)",
          "as" : "bytes"
        } ]
      }
    },
    "HttpClient" : {
      "line_view_config" : {
        "metric_set" : "hostInvocation",
        "filter_prefix" : "envId=",
        "line_view_item_list" : [ {
          "function" : "SUM(invokeCount)",
          "as" : "count"
        }, {
          "function" : "SUM(totalTime)/SUM(invokeCount)",
          "as" : "rt"
        }, {
          "function" : "SUM(errorCount)",
          "as" : "errorCount"
        } ]
      },
      "detail_view_config" : null
    },
    "KafkaConsumer" : {
      "line_view_config" : {
        "metric_set" : "total",
        "filter_prefix" : null,
        "line_view_item_list" : [ {
          "function" : "SUM(recordConsumedTotal)",
          "as" : "count"
        }, {
          "function" : "SUM(bytesConsumedTotal)",
          "as" : "bytes"
        } ]
      },
      "detail_view_config" : {
        "metric_set" : "topic",
        "group_by" : "topic",
        "detail_view_item_list" : [ {
          "function" : "SUM(recordConsumedTotal)",
          "as" : "count"
        }, {
          "function" : "SUM(bytesConsumedTotal)",
          "as" : "bytes"
        } ]
      }
    },
    "Url" : {
      "line_view_config" : {
        "metric_set" : "user",
        "filter_prefix" : "clusterId=",
        "line_view_item_list" : [ {
          "function" : "SUM(invokeCount)",
          "as" : "count"
        }, {
          "function" : "SUM(totalTime)/SUM(invokeCount)",
          "as" : "rt"
        }, {
          "function" : "SUM(errorCount)",
          "as" : "errorCount"
        } ]
      },
      "detail_view_config" : null
    }
  },
  "real_start_time" : 1667465258000,
  "real_end_time" : 1667466458000
}

Status Codes

Status Code

Description

200

OK: The request is successful.

401

Unauthorized: No permissions.

403

Forbidden: Access forbidden.

404

Not Found: The requested resource is not found.

Error Codes

See Error Codes.