Modify¶
POST /api/v1/slo/{slo_uuid}/modify
Overview¶
Modify the mutable configuration and associations of an existing SLO.
Prerequisites and Usage Steps¶
The current API Key requires monitor.sloCfgManage. Saving a metric-type SLO also requires query permission for the target metric namespace; SLO management permission alone is not sufficient to pass this prerequisite check. Operations are limited to the workspace to which the Key belongs. The SLO UUID in the path is taken from content.data[].uuid in Get SLO List (usually with the monitor_ prefix), not the Rule UUID of an associated monitor or metricQueryInfo.sloId.
name/goal/minGoal/sliType are immutable and can only be omitted or passed with their original values; checkRange, interval, description, status, and associations can be changed. When sliUUIDs/alertPolicyUUIDs/tags are present, they are fully replaced; do not pass only the item you want to add. Read the details first to back up the original associations. A plain {} request still validates the existing configuration and updates the execution configuration and update time; it is not a no-op. Legacy invalid periods must be explicitly changed to 7/30 days.
For metric-type SLOs, metricQueries must submit both total and good. Changing the query language or execution text, checkRange, or re-enabling will advance the statistics validity lower bound; historical results cannot be directly mixed with the new definition. Changes to editor alone do not advance it. For monitor-type SLOs, when changing dimensions, verify that the source event/metric dimensions are complete. Metric-type SLOs use good/total to calculate availability; do not directly mix business percentages with counts. Each DQL query should aggregate to a single comparable numeric value; verify the actual queried data and permissions first. PromQL can use aggregations such as sum(...); this API uses instant queries uniformly for promqlType. Monitor-type SLOs reference SLI monitors to calculate deductions and generate SLO results; after groupBy is configured, calculations are performed separately by project/env/service dimensions. If no alert policy is configured, there is no notification association for that policy, and a successful save does not guarantee that notifications have been sent.
Create, modify, enable, and disable operations are committed at the end of the local transaction. On failure, the system attempts to restore remote scheduling and cache; remote compensation may also fail, so an HTTP failure does not mean that no changes occurred in all systems. After a network timeout/500, first Get SLO Details to verify the configuration and status. If necessary, ask the administrator to verify scheduling before retrying. A successful save does not mean that detection results have been generated; wait for the detection frequency and check the actual data. This endpoint does not return complete tag/policy/user summaries; validate by reading back the details.
Do not submit server-side fields such as metricResultValidAfter/metricResultStoppedAt/metricQueryInfo; undocumented Body fields are first rejected by the route declaration with a generic 406 parameter error.
Route Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| slo_uuid | string | Y | Target SLO UUID; not the SLI monitor UUID or metricQueryInfo.sloId. Null allowed: False Example: monitor_exampleHow to obtain or specify: Read content.data[].uuid from Get SLO 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 specify: Obtain an OpenAPI Key with the required operation permission from API Key management in the target workspace. |
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| metricQueries.total | object | Total query object; dql is required and editor alone is not accepted. Example: {"dql": "M::http_requests:(SUM(`total`))"}How to obtain or specify: Construct it from the target measurement and the corresponding business fields. |
|
| metricQueries.total.dql | string | Required non-empty query string, up to 65536 characters. When queryType=dql, only single-output SELECT queries on M metrics in the current workspace or valid eval expressions are supported; SHOW/other execution functions, cross-workspace metrics, and DQL-provided windows are not supported. Callers should aggregate to a single comparable numeric value and verify the result, avoiding multiple series produced by GROUP BY. When queryType=promql, this field is still named dql and accepts valid PromQL. Example: M::http_requests:(SUM(`total`))How to obtain or specify: Determine it from the language and business fields of the metric query. |
|
| metricQueries.total.queryType | string | Optional dql/promql; defaults to dql. Determines the parsing and execution language of the dql string. Example: dqlHow to obtain or specify: Determine it from the language and business fields of the metric query. |
|
| metricQueries.total.promqlType | string | Can appear only when queryType=promql; accepts instantQuery/rangeQuery, but it is saved and executed uniformly as instantQuery. Do not expect range results because rangeQuery was passed. This key is rejected in the DQL branch. Example: instantQueryHow to obtain or specify: Determine it from the language and business fields of the metric query. |
|
| metricQueries.total.editor | object | Optional echo object; defaults to {}. Stores editor state and does not participate in execution query comparison. During modification, query objects are replaced as a whole. Example: {}How to obtain or specify: Determine it from the language and business fields of the metric query. |
|
| metricQueries.good | object | Good volume query object; dql is required and editor alone is not accepted. Example: {"dql": "M::http_requests:(SUM(`good`))"}How to obtain or specify: Construct it from the target measurement and the corresponding business fields. |
|
| metricQueries.good.dql | string | Required non-empty query string, up to 65536 characters. When queryType=dql, only single-output SELECT queries on M metrics in the current workspace or valid eval expressions are supported; SHOW/other execution functions, cross-workspace metrics, and DQL-provided windows are not supported. Callers should aggregate to a single comparable numeric value and verify the result, avoiding multiple series produced by GROUP BY. When queryType=promql, this field is still named dql and accepts valid PromQL. Example: M::http_requests:(SUM(`good`))How to obtain or specify: Determine it from the language and business fields of the metric query. |
|
| metricQueries.good.queryType | string | Optional dql/promql; defaults to dql. Determines the parsing and execution language of the dql string. Example: dqlHow to obtain or specify: Determine it from the language and business fields of the metric query. |
|
| metricQueries.good.promqlType | string | Can appear only when queryType=promql; accepts instantQuery/rangeQuery, but it is saved and executed uniformly as instantQuery. Do not expect range results because rangeQuery was passed. This key is rejected in the DQL branch. Example: instantQueryHow to obtain or specify: Determine it from the language and business fields of the metric query. |
|
| metricQueries.good.editor | object | Optional echo object; defaults to {}. Stores editor state and does not participate in execution query comparison. During modification, query objects are replaced as a whole. Example: {}How to obtain or specify: Determine it from the language and business fields of the metric query. |
|
| sliUUIDs[*] | string | A single string item; the array should not contain objects/arrays/null. Example: rul_exampleHow to obtain or specify: Get content.data[].uuid from Monitor List; you can use search to find by name. Verify that the monitor is in the same workspace, not deleted, and can be used as an SLI. |
|
| alertPolicyUUIDs[*] | string | A single string item; the array should not contain objects/arrays/null. Example: altpl_exampleHow to obtain or specify: Get the UUID of a valid policy in the current workspace from Alert Policy List. |
|
| tags[*] | string | A single string item; the array should not contain objects/arrays/null. Example: productionHow to obtain or specify: Select a tag name whose scope includes monitor or all from Tag List; you can also pass a new name. |
|
| groupBy[*] | string | A single string item; the array should not contain objects/arrays/null. Only project/env/service are allowed. Example: serviceHow to obtain or specify: Select a collected project/env/service dimension and ensure that the source monitor event/service data has the corresponding field. |
|
| status | integer | Optional: 0 enabled/2 disabled. Defaults to 0 on creation; if omitted during modification, the existing value is retained; null is not allowed. Null allowed: False Allowed values: [0, 2] Example: 0How to obtain or specify: Choose based on whether detection should start immediately. |
|
| sliType | string | Defaults to monitor on creation; monitor/metric are allowed. It cannot be switched after creation; if omitted during modification, the existing value is retained, and only the original value can be passed. Null allowed: False Allowed values: ['monitor', 'metric'] Example: monitorHow to obtain or specify: Choose calculation by an existing monitor or by metric query. |
|
| checkRange | integer | Statistics window in seconds; only 604800/2592000 are allowed. Defaults to 604800 if omitted on creation; if omitted during modification, the existing value is retained. Legacy configurations such as 90 days must be explicitly changed to a supported value before they can be saved. Null allowed: False Allowed values: [604800, 2592000] Example: 604800How to obtain or specify: Select 7 or 30 days according to the SLO statistics requirements. |
|
| metricQueries | object | Metric type only. Required on creation; if omitted during modification, the existing value is retained. When present, total/good are replaced as a whole; partial patches or null are not accepted. The object must contain exactly total and good; each item supports dql/queryType/editor and promqlType for PromQL, and other execution options are not accepted. The two items should measure total and good volumes for the same business scope/time unit to ensure comparability. This API does not validate business correctness on behalf of the customer when saving. Null allowed: False Example: {"total": {"dql": "M::http_requests:(SUM(`total`))"}, "good": {"dql": "M::http_requests:(SUM(`good`))"}}How to obtain or specify: Determine the total and good volume fields from the metric data, and first use Query Data to verify the values and collection scope of each query. |
|
| name | string | Required string on creation, up to 256 characters; active SLOs in the same workspace cannot have duplicate names. Callers should use a non-empty name. It can be omitted during modification; if submitted, it must exactly match the original name. Null allowed: False Example: 支付服务可用性How to obtain or specify: The caller assigns the SLO name; read the details before modification. |
|
| goal | float | Required numeric value on creation, 0<goal<100; during modification, it can only be omitted or passed with its original value. For example, 99.9 means 99.9%, not 0.999. Null allowed: False Example: 99.9How to obtain or specify: Set the expected target based on the business SLA, in percent. |
|
| minGoal | float | Required numeric value on creation, 0<minGoal<goal<100; during modification, it can only be omitted or passed with its original value. Values below minGoal are critical; values at or above minGoal but below goal are warning. Null allowed: False Example: 99.5How to obtain or specify: Set based on the minimum tolerated availability, in percent. |
|
| interval | string | Required on creation: 5m or 10m; if omitted during modification, the existing value is retained. This is not the same concept as the checkRange statistics window. Null allowed: False Allowed values: ['5m', '10m'] Example: 5mHow to obtain or specify: Select the detection frequency as needed. |
|
| sliUUIDs | array | For monitor-type SLOs, must be non-empty on creation. During modification, omit to retain references; [] clears references (this may leave the SLO with no valid SLI, so confirm first). Full replacement and deduplication are applied, and order is not guaranteed. For metric-type SLOs, omit or use []; it must not be non-empty. Use only rules that are active in the same workspace with type=trigger or legacy empty type as SLIs. The current save does not reject invalid/other-workspace UUIDs one by one, so success does not prove that each item is computable. null is not allowed. Null allowed: False Example: ["rul_example"]How to obtain or specify: Get content.data[].uuid from Monitor List; you can use search to find by name. Verify that the monitor is in the same workspace, not deleted, and can be used as an SLI. |
|
| describe | string | Optional string, up to 3000 characters. If omitted on creation, an empty string is used; if omitted during modification, the existing value is retained; an empty string clears it; null is not allowed. Null allowed: False Empty string allowed: True Maximum length: 3000 Example: 支付服务生产环境SLOHow to obtain or specify: The caller enters usage/maintenance notes. |
|
| alertPolicyUUIDs | array | Optional array. If omitted on creation, no association is made; if omitted during modification, the existing associations are retained; [] removes all associations. When passed, it fully replaces and deduplicates; unknown/deleted/other-workspace policies are rejected. Notification targets or alertOpt are not configured directly through this API. Null allowed: False Example: ["altpl_example"]How to obtain or specify: Get the UUID of a valid policy in the current workspace from Alert Policy List. |
|
| tags | array | Array of names; each name can be up to 128 characters and is case-sensitive. New names are created with the monitor scope. If omitted on creation, no tags are set; if omitted during modification, the existing tags are retained; [] clears them. Full replacement and deduplication are applied. If an existing tag with the same name does not support monitor, a 400 is returned; null is not allowed. Null allowed: False Example: ["production"]How to obtain or specify: Select a tag name whose scope includes monitor or all from Tag List; you can also pass a new name. |
|
| groupBy | array | Supported only for monitor-type SLOs; the array may contain only project/env/service, without duplicates, and order is preserved. Defaults to [] on creation; if omitted during modification, the existing value is retained; [] removes grouping. For metric-type SLOs, omit or use []. Null allowed: False Example: ["service"]How to obtain or specify: Select a collected project/env/service dimension and ensure that the source monitor event/service data has the corresponding field. |
|
| ignoreBadGroupEvents | boolean | Can be passed only for monitor-type SLOs; defaults to true. It is saved and used in calculations only when groupBy is non-empty. If omitted during modification, the existing value is retained; when grouping is added and no original value exists, it is true; removing groupBy removes this configuration. For metric-type SLOs, it is rejected even if false is passed. Null allowed: False Example: trueHow to obtain or specify: When groupBy is present, choose based on whether to ignore abnormal group events. |
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/slo/monitor_example/modify' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"describe":"更新生产SLO维护说明","interval":"10m"}'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content.id | integer or null | Database row ID; the creation response is generated before commit and may be null; use uuid as the business identifier. |
| content.uuid | string | SLO UUID, used for subsequent details, modification, enable/disable, and deletion. |
| content.workspaceUUID | string | Target workspace UUID. |
| content.name | string | SLO name. |
| content.type | string | Fixed as slo. |
| content.score | integer | Resource sorting weight, not the SLO availability percentage. |
| content.status | integer | 0 enabled/2 disabled. |
| content.creator | string | UUID of the creating Key resource or a legacy account identifier. |
| content.updator | string | Last updater; may be empty at creation. |
| content.createAt | integer | Creation time, in Unix seconds. |
| content.updateAt | integer | Last update time, in Unix seconds; may be -1 if not updated. |
| content.deleteAt | integer | Deletion time; -1 for normally active records. |
| content.config | object | Saved SLO calculation configuration; does not include direct notification target configuration alertOpt. |
| content.config.sliType | string | monitor or metric; if missing in legacy configurations, returns monitor. |
| content.config.checkRange | integer | Statistics window in seconds, 604800 or 2592000. |
| content.config.goal | number | Expected target percentage. |
| content.config.minGoal | number | Minimum target percentage. |
| content.config.interval | string | 5m or 10m. |
| content.config.describe | string | Usage description. |
| content.config.groupBy | array<string> |
Array of grouping dimensions for monitor-type SLOs; empty for metric-type SLOs. |
| content.config.groupBy[] | string | One of project/env/service. |
| content.config.ignoreBadGroupEvents | boolean | Returned only when grouping dimensions exist; whether to ignore abnormal group events. |
| content.config.sli_infos | array<object> or object |
Present when the SLI summary is loaded for this request; usually an array of objects for monitor-type SLOs, and currently {} for metric-type SLO creation. It may be omitted during modification if sliUUIDs is not submitted. Do not treat this field as a complete list of referenced UUIDs. |
| content.config.sli_infos[].id | string | Rule UUID of the valid SLI monitor in the current workspace that was actually matched. |
| content.config.sli_infos[].name | string or null | SLI monitor name. |
| content.config.sli_infos[].status | integer | Associated monitor status, possibly 0 or 2; nonexistent references are not included in the summary. |
| content.config.metricResultValidAfter | integer or null | Metric type only: statistics validity lower bound for this run, in Unix milliseconds. It is reset on creation, window/execution query changes, and re-enabling from disabled; changing editor alone does not reset it. |
| content.config.metricResultStoppedAt | integer or null | Metric type only: stop calculation time in Unix milliseconds; null while running, recorded when disabled. |
| content.metricQueryInfo | object | Metric type only: query result location information, not the original business metric value. |
| content.metricQueryInfo.measurement | string | Fixed as slo_metric. |
| content.metricQueryInfo.sloId | string | Actual detection Rule UUID, used for querying slo_metric.slo_id; different from content.uuid. |
| content.metricQueryInfo.validAfter | integer or null | Same as config.metricResultValidAfter. |
| content.metricQueryInfo.stoppedAt | integer or null | Same as config.metricResultStoppedAt. |
| content.declaration | object | Common declaration for the current workspace. |
| content.config.metricQueries.total.dql | string | Normalized execution query. |
| content.config.metricQueries.total.queryType | string | dql or promql. |
| content.config.metricQueries.total.promqlType | string | Returned only for PromQL, fixed as instantQuery. |
| content.config.metricQueries.total.editor | object | Caller editor echo data. |
| content.config.metricQueries.total.editor.Custom Field | JSON | Dynamic edit state passed by the caller; not interpreted as a server-side execution option. |
| content.config.metricQueries.good.dql | string | Normalized execution query. |
| content.config.metricQueries.good.queryType | string | dql or promql. |
| content.config.metricQueries.good.promqlType | string | Returned only for PromQL, fixed as instantQuery. |
| content.config.metricQueries.good.editor | object | Caller editor echo data. |
| content.config.metricQueries.good.editor.Custom Field | JSON | Dynamic edit state passed by the caller; not interpreted as a server-side execution option. |
| content.config.metricQueries | object | Metric type only; complete normalized configuration of total and good. |
| content.config.metricQueries.total | object | Total query configuration. |
| content.config.metricQueries.good | object | Good volume query configuration. |
{
"code": 200,
"content": {
"id": 123,
"uuid": "monitor_example",
"workspaceUUID": "wksp_example",
"name": "支付服务可用性",
"type": "slo",
"score": 0,
"status": 0,
"creator": "wsak_example",
"updator": "wsak_example",
"createAt": 1785427200,
"updateAt": 1785427260,
"deleteAt": -1,
"config": {
"goal": 99.9,
"minGoal": 99.5,
"interval": "5m",
"checkRange": 604800,
"sliType": "monitor",
"describe": "支付服务生产环境SLO",
"groupBy": []
},
"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 | Handling |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | A required 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. |
| 400 | ft.RequestJsonFormatError | Request JSON syntax is invalid | Request JSON format error | Fix the JSON according to content.reason, line, and column. |
| 400 | ft.JsonFormatError | JSON top level is not an object | JSON file format error in some parts | Submit an object. |
| 404 | ft.NotFoundSLO | The target is not in the current workspace, has been deleted, or is not an SLO; for modification, this also includes missing required detection/calculation components | The specified SLO was not found | Get the uuid from the current workspace SLO list; confirm the target still exists. Ask the administrator to repair missing components. |
| 400 | ft.ParamsValidateError | Invalid business combination of exposed fields such as metric query/period/dimensions | Parameter validation failed: {} | Fix according to the parameter constraints for the two types, retaining the original name, goal, and type; do not submit server-side fields. |
| 400 | ft.SloImmutableField | name/goal/minGoal/sliType differ from the original configuration | Field cannot be modified after SLO creation: name | Keep the original values; create another SLO and migrate dependencies to change the definition. |
| 406 | ft.SloMinGoalGreaterThanGoal | minGoal is greater than or equal to goal | minGoal must be less than goal; current minGoal: 99.9 goal: 99.9 |
Ensure 0<minGoal<goal<100. |
| 400 | ft.InvalidAlertPolicyUUID | alertPolicyUUIDs contains a policy that is not valid in the current workspace | Invalid alert policy UUID | Retrieve again from the current workspace alert policy list. |
| 400 | ft.TagScopeMismatch | An existing tag with the same name does not have monitor or all in its scope | production: ['scene'] -> monitor | Select a tag that can be used for monitoring; do not directly reuse a tag with the same name from another dedicated scope. |
| 406 | ft.ExceedMaxCharacterLimit | Tag name exceeds 128 characters | {} exceeds the maximum character length limit | Shorten the tag name while keeping it business-recognizable. |
| 400 | ft.FiledCreateTrigger | The create scheduling response is missing the task ID | Failed to create trigger configuration. Please try again. | First verify the SLO and residual tasks, then repair scheduling/retry. |
| 400 | ft.OuterFuncFailed | The remote scheduling service returned a failure | External function call failed (some branches use the downstream message) | Check message and traceId; ask the administrator to verify scheduling availability and the current configuration state before retrying. |
| 400 | ft.SameSetTraggerExists | The remote scheduling service reports that an identical trigger configuration already exists | A trigger with the same configuration already exists | First verify the SLO and remote scheduling, resolve residual/duplicate configurations, and then submit. |
| 500 | ft.InternalServerError | Database/cache, task queue, invalid array member, or unhandled downstream exception; a failure may also have remote changes | Internal error | First check the target SLO configuration and current scheduling state; for deletion failures, also verify the deleted state. Do not blindly repeat creation or batch overwrite. |
| 403 | ft.ForbiddenQuery | The metric-type query passes the namespace permission check, but the current Key does not have metric query permission | You do not have {} permission | Grant the target metric query permission to the Key role, and verify the query with the same Key before saving. |