メインコンテンツへスキップ

delete-custom-metric

dci delete-custom-metric [flags]

Deletes a custom metric. This cannot be undone. Requires the analytics:calculatedMetrics entitlement and a metrics write permission, and only the owner can delete a metric. Send the metric's etag in If-Match.

A metric that a report or an alert uses cannot be deleted. Remove it from them first.

A retry with the same Idempotency-Key returns the first 204. A new request for a metric that no longer exists, including one that is already deleted, returns 404 not_found: treat it as gone.

With dryRun=true, every check runs and nothing is deleted.

Errors (RFC 9457 Problem Details, code field):

  • 400 idempotency_key_required: no Idempotency-Key header.
  • 400 tenant_id_required: a caller with access to more than one customer sent no X-Tenant-Id.
  • 403 analytics.feature_not_entitled: the customer does not have the calculated metrics entitlement.
  • 403 analytics.custom_metric_not_owner: the caller does not own the metric.
  • 403 forbidden: no metrics write permission, a read-only token, or an X-Tenant-Id that the credential cannot access.
  • 404 not_found: no custom metric with this id for the customer, including a metric that is already deleted.
  • 409 delete_blocked_by_dependencies: reports, allocations or alerts use the metric. details has one entry per user, with issue set to used_by_report, used_by_allocation or used_by_alert, and resourceType and resourceId naming that user, for example \{"issue": "used_by_report", "resourceType": "report", "resourceId": "..."\}. An allocation uses the metric when one of its splits is weighted by it.
  • 409 idempotency_request_in_progress: a request with the same Idempotency-Key is still running. Retry with backoff.
  • 412 precondition_failed: If-Match does not match the current etag. Read the metric again, then retry.
  • 422 idempotency_key_reused: the Idempotency-Key was used for another request.
  • 428 precondition_required: no If-Match header.

Flags​

FlagTypeDefaultExampleDescription
--dry-runbooleanfalseIf true, validates the request and returns the would-be result without applying it. The response then carries the X-Dry-Run header.

Every command also accepts the CLI-wide flags for output shaping — see Output formats and Table output options.

Output​

On success, this command produces no response data.

Errors​

On failure, dci prints a single error message — with a hint when one is available — and exits with a typed code your scripts can branch on. See Errors and exit codes for the full contract.

HTTP status to exit code mapping
HTTP statusExit codeError codeMeaning
400, 42230VALIDATION_ERRORThe arguments or request body were rejected. Review the command's flags and payload.
40110AUTHENTICATION_FAILEDNot signed in, or the API token is invalid. Run dci login or check DCI_API_KEY.
40311PERMISSION_DENIEDThe DoiT user or the active customer context does not have access.
40420RESOURCE_NOT_FOUNDThe requested resource does not exist. Check the identifier argument.
405, 412, 4281API_ERRORThe request failed; the printed error message has details.
40921RESOURCE_CONFLICTThe operation conflicts with the resource's current state.
42950RATE_LIMITEDToo many requests. Retryable — the CLI reports the server-provided delay.
500, 50340API_SERVER_ERRORThe API failed to process the request. Retryable; contact DoiT support if it persists.

Aliases: deletecustommetric