Skip to content

Dry-run an alert rule

Evaluates an unsaved rule once and returns the instances it would produce and its condition's series over the 6 hours before time. A content read: unrecorded, and checked as the caller like a create. 400 invalid_request with issues[] for every validation problem, each at its field's dotted path. 403 access_denied naming the missing action when the caller can't read what the condition reads (obs.metrics.query on the project for PromQL; obs.logs.search or obs.traces.search on the dataset). 422 rule_too_expensive. 404 while alerting isn't offered (the console hides Alerting then).

POST
https://obs.ezghcloud.com/v1/organizations/{orgId}/projects/{projectId}/obs/alert-rules/test

Authorization

  • apiKeyoptionalHTTP
  • oauthoptionalHTTP
  • sessionCookieoptionalAPI key in cookie

Path parameters

  • orgIdstringrequired
    format: uuid
  • projectIdstringrequired
    format: uuid

Request bodyJSONrequired

  • ruleobjectrequired

    An alert rule. Unknown fields are refused.

    13 properties
    • conditionobjectrequired

      Exactly one of promql, logs and traces.

      3 properties
      • logsoptionalobject

        A logs or traces aggregate over [t − window, t); each group whose value satisfies the threshold is an active instance.

        6 properties
        • aggregateobjectrequired

          One aggregation, as a dashboard panel's: {fn, field?}.

          2 properties
          • fnstringrequired
          • fieldoptionalunknown
        • datasetstringrequired
          format: uuid
        • thresholdobjectrequired
          2 properties
          • op>or>=or<or<=or==or!=required
          • valuenumberrequired
        • windowstringrequired

          The aggregate's window, ending at the evaluation time: 1m to 15m in whole minutes.

        • filteroptionalobject

          The dashboard panel's filter: logs' filters (LogFilters) or traces' (TraceFilters), kept as sent (stored as JSON: key order and number spelling may be normalized). Default {}.

        • groupByoptionalarray ofobject

          At most 2 fields; at most 50 groups are evaluated (more is a rule error).

          1 properties
          • fieldunknownrequired
      • promqloptionalobject
        1 properties
        • exprstringrequired

          A PromQL expression returning an instant vector, with its comparison: every series it returns is an active instance. Ranges, subquery ranges and offsets add up to at most 1h along any path; @ isn't allowed.

          maxLength: 8192
      • tracesoptionalobject

        A logs or traces aggregate over [t − window, t); each group whose value satisfies the threshold is an active instance.

        6 properties
        • aggregateobjectrequired

          One aggregation, as a dashboard panel's: {fn, field?}.

          2 properties
          • fnstringrequired
          • fieldoptionalunknown
        • datasetstringrequired
          format: uuid
        • thresholdobjectrequired
          2 properties
          • op>or>=or<or<=or==or!=required
          • valuenumberrequired
        • windowstringrequired

          The aggregate's window, ending at the evaluation time: 1m to 15m in whole minutes.

        • filteroptionalobject

          The dashboard panel's filter: logs' filters (LogFilters) or traces' (TraceFilters), kept as sent (stored as JSON: key order and number spelling may be normalized). Default {}.

        • groupByoptionalarray ofobject

          At most 2 fields; at most 50 groups are evaluated (more is a rule error).

          1 properties
          • fieldunknownrequired
    • namestringrequired
      maxLength: 100, minLength: 1
    • annotationsoptionalmap ofstring

      Templates (Prometheus's alerting template language, without query, range or template; at most 4 KiB each, 16 in all), rendered per instance with $labels and $value.

    • contactPointsoptionalarray ofstring

      0 to 10 contact point IDs of the project. Default none (the rule still evaluates and keeps state).

      format: uuid
    • descriptionoptionalstring
      maxLength: 1000
    • enabledoptionalboolean

      Off: the rule isn't evaluated and has no instances. Default true.

    • foroptionalstring

      How long the condition must hold before an instance fires: 0 to 24h in whole minutes. Default 0.

    • keepFiringForoptionalstring

      How long a firing instance keeps firing after the condition stops holding: 0 to 24h in whole minutes. Default 0.

    • labelsoptionalmap ofstring

      Static labels on every instance (at most 32). alertname, ezgh_* and __* are reserved.

    • noDataoptionalokoralertingornoData

      Logs and traces conditions whose aggregate returns no groups: ok (nothing active), alerting (one active instance) or noData (one instance in the noData state). Default noData. PromQL ignores it: use absent().

    • notifyOnResolveoptionalboolean

      Notify when instances resolve. Default true.

    • onErroroptionalerrororok

      A rule error (the engine refuses the query, more than 1,000 instances, a budget exceeded): error puts the rule in the error state and notifies; ok records it without notifying. Default error. EZGH's own failures never notify.

    • repeatIntervaloptionalstring

      How often a still-firing rule notifies again: 5m to 7d. Default 4h.

  • timeoptionalstring

    Evaluate at this time (default now, less the evaluation freshness offset).

    format: date-time

Returns

200

The dry run.

JSON
  • instancesarray ofobjectrequired

    The instances the rule would have at time, as if newly active: pending, or firing when for is 0.

    13 properties
    • activeAtstringrequired

      UTC, millisecond precision: 2026-10-02T10:20:00.000Z.

      format: date-time
    • annotationsmap ofstringrequired

      Rendered.

    • distinctLabelsmap ofstringrequired

      labels without those every instance of its group (its rule, or SLO tier, under the list's filters) shares.

    • fingerprintstringrequired

      16 hex digits: the hash of the instance's labels.

    • firedAtstring | nullrequired
      format: date-time
    • labelsmap ofstringrequired
    • lastActiveAtstringrequired

      UTC, millisecond precision: 2026-10-02T10:20:00.000Z.

      format: date-time
    • ownerobjectrequired
      4 properties
      • idstringrequired
        format: uuid
      • kindstringrequired

        rule or slo.

      • namestringrequired
      • slugstringrequired

        alr_… or slo_… (empty in a dry run's instances).

    • resolvedAtstring | nullrequired
      format: date-time
    • silencedByarray ofstringrequired

      The active silences that mute it.

      format: uuid
    • statestringrequired

      pending, firing, noData or resolved (kept 15 minutes): the underlying state; a silenced one has silencedBy.

    • valuenumber | nullrequired
    • tieroptionalstring

      An SLO's tier: page or ticket.

  • readBytesintegerrequired
  • readRowsintegerrequired
  • seriesarray ofobjectrequired
    2 properties
    • labelsmap ofstringrequired
    • pointsarray ofarray<unknown>required

      [unixSeconds, value or null], one a minute over the 6 hours before time.

  • warningsarray ofstringrequired

    sampledData, noContactPoints, and seriesUnavailable when the chart couldn't be drawn. More codes may be added.

400

invalid_request (with issues), invalid_cursor, or the endpoint's own 400 codes.

JSON
  • errorobjectrequired
    4 properties
    • codestringrequired
      maxLength: 64, pattern: ^[a-z][a-z0-9_]*$
    • messagestringrequired
      maxLength: 1024
    • issuesoptionalarray ofobject

      invalid_request: one entry per problem, at a dotted path.

      2 properties
      • messagestringrequired
      • pathstringrequired
    • quotaoptionalobject

      quota_exceeded: the quota that refused the request. Never with Retry-After.

      11 properties
      • idstringrequired
      • kindallocationorrateorusageorconcurrencyrequired
      • limitintegerrequired
        minimum: 0
      • scopeorganizationorprojectorresourcerequired
      • inFlightoptionalinteger
        minimum: 0
      • periodStartoptionalstring
        format: date-time
      • regionoptionalstring
      • resetsAtoptionalstring
        format: date-time
      • scopeResourceNameoptionalstring
      • usedoptionalinteger
        minimum: 0
      • windowoptionalstring

        rate only: an ISO 8601 duration, PT1S to PT1H.

401

unauthenticated: no credential, or one that doesn't check out.

JSON
  • errorobjectrequired
    4 properties
    • codestringrequired
      maxLength: 64, pattern: ^[a-z][a-z0-9_]*$
    • messagestringrequired
      maxLength: 1024
    • issuesoptionalarray ofobject

      invalid_request: one entry per problem, at a dotted path.

      2 properties
      • messagestringrequired
      • pathstringrequired
    • quotaoptionalobject

      quota_exceeded: the quota that refused the request. Never with Retry-After.

      11 properties
      • idstringrequired
      • kindallocationorrateorusageorconcurrencyrequired
      • limitintegerrequired
        minimum: 0
      • scopeorganizationorprojectorresourcerequired
      • inFlightoptionalinteger
        minimum: 0
      • periodStartoptionalstring
        format: date-time
      • regionoptionalstring
      • resetsAtoptionalstring
        format: date-time
      • scopeResourceNameoptionalstring
      • usedoptionalinteger
        minimum: 0
      • windowoptionalstring

        rate only: an ISO 8601 duration, PT1S to PT1H.

403

access_denied: the caller's policies don't allow the action; forbidden_origin: a cookie-authenticated write from an origin that isn't allowed; spend_limit_reached.

JSON
  • errorobjectrequired
    4 properties
    • codestringrequired
      maxLength: 64, pattern: ^[a-z][a-z0-9_]*$
    • messagestringrequired
      maxLength: 1024
    • issuesoptionalarray ofobject

      invalid_request: one entry per problem, at a dotted path.

      2 properties
      • messagestringrequired
      • pathstringrequired
    • quotaoptionalobject

      quota_exceeded: the quota that refused the request. Never with Retry-After.

      11 properties
      • idstringrequired
      • kindallocationorrateorusageorconcurrencyrequired
      • limitintegerrequired
        minimum: 0
      • scopeorganizationorprojectorresourcerequired
      • inFlightoptionalinteger
        minimum: 0
      • periodStartoptionalstring
        format: date-time
      • regionoptionalstring
      • resetsAtoptionalstring
        format: date-time
      • scopeResourceNameoptionalstring
      • usedoptionalinteger
        minimum: 0
      • windowoptionalstring

        rate only: an ISO 8601 duration, PT1S to PT1H.

404

not_found: unknown, malformed, or in an organization the caller isn't in.

JSON
  • errorobjectrequired
    4 properties
    • codestringrequired
      maxLength: 64, pattern: ^[a-z][a-z0-9_]*$
    • messagestringrequired
      maxLength: 1024
    • issuesoptionalarray ofobject

      invalid_request: one entry per problem, at a dotted path.

      2 properties
      • messagestringrequired
      • pathstringrequired
    • quotaoptionalobject

      quota_exceeded: the quota that refused the request. Never with Retry-After.

      11 properties
      • idstringrequired
      • kindallocationorrateorusageorconcurrencyrequired
      • limitintegerrequired
        minimum: 0
      • scopeorganizationorprojectorresourcerequired
      • inFlightoptionalinteger
        minimum: 0
      • periodStartoptionalstring
        format: date-time
      • regionoptionalstring
      • resetsAtoptionalstring
        format: date-time
      • scopeResourceNameoptionalstring
      • usedoptionalinteger
        minimum: 0
      • windowoptionalstring

        rate only: an ISO 8601 duration, PT1S to PT1H.

409

quota_exceeded (an allocation quota, with quota), idempotency_conflict, idempotency_in_progress (with Retry-After), organization_deletion_pending, operation_in_progress, or the endpoint's own 409 codes.

JSON
  • errorobjectrequired
    4 properties
    • codestringrequired
      maxLength: 64, pattern: ^[a-z][a-z0-9_]*$
    • messagestringrequired
      maxLength: 1024
    • issuesoptionalarray ofobject

      invalid_request: one entry per problem, at a dotted path.

      2 properties
      • messagestringrequired
      • pathstringrequired
    • quotaoptionalobject

      quota_exceeded: the quota that refused the request. Never with Retry-After.

      11 properties
      • idstringrequired
      • kindallocationorrateorusageorconcurrencyrequired
      • limitintegerrequired
        minimum: 0
      • scopeorganizationorprojectorresourcerequired
      • inFlightoptionalinteger
        minimum: 0
      • periodStartoptionalstring
        format: date-time
      • regionoptionalstring
      • resetsAtoptionalstring
        format: date-time
      • scopeResourceNameoptionalstring
      • usedoptionalinteger
        minimum: 0
      • windowoptionalstring

        rate only: an ISO 8601 duration, PT1S to PT1H.

413

payload_too_large: the body is over the endpoint's limit (1 MiB unless it says otherwise).

JSON
  • errorobjectrequired
    4 properties
    • codestringrequired
      maxLength: 64, pattern: ^[a-z][a-z0-9_]*$
    • messagestringrequired
      maxLength: 1024
    • issuesoptionalarray ofobject

      invalid_request: one entry per problem, at a dotted path.

      2 properties
      • messagestringrequired
      • pathstringrequired
    • quotaoptionalobject

      quota_exceeded: the quota that refused the request. Never with Retry-After.

      11 properties
      • idstringrequired
      • kindallocationorrateorusageorconcurrencyrequired
      • limitintegerrequired
        minimum: 0
      • scopeorganizationorprojectorresourcerequired
      • inFlightoptionalinteger
        minimum: 0
      • periodStartoptionalstring
        format: date-time
      • regionoptionalstring
      • resetsAtoptionalstring
        format: date-time
      • scopeResourceNameoptionalstring
      • usedoptionalinteger
        minimum: 0
      • windowoptionalstring

        rate only: an ISO 8601 duration, PT1S to PT1H.

429

too_many_requests, with Retry-After; or quota_exceeded (a rate, usage or concurrency quota, with quota), never with Retry-After.

JSON
  • errorobjectrequired
    4 properties
    • codestringrequired
      maxLength: 64, pattern: ^[a-z][a-z0-9_]*$
    • messagestringrequired
      maxLength: 1024
    • issuesoptionalarray ofobject

      invalid_request: one entry per problem, at a dotted path.

      2 properties
      • messagestringrequired
      • pathstringrequired
    • quotaoptionalobject

      quota_exceeded: the quota that refused the request. Never with Retry-After.

      11 properties
      • idstringrequired
      • kindallocationorrateorusageorconcurrencyrequired
      • limitintegerrequired
        minimum: 0
      • scopeorganizationorprojectorresourcerequired
      • inFlightoptionalinteger
        minimum: 0
      • periodStartoptionalstring
        format: date-time
      • regionoptionalstring
      • resetsAtoptionalstring
        format: date-time
      • scopeResourceNameoptionalstring
      • usedoptionalinteger
        minimum: 0
      • windowoptionalstring

        rate only: an ISO 8601 duration, PT1S to PT1H.

500

internal_error: a bug; the details are in the logs, under the request ID.

JSON
  • errorobjectrequired
    4 properties
    • codestringrequired
      maxLength: 64, pattern: ^[a-z][a-z0-9_]*$
    • messagestringrequired
      maxLength: 1024
    • issuesoptionalarray ofobject

      invalid_request: one entry per problem, at a dotted path.

      2 properties
      • messagestringrequired
      • pathstringrequired
    • quotaoptionalobject

      quota_exceeded: the quota that refused the request. Never with Retry-After.

      11 properties
      • idstringrequired
      • kindallocationorrateorusageorconcurrencyrequired
      • limitintegerrequired
        minimum: 0
      • scopeorganizationorprojectorresourcerequired
      • inFlightoptionalinteger
        minimum: 0
      • periodStartoptionalstring
        format: date-time
      • regionoptionalstring
      • resetsAtoptionalstring
        format: date-time
      • scopeResourceNameoptionalstring
      • usedoptionalinteger
        minimum: 0
      • windowoptionalstring

        rate only: an ISO 8601 duration, PT1S to PT1H.

503

unavailable: a dependency the request needs is down. Retry after Retry-After.

JSON
  • errorobjectrequired
    4 properties
    • codestringrequired
      maxLength: 64, pattern: ^[a-z][a-z0-9_]*$
    • messagestringrequired
      maxLength: 1024
    • issuesoptionalarray ofobject

      invalid_request: one entry per problem, at a dotted path.

      2 properties
      • messagestringrequired
      • pathstringrequired
    • quotaoptionalobject

      quota_exceeded: the quota that refused the request. Never with Retry-After.

      11 properties
      • idstringrequired
      • kindallocationorrateorusageorconcurrencyrequired
      • limitintegerrequired
        minimum: 0
      • scopeorganizationorprojectorresourcerequired
      • inFlightoptionalinteger
        minimum: 0
      • periodStartoptionalstring
        format: date-time
      • regionoptionalstring
      • resetsAtoptionalstring
        format: date-time
      • scopeResourceNameoptionalstring
      • usedoptionalinteger
        minimum: 0
      • windowoptionalstring

        rate only: an ISO 8601 duration, PT1S to PT1H.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close