Skip to content

service map



GET /api/v1/tracing/service_map_v2

Overview

Reads the service nodes, call edges, and statistics of a single workspace within a specified time window.

Before You Call and Usage Steps

Use an External signature with r or w permission, see External API Signature Authentication. workspaceUUID specifies one active workspace at a time; start/end use milliseconds, while the signature time uses the current second separately. For multiple workspaces, request them one by one with the same window and groupBy, merge on the client side, and preserve workspace identity. For a whole-workspace topology, omit centralService, search, and restrictive filters; a single-service upstream/downstream view cannot be exported as the whole workspace. Prefer groupBy; an empty or invalid groupBy also overrides the legacy boolean switches. When grouping by env/version, use the actual center dimensions to locate services with the same name; omitting a value and passing an explicit empty string mean different things. Read the services/maps JSON; there is no call-edge pagination or file download. Edge endpoints may have no corresponding returned node, so do not discard such edges; id + workspace + grouping determines the association, avoiding direct summation of request counts and averaging of P99 across duplicate edges. Only when both the HTTP and business statuses succeed and both arrays have a normal structure should [] be treated as an empty topology. Durations keep the original microsecond values; an error rate of 0.01 means 1%. Node and edge statistics cover different scopes and cannot be added together. For batch export, refer to Export Service Map via External API.

Request Headers

Parameter Type Required Description
X-Df-SVersion string Signature version for the original path and request body; do not omit it and keep using this page's algorithm.
Example: v20240417
How to obtain or fill in: The examples on this page use this fixed version, which pairs with the example signing algorithm.
X-Df-Access-Key string Y Read endpoints accept r or w credentials; write endpoints require w credentials.
Example: <external-access-key>
How to obtain or fill in: Assigned by the site administrator as the External API AK; a workspace OpenAPI Key cannot be used.
X-Df-Signature string Y HMAC-SHA256 over the uppercase method, nonce, original full path, timestamp, and raw UTF-8 request body joined by spaces, taking the hex digest.
Example: <hmac-sha256-hex>
How to obtain or fill in: Compute it with the matching SK per External API Signature Authentication; see the complete runnable template below.
X-Df-Timestamp string Y Must fall within the site-configured signature validity window; do not reuse the example time.
Example: 1785427200
How to obtain or fill in: At send time, use str(int(time.time())) to generate the current Unix second string.
X-Df-Nonce string Y Temporary serial number; when retrying after a failure, also generate a new value and recompute the signature.
Example: 97d275ee9f774315a7885ba7347acbd9
How to obtain or fill in: Regenerate uuid.uuid4().hex for every request.

Query Parameters

Parameter Type Required Description
filters.tags array Condition list in the form of a tags object; you can also use this array directly as the root of the filters JSON.
Example: [{"name": "service", "operation": "in", "value": ["checkout-api"], "condition": "and"}]
How to obtain or fill in: Build it from real APM tags and verified query conditions; this path represents the structure after the filters string is decoded.
filters.tags[*] json A leaf condition or a recursive group object containing filters.
Example: {"name": "service", "operation": "in", "value": ["checkout-api"], "condition": "and"}
How to obtain or fill in: Build it from real APM tags and verified query conditions; this path represents the structure after the filters string is decoded.
filters.tags[*].name string Leaf field name, taken from the actually collected tags; must be non-empty.
Example: service
How to obtain or fill in: Build it from real APM tags and verified query conditions; this path represents the structure after the filters string is decoded.
filters.tags[*].operation string Leaf operator; commonly =, !=, in, notin, =~, wildcard, exists, and so on, chosen according to downstream support. The compatible op is accepted; omitting both causes an internal error.
Example: in
How to obtain or fill in: Build it from real APM tags and verified query conditions; this path represents the structure after the filters string is decoded.
filters.tags[*].value array Array of leaf match values, filled in according to the actual field type; required, and an empty array is not treated as a wildcard.
Example: ["checkout-api"]
How to obtain or fill in: Build it from real APM tags and verified query conditions; this path represents the structure after the filters string is decoded.
filters.tags[*].condition string Logic with the previous item, and/or, default and; the compatible logic is accepted.
Example: and
How to obtain or fill in: Build it from real APM tags and verified query conditions; this path represents the structure after the filters string is decoded.
filters.tags[*].filters array Array of grouped sub-conditions with the same recursive structure as the outer level; non-empty groups are joined by condition.
Example: [{"name": "service", "operation": "in", "value": ["checkout-api"], "condition": "and"}]
How to obtain or fill in: Build it from real APM tags and verified query conditions; this path represents the structure after the filters string is decoded.
workspaceUUID string Y Required single workspace UUID; * or multiple comma-separated UUIDs are not supported. External on this site is a site-level credential, and the target workspace is not determined by a regular member OpenAPI Key.
Example: wksp_example001
How to obtain or fill in: Get the active workspace from Workspace List content.data[].uuid.
start integer Y Required start time as an integer in milliseconds, must be less than end; the signature timestamp uses the current Unix second separately.
Example: 1785427200000
How to obtain or fill in: Convert the start of the actual collected data window to Unix milliseconds, for example JavaScript Date.getTime().
end integer Y Required end time as an integer in milliseconds; the window should contain real trace collection data.
Example: 1785430800000
How to obtain or fill in: Use the end of the actual window on the same time basis, in Unix milliseconds.
search string Optional; after trimming leading and trailing whitespace, it is assembled into the service regex .*input.*. This is not a pure literal search, so regex special characters must be escaped as your use case requires; it is combined with filters.
Example: checkout
How to obtain or fill in: Take the actual name fragment from the service node name or data.service.
filters string Optional JSON string; either an object containing a tags array or an array of condition objects. Omit it to apply no filtering; [] means empty conditions. Do not pass only a fields object or {}, because the current normalization may still leave an object and not treat it as a condition array. operation/op and condition/logic are compatible. Invalid JSON or object structures may cause a 500; this is not the request JSON body.
Example: {"tags":[{"name":"service","operation":"in","value":["checkout-api"],"condition":"and"}]}
How to obtain or fill in: Choose real fields and values such as service, env, and version from the collected APM services/tags results; urlencode the whole JSON string.
isServiceSub boolean Compatibility boolean switch that takes effect only when there is no groupBy/group_by; default false.
Example: false
How to obtain or fill in: Use true when legacy integrations need services split by env+version.
serviceMapList boolean Legacy parameter that the current controller does not use; no additional paginated list or file is returned.
Example: false
How to obtain or fill in: Kept for legacy client compatibility; the new export logic reads services/maps directly.
showOnlyMatches boolean Default false; switch for match-only mode. It is forwarded independently of showFullChain, and when both are true the Full Chain semantics apply.
Example: false
How to obtain or fill in: Use true when you only need nodes matched by the search/filter.
showFullChain boolean Default false; switch for the full chain. It can coexist with showOnlyMatches, and the actual topology is implemented by the downstream version.
Example: false
How to obtain or fill in: Use true when you need the complete connected component that contains the matched nodes.
groupBy commaArray Recommended grouping fields as an English comma-separated string; any combination of project, cluster_name_k8s, env, and version, and service_sub expands to env+version. Field names are stripped of whitespace/backticks, lowercased, deduplicated, and returned in a fixed order; unknown values are ignored. As long as this key is present it takes precedence; an empty string or all-invalid values fall back to grouping by service only and override the legacy switches.
Example: project,env,version
How to obtain or fill in: Choose according to the collected tags that distinguish services with the same name.
group_by commaArray This synonym field is used only when groupBy is absent; an empty string also overrides the legacy switches. Do not pass both.
Example: env,version
How to obtain or fill in: Legacy client compatibility field; groupBy is recommended instead.
groupByProject boolean Adds the project dimension only when there is no groupBy/group_by; default false.
Example: false
How to obtain or fill in: Use true when legacy clients split nodes by project.
group_by_project boolean Used only when groupByProject is absent; it is not an additional independent dimension.
Example: false
How to obtain or fill in: Compatible with the legacy field name; prefer groupByProject.
groupByClusterNameK8s boolean Adds cluster_name_k8s only when there is no groupBy/group_by; default false.
Example: false
How to obtain or fill in: Use true when legacy clients need to split by K8s cluster name.
groupByClusterNameK8S boolean Used only when the lowercase-s version is absent; the two cannot be treated as different dimensions.
Example: false
How to obtain or fill in: Legacy case-variant synonym; prefer groupByClusterNameK8s.
group_by_cluster_name_k8s boolean Used only when both case variants above are absent.
Example: false
How to obtain or fill in: Compatible with the legacy field name; groupByClusterNameK8s is recommended.
centralService string Optional center service, with leading and trailing whitespace trimmed; omit for the whole workspace. When a valid groupBy exists, it is matched as a center object; when not grouped, its upstream and downstream are queried by service name.
Example: checkout-api
How to obtain or fill in: Take the real service name from content.services[].data.service/name; it is not the node id.
centralProject string Participates in center identity only when grouping is present and centralService is non-empty; omitting this key does not restrict this dimension, while an explicit empty/all-whitespace value matches services with no project set exactly.
Example: production
How to obtain or fill in: Take the value from the center node's project collection tag.
centralClusterNameK8s string Center identity dimension; omitted means it does not participate, and an explicit blank matches the unset value; requires grouping and a center service.
Example: production-k8s
How to obtain or fill in: Take the value from the center node's cluster_name_k8s.
centralWorkspaceUUID string Takes effect when grouping is present and centralService is non-empty; if omitted/blank, workspaceUUID is used. The public entry point queries a single workspace and does not treat it as a cross-workspace authorization parameter.
Example: wksp_example001
How to obtain or fill in: Take the center node's workspace_uuid.
centralEnv string Center environment dimension; omitted means no restriction, and an explicit blank matches the unset value; requires grouping and a center service.
Example: production
How to obtain or fill in: Take the value from the center node's data.env or the corresponding environment tag.
centralVersion string Center version dimension; omitted means no restriction, and an explicit blank matches the unset value; requires grouping and a center service.
Example: v1
How to obtain or fill in: Take the value from the center node's data.version or the corresponding version tag.

Additional Parameter Notes

Query and Authentication

workspaceUUID specifies one workspace at a time; using * or multiple UUIDs in place of a single workspace ID is not supported. start and end are millisecond timestamps; the signature header X-Df-Timestamp is the current second-level timestamp. Use an External API AK/SK signature, and call it with an account that has read permission; the workspace OpenAPI DF-API-KEY cannot be used instead. The signature version is X-Df-SVersion: v20240417, and the signature must be regenerated for each request based on the final path and query string.

When querying the whole workspace, do not pass centralService, search, or restrictive filters; the console's single-service upstream/downstream view cannot be used directly as the whole-workspace topology. For multiple workspaces, use the same time range and the same groupBy scope. This endpoint has no call-edge pagination or file download capability.

Response Fields

Field Description
content.services List of service nodes; node statistics are in data
content.maps List of directed call edges; source calls target
services[].workspace_uuid Workspace the node belongs to; must be preserved in the response
maps[].source_workspace_uuid / target_workspace_uuid Workspace each end of the call edge belongs to; nodes cannot be distinguished by service name alone
services[].id, maps[].source_id / target_id Association identifiers for nodes and edge endpoints; preserve workspace identity and grouping dimension when associating and deduplicating
maps[].total_count Number of requests for this call edge within the selected time range; it is not in the same statistical scope as the total request count of a service node
maps[].avg_per_second, error_count, error_rate Average requests per second, error count, and error rate; error_rate=0.01 means 1%
maps[].avg_resp_time, p50, p75, p90, p95, p99 Average duration and duration percentiles of the call edge; the response example keeps the original values

The response example below comes from a successful response in a test environment with two connected nodes and one call edge; the selected record fields and statistics are preserved, and the workspace, service, node ID, and traceId have been masked. Fields vary by version, service type, and grouping method; for example, only the first node in the example contains data.apdex. A missing field does not mean a zero value. Edge endpoints may not appear in services; in that case, keep the endpoint information in maps and do not discard the call edge. When both the HTTP and business statuses succeed and the structure is normal, empty services and maps mean there is no topology data in that time range; failures or missing structures cannot be treated as empty results. When aggregating multiple workspaces, keep the original JSON, the failed workspaces, and the traceId; the same call edge may appear multiple times, so do not directly sum the request counts of duplicate edges or average their P99.

Filters

filters example:

{
    "tags": [
        {
            "name": "__tags.__isError.keyword",
            "value": [
                "true"
            ],
            "operation": "=",
            "condition": "and"
        },
        {
            "condition": "and",
            "name": "__tags.__serviceName",
            "operation": "=~",
            "value": [
                ".*04.*"
            ]
        }
    ]
}

Request Example

import hashlib
import hmac
import json
import time
import uuid
from urllib.parse import urlencode
from urllib.request import Request, urlopen
from urllib.error import HTTPError, URLError

# Replace with the target site address and the External API AK/SK assigned by the administrator.
server = "https://external-api.guance.com"
access_key = "<external-access-key>"
secret_key = "<external-secret-key>"
method = 'GET'
path = '/api/v1/tracing/service_map_v2'
query = {'workspaceUUID': 'wksp_example001', 'start': 1785427200000, 'end': 1785430800000, 'groupBy': 'project,env,version'}
data = None
full_path = path + ("?" + urlencode(query) if query else "")
body = "" if data is None else json.dumps(data, ensure_ascii=False, separators=(",", ":"))
timestamp = str(int(time.time()))
nonce = uuid.uuid4().hex
string_to_sign = " ".join([method, nonce, full_path, timestamp, body])
signature = hmac.new(secret_key.encode("utf-8"), string_to_sign.encode("utf-8"), hashlib.sha256).hexdigest()
headers = {
    "X-Df-Access-Key": access_key,
    "X-Df-Timestamp": timestamp,
    "X-Df-Nonce": nonce,
    "X-Df-Signature": signature,
    "X-Df-SVersion": "v20240417",
}
if data is not None:
    headers["Content-Type"] = "application/json"
request = Request(server + full_path, data=None if data is None else body.encode("utf-8"), headers=headers, method=method)
try:
    with urlopen(request, timeout=30) as result:
        payload = json.loads(result.read().decode("utf-8"))
except HTTPError as error:
    print("HTTP", error.code, error.read().decode("utf-8"))  # Judge by errorCode, content, and traceId; do not output AK/SK.
    raise SystemExit(1)
except (URLError, TimeoutError):
    print('Read failed; you can back off, re-sign, and retry; keep the traceId and query conditions.')
    raise SystemExit(1)
print(json.dumps(payload, ensure_ascii=False, indent=2))

Response

HTTP 200, application/json standard External envelope; data is in content and is not automatically added to the OpenAPI declaration. The topology result contains services and maps and provides no pagination object; statistical fields vary with the actual downstream version and data.

Field Type Description
content object Topology JSON object; not paginated and no OpenAPI declaration is added automatically.
content.services array of objects Service nodes; [] when there is normally no data. It may not contain all edge endpoints.
content.maps array of objects Directed call edges; source calls target; [] when there is normally no data.
content.services[].id string Node identity; associate it together with the workspace and grouping dimensions, and do not deduplicate by service name alone.
content.services[].name string Node service name.
content.services[].alias string Optional display alias.
content.services[].type string Optional service type display value.
content.services[].workspace_uuid string UUID of the workspace the node belongs to.
content.services[].workspace_name string Workspace name filled in by Studio from the UUID; may be empty if it cannot be found.
content.services[].project string Grouping/collected project; may be empty or omitted.
content.services[].cluster_name_k8s string Grouping/collected K8s cluster name; may be empty or omitted.
content.services[].env string Optional environment grouping dimension.
content.services[].version string Optional version grouping dimension.
content.services[].filter_matched boolean Optional flag indicating whether the filter conditions were matched.
content.services[].data object Statistics and raw identity tags of this node; extended with the engine/grouping/service type, and not all keys are required to appear.
content.services[].data.key string Engine statistics grouping key.
content.services[].data.service string Real service name.
content.services[].data.workspace_uuid string Workspace the statistics belong to.
content.services[].data.source_type string Collection source type, for example web/db.
content.services[].data.language string Optional SDK language.
content.services[].data.project string Optional project.
content.services[].data.cluster_name_k8s string Optional cluster name.
content.services[].data.env string Optional environment.
content.services[].data.version string Optional version.
content.services[].data.total_count integer Total number of requests in the selected window.
content.services[].data.avg_per_second number Average requests per second, req/s.
content.services[].data.error_count integer Number of error requests.
content.services[].data.error_rate number Error rate; 0.01 means 1%.
content.services[].data.avg_resp_time number Average response duration, in microseconds.
content.services[].data.sum_resp_time number Cumulative response duration, in microseconds.
content.services[].data.max_duration number Longest response duration, in microseconds.
content.services[].data.apdex number Optional Apdex metric; missing does not mean 0.
content.services[].data.p50 number Duration percentile, in microseconds; do not directly average percentile values across workspaces/services.
content.services[].data.p75 number Duration percentile, in microseconds; do not directly average percentile values across workspaces/services.
content.services[].data.p90 number Duration percentile, in microseconds; do not directly average percentile values across workspaces/services.
content.services[].data.p95 number Duration percentile, in microseconds; do not directly average percentile values across workspaces/services.
content.services[].data.p99 number Duration percentile, in microseconds; do not directly average percentile values across workspaces/services.
content.maps[].source string Source service name.
content.maps[].source_id string Source node identity.
content.maps[].source_alias string Optional display alias.
content.maps[].source_workspace_uuid string UUID of the workspace the source belongs to; must be preserved when associating edges.
content.maps[].source_workspace_name string Workspace name filled in by Studio; empty if not found.
content.maps[].source_project string Optional project dimension.
content.maps[].source_cluster_name_k8s string Optional K8s cluster dimension.
content.maps[].source_env string Optional environment dimension.
content.maps[].source_version string Optional version dimension.
content.maps[].target string Target service name.
content.maps[].target_id string Target node identity.
content.maps[].target_alias string Optional display alias.
content.maps[].target_workspace_uuid string UUID of the workspace the target belongs to; must be preserved when associating edges.
content.maps[].target_workspace_name string Workspace name filled in by Studio; empty if not found.
content.maps[].target_project string Optional project dimension.
content.maps[].target_cluster_name_k8s string Optional K8s cluster dimension.
content.maps[].target_env string Optional environment dimension.
content.maps[].target_version string Optional version dimension.
content.maps[].total_count integer Total number of requests in the selected window.
content.maps[].avg_per_second number Average requests per second, req/s.
content.maps[].error_count integer Number of error requests.
content.maps[].error_rate number Error rate; 0.01 means 1%.
content.maps[].avg_resp_time number Average response duration, in microseconds.
content.maps[].sum_resp_time number Cumulative response duration, in microseconds.
content.maps[].p50 number Duration percentile, in microseconds; do not directly average percentile values across workspaces/services.
content.maps[].p75 number Duration percentile, in microseconds; do not directly average percentile values across workspaces/services.
content.maps[].p90 number Duration percentile, in microseconds; do not directly average percentile values across workspaces/services.
content.maps[].p95 number Duration percentile, in microseconds; do not directly average percentile values across workspaces/services.
content.maps[].p99 number Duration percentile, in microseconds; do not directly average percentile values across workspaces/services.
content.services[].other keys JSON value Node information extended by the downstream with version/grouping; interpret it according to the actual key, and do not fill missing fields with zeros.
content.maps[].other keys JSON value Edge information extended by the downstream; keep the original JSON for verification during cross-workspace export.
{
    "code": 200,
    "content": {
        "services": [
            {
                "alias": "demo-web",
                "cluster_name_k8s": "",
                "data": {
                    "apdex": 0.9994428969359331,
                    "avg_per_second": 0.7255555555555555,
                    "avg_resp_time": 104885.94027565084,
                    "cluster_name_k8s": "",
                    "env": "",
                    "error_count": 13,
                    "error_rate": 0.0049770290964777945,
                    "key": "demo-web",
                    "language": "",
                    "max_duration": 3819430,
                    "p50": 108049,
                    "p75": 134638,
                    "p90": 174617,
                    "p95": 245331,
                    "p99": 680374,
                    "project": "",
                    "service": "demo-web",
                    "source_type": "web",
                    "sum_resp_time": 273962076,
                    "total_count": 2612,
                    "version": "",
                    "workspace_uuid": "wksp_example_1"
                },
                "filter_matched": true,
                "id": "node_demo_web",
                "name": "demo-web",
                "project": "",
                "type": "web",
                "workspace_name": "示例空间",
                "workspace_uuid": "wksp_example_1"
            },
            {
                "alias": "demo-db",
                "cluster_name_k8s": "",
                "data": {
                    "avg_per_second": 3.873611111111111,
                    "avg_resp_time": 34123.73811401936,
                    "cluster_name_k8s": "",
                    "env": "",
                    "error_count": 3,
                    "error_rate": 0.00021513087128002868,
                    "key": "demo-db",
                    "language": "",
                    "max_duration": 5601590,
                    "p50": 1086,
                    "p75": 1686,
                    "p90": 18220,
                    "p95": 185415,
                    "p99": 591486,
                    "project": "",
                    "service": "demo-db",
                    "source_type": "db",
                    "sum_resp_time": 475855528,
                    "total_count": 13945,
                    "version": "",
                    "workspace_uuid": "wksp_example_1"
                },
                "filter_matched": true,
                "id": "node_demo_db",
                "name": "demo-db",
                "project": "",
                "type": "db",
                "workspace_name": "示例空间",
                "workspace_uuid": "wksp_example_1"
            }
        ],
        "maps": [
            {
                "avg_per_second": 0.0725,
                "avg_resp_time": 1134.478927203065,
                "error_count": 0,
                "error_rate": 0,
                "p50": 267.77212581584365,
                "p75": 1064.416823688738,
                "p90": 1901.1261103999313,
                "p95": 6064.699952926481,
                "p99": 10831.996616037464,
                "source": "demo-web",
                "source_alias": "demo-web",
                "source_cluster_name_k8s": "",
                "source_id": "node_demo_web",
                "source_project": "",
                "source_workspace_name": "示例空间",
                "source_workspace_uuid": "wksp_example_1",
                "sum_resp_time": 296099,
                "target": "demo-db",
                "target_alias": "demo-db",
                "target_cluster_name_k8s": "",
                "target_id": "node_demo_db",
                "target_project": "",
                "target_workspace_name": "示例空间",
                "target_workspace_uuid": "wksp_example_1",
                "total_count": 261
            }
        ]
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "TRACE-EXAMPLE"
}

Error Response

For authentication, rate limiting, and common request errors, see Common Error Definitions.

HTTP Status errorCode Trigger Condition Message or Response Description Handling
406 ft.ParameterValidationFailed A request field is missing, or a field value violates the declared validation conditions Parameter parsing failed Check the parameter location, field name, type, and value.
422 ft.KodoAPMSummaryRowBudgetExceeded The scan budget for service statistics aggregation is exceeded The APM service summary data volume exceeds the processing limit. Please narrow the time range and retry. Narrow the time window and narrow the data using the filter conditions supported on this page. This topology endpoint has no pageSize or call-edge pagination, so the scan budget of the whole service aggregation cannot be reduced through pagination.
429 ft.KodoServerOverloaded The query service is overloaded or busy The current request rate is too high. Please retry later. Retry with a backoff interval and reduce the number of concurrent queries.
406 ft.KodoRequestDeadlineExceeded Query execution exceeds the time allowed by the backend The data query timed out, possibly due to the following reasons: too much data, network latency, or excessive server load. You can resolve this problem in the following ways:
1. Add filter conditions or narrow the time range, then query again.
2. Wait a while and then try the query again.
Narrow the time range and add filter conditions, then retry.
406 ft.KodoTooManyRows The queried data volume exceeds the backend limit The queried data volume exceeds the maximum limit. Please add filter conditions or reduce the time range and query again. Narrow the time range or reduce the matched services, then retry.
406 ft.KodoInvalidRegexPattern The regex filter expression used is invalid The provided regular expression pattern is invalid Fix the regular expression, or use an explicit set of service names instead.
500 ft.InternalServerError The filters JSON/condition structure is invalid, the topology downstream timed out or returned an ordinary 5xx, or the returned node/edge identity fields are incomplete and cause a formatting exception Internal error Keep the traceId and the actual filters, narrow the window, and retry a limited number of times; do not treat failures or missing structures as an empty topology.

Feedback

Is this page helpful?