Topology Data Structure Description¶
Field Description
| Parameter | Type | Required | Description |
|---|---|---|---|
| column_names | list | Collection of column names corresponding to the values. For external function data sources, this value is automatically populated based on series data. |
|
| column_names[#] | str | ||
| series | list | Required | Data groups. The length indicates the number of data groups (the topology view only has one data group). |
| series[#] | dict | A single data group. | |
| series[#].tags | dict | Data-related attributes (used to display related attributes of the data; in the table, these are displayed as column data, mapping alias keys). | |
| series[#].columns | list | Required | List of data source field keys, fixed as ['time', 'data']. |
| series[#].values | list | Required | Two-dimensional array. Each item in the array represents one data record. Here there is only one data record. |
| series[#].values[#] | list | Composed of [timestamp, data value]. The length should match series[#].columns. |
|
| series[#].values[#][0] | str | Value corresponding to the column 'time'. Can be null. | |
| series[#].values[#][1] | str | Value corresponding to the column 'data'. Its value is a serialized object. Supported types: ServiceMap, ResourceMap. |
ServiceMap Service Relationship Map¶
The topology view displays nodes as circles. The node name is used as the unique identifier to show node information and node connection relationships.
{
"services": [
{
"data": {
"__size": 10,
"__fill": 10,
"fieldA": "1.0",
"fieldB": "test"
},
"name": "demo_web",
"type": "web"
},
{
"data": {
"__size": 10,
"__fill": 10,
"fieldA": "1.0",
"fieldB": "test"
},
"name": "demo_framework",
"type": "framework"
}
],
"maps": [
{
"source": "demo_web",
"target": "demo_framework"
}
]
}
Field Description
| Parameter | Type | Required | Description |
|---|---|---|---|
| services | list | Required | Node details list. |
| services[#] | dict | Node details. | |
| services[#].name | string | Required | Node name, displayed at the bottom of the node. |
| services[#].type | string | Required | Node type, used for the node center icon display. Supported types: 'web', 'custom', 'cache', 'db', 'app', 'front', 'aws_lambda'. Defaults to 'custom' if not in the range. |
| services[#].data | dict | Node attributes. | |
| services[#].data.__size | number | Value of the circle size field. The value has no range; it is displayed adaptively according to the set size. | |
| services[#].data.__fill | number | Required | Value of the fill color field. The range of this value is between the minimum and maximum of the configured gradient color scheme. |
| services[#].data.fieldA | string/number | Required | Content displayed on node hover. Fields other than __size and __fill are treated as custom fields and displayed. |
| maps | list | Required | Node connection relationship list. |
| maps[#] | dict | Service connection relationship (direction: source -> target). | |
| maps[#].source | string | Required | Source node. |
| maps[#].target | string | Required | Target node. |
ResourceMap Resource Relationship Map¶
The topology view displays nodes as cards. The connection relationship must satisfy that there is exactly one central node. serviceResource is the card node details list (service:resource must be unique; it serves as the unique identifier of the card node). maps defines the connection relationships between the central node and other nodes. Nodes pointed to by the central node are placed to its right, and nodes pointing to the central node are placed to its left.
{
"serviceResource": [
{
"data": {
"__fill": 10,
"avg_per_second_title": "AAA",
"avg_per_second": 1,
"p99_title": "AAA",
"p99": 1,
"error_rate_title": "AAA",
"error_rate": 1
},
"service": "demo_web",
"resource": "demo_web_resource",
"source_type": "web"
},
{
"data": {
"__fill": 10,
"avg_per_second_title": "AAA",
"avg_per_second": 1,
"p99_title": "AAA",
"p99": 1,
"error_rate_title": "AAA",
"error_rate": 1
},
"service": "demo_framework",
"resource": "demo_framework_resource",
"source_type": "framework"
}
],
"maps": [
{
"source": "demo_web",
"source_resource": "demo_web_resource",
"target": "demo_framework",
"target_resource": "demo_framework_resource"
}
]
}
Field Description
| Parameter | Type | Required | Description |
|---|---|---|---|
| serviceResource | list | Required | Card node details list. |
| serviceResource[#] | dict | Card details. | |
| serviceResource[#].service | string | Required | Text displayed at the bottom of the card. |
| serviceResource[#].resource | string | Required | Text displayed at the top of the card. |
| serviceResource[#].source_type | string | Required | Resource type, used for node icon display. Supported types: 'web', 'custom', 'cache', 'db', 'app', 'front', 'message'. Defaults to 'custom' if not in the range. |
| serviceResource[#].data | dict | Resource data parameters under the service. | |
| serviceResource[#].data.avg_per_second | number | Value displayed on the left-middle area. | |
| serviceResource[#].data.avg_per_second_title | number | Content displayed on hover for the left-middle area. | |
| serviceResource[#].data.error_rate | number | Value displayed on the right-middle area. | |
| serviceResource[#].data.error_rate_title | number | Content displayed on hover for the right-middle area. | |
| serviceResource[#].data.p99 | number | Value displayed in the middle area. | |
| serviceResource[#].data.p99_title | number | Content displayed on hover for the middle area. | |
| maps | list | Required | Card node connection relationship list. |
| maps[#] | dict | Card node connection relationship (direction: source_resource -> target_resource). | |
| maps[#].source | string | Required | Same as serviceResource[#].service name. |
| maps[#].source_resource | string | Required | Same as serviceResource[#].resource. |
| maps[#].target | string | Required | Same as serviceResource[#].service. |
| maps[#].target_resource | string | Required | Same as serviceResource[#].resource. |
Example of External Function Response Structure¶
@DFF.API('Function Name', category='dataPlatform.dataQueryFunc')
def whytest_topology_test():
now = int(time.time()) * 1000
# Here `data` is the complete structure of the "ServiceMap Service Relationship Map, ResourceMap Resource Relationship Map" described above.
data = {}
return {
"content": [
{
"series": [
{
"columns": ["time", "data"],
"values": [
now, json.dumps(data)
],
"total_hits": 1
}
]
}
]
}