List¶
GET /api/v1/aggs_to_metric/list
Overview¶
Lists, with pagination, the Generate Metrics rules, output definitions, schedules, and enabled/disabled statuses in the current workspace.
Before Calling and Usage Steps¶
First select the data category by scriptType, then search by metric/metricField and read page by page. The query returns only records with type=aggs and status!=3, includes disabled rules, and sorts by record id in descending order. RUM application information is attempted to be added to extend.sourceInfo only when scriptType=rumToMetric is explicitly specified; if no type is provided, querying all records does not automatically fill it in for every RUM record.
The configurations in the list are rule snapshots, not execution status or Generate Metrics results; for subsequent modifications, construct a complete Body according to the fields written by this API.
Request Headers¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential for the workspace. Example: <DF-API-KEY>How to obtain or fill in: Obtain an OpenAPI Key with the required operation permissions from API Key Management in the target workspace. |
Query Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| search | string | Optional; after trimming leading and trailing whitespace, performs contains matching by measurement name/metric name and does not search rule UUID or extend. Null allowed: False Empty string allowed: True Example: nginx_requestsHow to obtain or fill in: Take a keyword from the output metric or metricField. |
|
| scriptType | string | Optional type filter; the current Query enum does not include objectToMetric/customObjectToMetric. Historical records of these types can be seen in an unfiltered list; do not assume they can currently be created based on this. Null allowed: False Allowed values: ['rumToMetric', 'apmToMetric', 'logToMetric', 'securityToMetric', 'metricToMetric', 'dialingToMetric'] Example: logToMetricHow to obtain or fill in: Select from the six public jsonScript.type values; omit to query all aggs. |
|
| pageIndex | integer | Optional, default 1, minimum 1. Null allowed: False $minValue: 1 Example: 1How to obtain or fill in: Start from 1 and advance according to the top-level pageInfo. |
|
| pageSize | integer | Optional, default 100, maximum 100. Null allowed: False $minValue: 1 $maxValue: 100 Example: 100How to obtain or fill in: Select 1 to 100 per page. |
Request Example¶
curl --get 'https://openapi.guance.com/api/v1/aggs_to_metric/list' \
-H 'DF-API-KEY: <DF-API-KEY>' \
--data-urlencode scriptType=logToMetric \
--data-urlencode pageIndex=1 \
--data-urlencode pageSize=100
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content.data | array<object> |
Array of rules on this page; [] for empty results. |
| content.data[].id | integer | Database ID of the saved Generate Metrics rule; use uuid in subsequent calls. |
| content.data[].uuid | string | rul_ rule UUID. |
| content.data[].workspaceUUID | string | Owning workspace. |
| content.data[].monitorUUID | string | UUID of the associated Monitor; usually an empty string in this module. |
| content.data[].type | string | Entity type, fixed to aggs; distinct from jsonScript.type. |
| content.data[].refKey | string | Association key, usually empty. |
| content.data[].secret | string | Compatibility entity field; usually empty for ordinary Generate Metrics rules; do not use it as a calling credential or record the actual value. |
| content.data[].createdWay | string | manual/import/template or a historical empty value. |
| content.data[].isLocked | integer or boolean | Lock flag, usually 0/false. |
| content.data[].openPermissionSet | boolean | Custom operation permission switch; usually false when created by this module. |
| content.data[].permissionSet | array<string> |
Array of custom operation principals, usually []. |
| content.data[].permissionSet[] | string | Identifier of a single account/team/role. |
| content.data[].status | integer | 0 enabled, 2 disabled, 3 deleted; the status is not the same as whether the most recent task execution succeeded. |
| content.data[].creator | string | Creator identity. |
| content.data[].updator | string | Identity of the most recent update; may be empty initially. |
| content.data[].createAt | integer | Creation Unix seconds. |
| content.data[].updateAt | integer | Update Unix seconds; -1 if not updated. |
| content.data[].deleteAt | integer | Deletion Unix seconds; -1 if not deleted. |
| content.data[].crontabInfo | object | Schedule configuration summary, not a task execution result. |
| content.data[].crontabInfo.id | string | Schedule configuration identifier for system maintenance; use uuid to operate on the rule. |
| content.data[].crontabInfo.crontab | string | Actual six-segment schedule expression, e.g. 0 */5 * * * *; request frequency still uses metricInfo.every. |
| content.data[].jsonScript | object | Saved configuration: required rule object; modifications replace the entire object and do not merge fields. Submit only the subfields listed on this page; do not send back all entities returned by the details response. |
| content.data[].jsonScript.type | string | Data category identifier currently saved; historical objects may retain old values; list/details do not re-enforce the category restrictions from creation time. |
| content.data[].jsonScript.query | json | Currently saved query definition, not the result of this query execution. |
| content.data[].jsonScript.query.q | string | Currently saved query statement. |
| content.data[].jsonScript.query.qtype | string | Currently saved query syntax type, such as dql or promql. |
| content.data[].jsonScript.query.qmode | string | Currently saved edit mode, such as selectorQuery or customQuery. |
| content.data[].jsonScript.metricInfo | json | Currently saved output metric and schedule configuration. |
| content.data[].jsonScript.metricInfo.every | string | Currently saved generation frequency, also used for the query window length. |
| content.data[].jsonScript.metricInfo.metric | string | Target measurement name for the Generate Metrics output. |
| content.data[].jsonScript.metricInfo.metricField | string | Target field name for the Generate Metrics output. |
| content.data[].jsonScript.metricInfo.unit | string | Currently displayed unit; does not automatically perform numeric conversion on query results. |
| content.data[].jsonScript.metricInfo.desc | string | Description of the target metric field. |
| content.data[].jsonScript.metricInfo.delaySeconds | integer | Number of seconds to wait after scheduled triggering; does not change the query window corresponding to every. |
| content.data[].extend | object | Saved configuration: required echo object; modifications replace the entire object. All echo options do not replace jsonScript.query; if no echo is needed in handwritten mode, {} can be provided. |
| content.data[].extend.funcName | string | Saved configuration: conditionally required aggregate function name when using selectorQuery. count for counts, count_distinct for distinct counts; numeric aggregate functions require an actual numeric field; distribution echoes the corresponding histogram_auto in q. |
| content.data[].extend.fieldKey | string | Saved configuration: conditionally required echo aggregate field when using selectorQuery. When adding, the source field type is queried to check compatibility with numeric functions, but unknown fields are not guaranteed to be rejected; modification does not repeat the same field type check. |
| content.data[].extend.source | string | Saved configuration: optional source echo; all available are indicated by *, and the actual scope is still limited by q. When querying the RUM list, sourceInfo can be appended based on this value. |
| content.data[].extend.index | string | Saved configuration: optional Log Index echo; changing it does not automatically change the L index in q. |
| content.data[].extend.groupBy | array | Saved configuration: optional grouping echo array; if omitted, this echo field is absent; an empty array means no grouping. Actual grouping is determined by q. |
| content.data[].extend.groupBy[] | string | Saved configuration: a single grouping key. |
| content.data[].extend.filterString | string | Saved configuration: optional log filter echo string; it is not an automatic concatenation entry point for q; actual filtering must be written into q. |
| content.data[].extend.filters | array | Saved configuration: optional array; uses the plural values, unlike value in other APIs. Actual execution filtering is determined by q. |
| content.data[].extend.filters[] | json | Saved configuration: filter echo object; can recursively retain the format already present on the client; the current echo structure is not converted into an execution query. |
| content.data[].extend.filters[].name | string | Saved configuration: echo field. |
| content.data[].extend.filters[].condition | string | Saved configuration: relationship with the previous echo condition. |
| content.data[].extend.filters[].op | string | Saved configuration: echo operator; query condition conversion is not performed in this API. |
| content.data[].extend.filters[].values | array | Saved configuration: echo value array; actual comparison and value retrieval must be reflected in q. |
| content.data[].extend.filters[].values[] | JSON | Saved configuration: a single string, numeric, or boolean value. |
| content.data[].creatorInfo | object | Associated identity summary; {} when no identity matches. |
| content.data[].creatorInfo.uuid | string | Identity UUID; may be omitted. |
| content.data[].creatorInfo.status | integer | Account status; may be omitted. |
| content.data[].creatorInfo.wsAccountStatus | integer | Workspace membership status; may be omitted. |
| content.data[].creatorInfo.name | string | Display name. |
| content.data[].creatorInfo.username | string | Login name. |
| content.data[].creatorInfo.email | string | Email or system identity identifier. |
| content.data[].creatorInfo.mobile | string | Mobile phone number; may be empty. |
| content.data[].creatorInfo.countryCode | string | Country/region code; may be omitted. |
| content.data[].creatorInfo.iconUrl | string | Avatar; may be omitted. |
| content.data[].creatorInfo.acntWsNickname | string | Workspace nickname; may be omitted. |
| content.data[].updatorInfo | object | Associated identity summary; {} when no identity matches. |
| content.data[].updatorInfo.uuid | string | Identity UUID; may be omitted. |
| content.data[].updatorInfo.status | integer | Account status; may be omitted. |
| content.data[].updatorInfo.wsAccountStatus | integer | Workspace membership status; may be omitted. |
| content.data[].updatorInfo.name | string | Display name. |
| content.data[].updatorInfo.username | string | Login name. |
| content.data[].updatorInfo.email | string | Email or system identity identifier. |
| content.data[].updatorInfo.mobile | string | Mobile phone number; may be empty. |
| content.data[].updatorInfo.countryCode | string | Country/region code; may be omitted. |
| content.data[].updatorInfo.iconUrl | string | Avatar; may be omitted. |
| content.data[].updatorInfo.acntWsNickname | string | Workspace nickname; may be omitted. |
| content.data[].extend.sourceInfo | object | Attempted to be added only when scriptType=rumToMetric is explicitly specified in the list; details/writes do not automatically provide it; the key is app_id of extend.source. |
| content.data[].extend.sourceInfo.应用ID | object | Information for that application; may be an empty object when there is no match or the query fails. |
| content.data[].extend.sourceInfo.应用ID.status | integer | Application entity status; may include inactive historical records. |
| content.data[].extend.sourceInfo.应用ID.jsonContent | object | Saved configuration JSON of the RUM application for display; varies by application type and should not be used as a writable parameter of this API. |
| content.data[].extend.sourceInfo.应用ID.jsonContent.配置键 | JSON | Configuration fields returned according to the RUM application type, such as name/type; this API does not guarantee a unified application structure. |
| content.declaration | object or null | Workspace common declaration attached to a non-empty business object; may be null or an empty object when not configured; an empty object is not added. |
| pageInfo.pageIndex | integer | Current page number. |
| pageInfo.pageSize | integer | Number of entries per page. |
| pageInfo.count | integer | Actual number of entries on this page. |
| pageInfo.totalCount | integer | Total number of entries after filtering. |
{
"code": 200,
"content": {
"data": [
{
"id": 101,
"uuid": "rul_aggs_example",
"workspaceUUID": "wksp_example",
"monitorUUID": "",
"type": "aggs",
"refKey": "",
"secret": "",
"jsonScript": {
"type": "logToMetric",
"query": {
"q": "L('default')::`nginx`:(count(`*`)) BY `host`",
"qtype": "dql",
"qmode": "selectorQuery"
},
"metricInfo": {
"every": "5m",
"metric": "recording_rules",
"metricField": "nginx_requests",
"unit": "custom/[\"custom\",\"次\"]",
"desc": "Count nginx requests by host.",
"delaySeconds": 60
}
},
"extend": {
"funcName": "count",
"fieldKey": "*",
"source": "nginx",
"index": "default",
"groupBy": [
"host"
],
"filters": [],
"filterString": ""
},
"crontabInfo": {
"id": "cron_example",
"crontab": "0 */5 * * * *"
},
"createdWay": "manual",
"isLocked": 0,
"openPermissionSet": false,
"permissionSet": [],
"status": 0,
"creator": "wsak_example",
"updator": "",
"createAt": 1785427200,
"updateAt": -1,
"deleteAt": -1,
"creatorInfo": {},
"updatorInfo": {}
}
],
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE",
"pageInfo": {
"pageIndex": 1,
"pageSize": 100,
"count": 1,
"totalCount": 1
}
}
Error Response¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling Method |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | Using an undeclared Query parameter or a parameter that violates rules | Parameter parsing failed | Check the Query parameter table and examples. |
| 500 | ft.InternalServerError | Rule reading or response formatting failed | Internal error | Check the workspace and UUID; if the failure persists, provide the traceId. |
| 403 | ft.Forbidden | The API Key has insufficient permissions or the workspace plan does not support this feature | You do not have permission to perform this operation | Use an API Key with the corresponding permissions and a workspace that supports Generate Metrics. |