Get
Get¶
GET /api/v1/aggs_to_metric/{rule_uuid}/get
Overview¶
Read the complete saved configuration and creator/updater identity information of the specified Generate Metrics rule.
Before Calling and Usage Steps¶
Get this workspace's UUID from the Generate Metrics list, read the rule and the two identity summaries; this does not query execution results. The details do not automatically add sourceInfo as RUM-type filter lists do; if the historical extend already stores this field, it may still be returned.
These entry points share common rule processing, and some target queries do not additionally restrict type=aggs; use only the UUIDs returned by this module's list to avoid misreading or changing other rules.
Path Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| rule_uuid | string | Y | Path rule UUID, not a metric name, measurement name, or scheduling ID; do not pass the rul_ UUID of a regular Monitor.Example: rul_aggs_exampleHow to obtain or fill in: Obtain an aggs rule in this workspace only from content.data[].uuid in the Generate Metrics rule list. |
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 permission from API Key Management in the target Workspace. |
Request Example¶
curl --get 'https://openapi.guance.com/api/v1/aggs_to_metric/rul_aggs_example/get' \
-H 'DF-API-KEY: <DF-API-KEY>'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content.id | integer | Database ID of the saved Generate Metrics rule; use uuid in subsequent calls. |
| content.uuid | string | rul_ rule UUID. |
| content.workspaceUUID | string | Workspace it belongs to. |
| content.monitorUUID | string | Associated Monitor UUID; usually an empty string in this module. |
| content.type | string | Entity type, fixed to aggs, distinct from jsonScript.type. |
| content.refKey | string | Association key; usually empty. |
| content.secret | string | Compatibility entity field; usually empty for regular Generate Metrics rules. Do not use it as a call credential or record actual values. |
| content.createdWay | string | manual/import/template, or a historical empty value. |
| content.isLocked | integer or boolean | Lock flag; usually 0/false. |
| content.openPermissionSet | boolean | Custom operation permission switch; usually false when created in this module. |
| content.permissionSet | array<string> |
Array of custom operation subjects; usually []. |
| content.permissionSet[] | string | Single account/team/role identifier. |
| content.status | integer | 0 enabled, 2 disabled, 3 deleted; the status does not indicate that the most recent task execution succeeded. |
| content.creator | string | Creator identity. |
| content.updator | string | Most recent updater identity; can be empty initially. |
| content.createAt | integer | Creation Unix seconds. |
| content.updateAt | integer | Update Unix seconds; -1 if not updated. |
| content.deleteAt | integer | Deletion Unix seconds; -1 if not deleted. |
| content.crontabInfo | object | Scheduling configuration summary; not the task execution result. |
| content.crontabInfo.id | string | Scheduling configuration identifier for system maintenance; use uuid to operate on the rule. |
| content.crontabInfo.crontab | string | Actual six-field scheduling expression, for example 0 */5 * * * *; the request frequency still uses metricInfo.every. |
| content.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. |
| content.jsonScript.type | string | Data category identifier currently saved; historical objects may retain old values; lists/details do not re-apply the category restrictions enforced at creation time. |
| content.jsonScript.query | json | Currently saved query definition; not the execution result of this query. |
| content.jsonScript.query.q | string | Currently saved query statement. |
| content.jsonScript.query.qtype | string | Currently saved query syntax type, such as dql or promql. |
| content.jsonScript.query.qmode | string | Currently saved edit mode, such as selectorQuery or customQuery. |
| content.jsonScript.metricInfo | json | Currently saved output metric and scheduling configuration. |
| content.jsonScript.metricInfo.every | string | Currently saved generation frequency; also used as the query window length. |
| content.jsonScript.metricInfo.metric | string | Target measurement name of the generated metric. |
| content.jsonScript.metricInfo.metricField | string | Target field name of the generated metric. |
| content.jsonScript.metricInfo.unit | string | Currently displayed unit; no automatic numeric conversion is applied to query results. |
| content.jsonScript.metricInfo.desc | string | Description of the target metric field. |
| content.jsonScript.metricInfo.delaySeconds | integer | Number of seconds to wait after scheduled triggering; does not change the query window corresponding to every. |
| content.extend | object | Saved configuration: required echo object; modifications replace the entire object. None of the echo options replace jsonScript.query; when echo is not needed in handwritten mode, {} can be provided. |
| content.extend.funcName | string | Saved configuration: conditionally required aggregation function name when selectorQuery is used. count counts, count_distinct counts distinct values; numeric aggregation functions require a real numeric field; distribution echoes the histogram_auto in the corresponding q. |
| content.extend.fieldKey | string | Saved configuration: conditionally required echo aggregation field when selectorQuery is used. On creation, it queries the source field type to check compatibility with numeric functions, but unknown fields are not guaranteed to be rejected; modifications do not repeat the same field type check. |
| content.extend.source | string | Saved configuration: optional source echo; all available sources are represented by *, and the actual scope is still limited by q. When querying a RUM list, sourceInfo can be appended from this value. |
| content.extend.index | string | Saved configuration: optional Log Index echo; changing it does not automatically change the L index in q. |
| content.extend.groupBy | array | Saved configuration: optional grouping echo array; omit it to have no such echo field; an empty array means no grouping. The actual grouping is determined by q. |
| content.extend.groupBy[] | string | Saved configuration: single grouping key. |
| content.extend.filterString | string | Saved configuration: optional log filter echo string; not an automatic concatenation entry point for q; actual filtering must be written into q. |
| content.extend.filters | array | Saved configuration: optional array; uses the plural values, unlike the value in other APIs. Actual filter execution is determined by q. |
| content.extend.filters[] | json | Saved configuration: filter echo object; can recursively preserve the client's existing format; the current echo structure is not converted into an execution query. |
| content.extend.filters[].name | string | Saved configuration: echo field. |
| content.extend.filters[].condition | string | Saved configuration: relationship to the previous echo condition. |
| content.extend.filters[].op | string | Saved configuration: echo operator; query condition conversion is not performed in this API. |
| content.extend.filters[].values | array | Saved configuration: echo value array; both actual comparison and value retrieval must be reflected in q. |
| content.extend.filters[].values[] | JSON | Saved configuration: single string, number, or boolean value. |
| content.creatorInfo | object | Associated identity summary; {} when no matching identity exists. |
| content.creatorInfo.uuid | string | Identity UUID; can be omitted. |
| content.creatorInfo.status | integer | Account status; can be omitted. |
| content.creatorInfo.wsAccountStatus | integer | Workspace membership status; can be omitted. |
| content.creatorInfo.name | string | Display name. |
| content.creatorInfo.username | string | Login name. |
| content.creatorInfo.email | string | Email or system identity identifier. |
| content.creatorInfo.mobile | string | Mobile number; can be empty. |
| content.creatorInfo.countryCode | string | Country/region code; can be omitted. |
| content.creatorInfo.iconUrl | string | Avatar; can be omitted. |
| content.creatorInfo.acntWsNickname | string | Workspace nickname; can be omitted. |
| content.updatorInfo | object | Associated identity summary; {} when no matching identity exists. |
| content.updatorInfo.uuid | string | Identity UUID; can be omitted. |
| content.updatorInfo.status | integer | Account status; can be omitted. |
| content.updatorInfo.wsAccountStatus | integer | Workspace membership status; can be omitted. |
| content.updatorInfo.name | string | Display name. |
| content.updatorInfo.username | string | Login name. |
| content.updatorInfo.email | string | Email or system identity identifier. |
| content.updatorInfo.mobile | string | Mobile number; can be empty. |
| content.updatorInfo.countryCode | string | Country/region code; can be omitted. |
| content.updatorInfo.iconUrl | string | Avatar; can be omitted. |
| content.updatorInfo.acntWsNickname | string | Workspace nickname; can be omitted. |
| content.declaration | object or null | Workspace common declaration attached to a non-null business object; can be null or an empty object when not configured; an empty object is not added. |
{
"code": 200,
"content": {
"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": "按host统计nginx请求数。",
"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"
}
Error Responses¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Resolution |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | A request field is missing, or a field value violates the declared validation conditions | Parameter parsing failed | Verify the parameter location, field name, type, and value. |
| 404 | ft.NotFoundRuleInspector | The specified non-deleted rule does not exist in the workspace, including deleted UUIDs or UUIDs from another workspace | The specified rule/inspector was not found | Obtain a valid aggs UUID again from this module's list. |
| 500 | ft.InternalServerError | Failed to read the rule or format the response | Internal error | Verify the workspace and UUID; if the failure persists, provide the traceId. |
| 403 | ft.Forbidden | The API Key has insufficient permissions, or the Workspace edition does not support this feature | You do not have permission to perform this operation | Use an API Key with the required permissions and a workspace that supports Generate Metrics. |