Service Map 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 will be automatically populated based on series data |
|
column_names[#] | str | ||
series | list | Required | Data group, the length represents the number of data groups (here for the service map there is only one data group) |
series[#] | dict | A collection of data | |
series[#].tags | dict | Associated attributes of the data (used to display related data attributes, table displays them as column data, mapping of alias key values) | |
series[#].columns | list | Required | List of data source field keys, fixed to ['time', 'data'] |
series[#].values | list | Required | Two-dimensional array, each item in the array represents a 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 'time' column, can be null | |
series[#].values[#][1] | str | Value corresponding to the 'data' column, its value is a serialized object, supports types ServiceMap , ResourceMap |
ServiceMap - Service Relationship Diagram¶
The topology diagram is displayed in the form of circular nodes. The node name serves as the unique identifier, used to display node information and 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 to display the center Icon (supported types: 'web', 'custom', 'cache', 'db', 'app', 'front', 'aws_lambda'), defaults to 'custom' if not within range |
services[#].data | dict | Node attributes | |
services[#].data.__size | number | Value of the circle size field, the value has no range and adapts according to the set size | |
services[#].data.__fill | number | Required | Value of the fill color field, the value's range corresponds to the maximum and minimum values of the configured gradient color scheme |
services[#].data.fieldA | string/number | Required | Displayed when hovering over the node; apart from '__size' and '__fill' fields, all others are displayed as custom fields |
maps | list | Required | List of node connection relationships |
maps[#] | dict | Service connection relationship (direction: source->target) | |
maps[#].source | string | Required | Starting node |
maps[#].target | string | Required | Target node |
ResourceMap - Resource Relationship Diagram¶
The topology diagram is displayed in the form of card nodes. Connection relationships must meet the condition that there is exactly one central node. serviceResource
is the list of card node details (service:resource
should remain unique as the unique identifier of the card node), maps
defines the connections between the central node and other nodes. Nodes pointing from the central node are located on the right side of the central node, while nodes pointing to the central node are located on the left side.
{
"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 | Displayed content at the bottom of the card |
serviceResource[#].resource | string | Required | Displayed content at the top of the card |
serviceResource[#].source_type | string | Required | Resource type, used to display the node icon (supported types: 'web', 'custom', 'cache', 'db', 'app', 'front', 'message'), defaults to 'custom' if not within range |
serviceResource[#].data | dict | Data parameters under the service | |
serviceResource[#].data.avg_per_second | number | Displayed content on the left-center part | |
serviceResource[#].data.avg_per_second_title | number | Hover display content on the left-center part | |
serviceResource[#].data.error_rate | number | Displayed content on the right-center part | |
serviceResource[#].data.error_rate_title | number | Hover display content on the right-center part | |
serviceResource[#].data.p99 | number | Center-displayed content | |
serviceResource[#].data.p99_title | number | Hover display content on the right-center part | |
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 mentioned above for 'ServiceMap Service Relationship Diagram, ResourceMap Resource Relationship Diagram'
data = {}
return {
"content": [
{
"series": [
{
"columns": ["time", "data"],
"values": [
now, json.dumps(data)
],
"total_hits": 1
}
]
}
]
}