Topology Map Data Structure Description¶
Field Description
| Parameter | Type | Required | Description |
|---|---|---|---|
| column_names | list | Collection of column names corresponding to values; for external function data sources, this is automatically populated based on series data |
|
| column_names[#] | str | ||
| series | list | Required | Data groups; the length indicates the number of data groups (only one group for topology maps) |
| series[#] | dict | A data group | |
| series[#].tags | dict | Data attributes (used for displaying related attribute information; in tables, displayed as column data, with alias key mappings) | |
| series[#].columns | list | Required | List of data source field keys, fixed to ['time', 'data'] |
| series[#].values | list | Required | Two-dimensional array, each item represents one data record; only one record here |
| series[#].values[#] | list | Composed of [timestamp, data value], 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'; a serialized object, supports types ServiceMap and ResourceMap |
ServiceMap (Service Relationship Map)¶
The topology map is displayed as circular nodes. The node name serves as the unique identifier, used to display 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 | List of node details |
| 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 list |
| services[#].data | dict | Node attributes | |
| services[#].data.__size | number | Value for the circle size field; no range limitation, displayed adaptively based on the set size | |
| services[#].data.__fill | number | Required | Value for the fill color field; the value must be within the min and max of the configured gradient color scheme |
| services[#].data.fieldA | string/number | Required | Content displayed on node hover; all fields except __size and __fill are treated as custom fields and displayed |
| maps | list | Required | List of node connection relationships |
| 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 map is displayed as card nodes. The connection relationship must have exactly one center node. serviceResource is the list of card node details (service:resource must be unique as the unique identifier for the card node). maps contains the connection relationships between the center node and other nodes. Nodes pointed to by the center node are placed to the right of the center node; nodes pointing to the center node are placed to the 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 | List of card node details |
| 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 the node icon display (supported types: 'web', 'custom', 'cache', 'db', 'app', 'front', 'message'); defaults to 'custom' if not in the list |
| serviceResource[#].data | dict | Resource data parameters under the service | |
| serviceResource[#].data.avg_per_second | number | Value displayed on the left in the 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 in the 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 right middle area | |
| maps | list | Required | List of card node connection relationships |
| maps[#] | dict | Card node connection relationship (direction source_resource->target_resource) | |
| maps[#].source | string | Required | Same as serviceResource[#].service |
| 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 |
External Function Response Structure Example¶
@DFF.API('function_name', category='dataPlatform.dataQueryFunc')
def whytest_topology_test():
now = int(time.time()) * 1000
# The `data` here is the complete structure of "ServiceMap (Service Relationship Map)" or "ResourceMap (Resource Relationship Map)" described above
data = {}
return {
"content": [
{
"series": [
{
"columns": ["time", "data"],
"values": [
now, json.dumps(data)
],
"total_hits": 1
}
]
}
]
}