Migration Guide: Failure and Termination Rules (v3.0.2.5 → v3.0.2.6+)

Breaking Change: As of version 3.0.2.6, the old failureCriteria and terminationRules formats have been permanently removed. The last version supporting the old format was 3.0.2.5.

This guide helps you migrate your existing test configurations to the new inline metric expression format.

Overview of Changes

Feature Old Format (Deprecated) New Format (v3.0.2.6+)
Failure Rules failureCriteria with individual fields failureRules with inline metric expressions
Termination Rules terminationRules with individual fields terminationRules with inline metric expressions
Status Codes Comma-separated list: "403,401,500" Comparison expression: ">= 400", "between 400 and 499"

Failure Rules Migration

Old Format (Removed)

failureCriteria:
  maxErrorRate: 0.10
  errorStatusCodes: "404,403,500"
  maxP90: 250
  maxP50: 200
  maxP10: 150
  maxAvg: 180

New Format

failureRules:
  - metric: "ErrorRate > 0.10"
    errorStatusCodes: ">= 400"
  - metric: "TotalTime.P90 > 250"
  - metric: "TotalTime.P50 > 200"
  - metric: "TotalTime.P10 > 150"
  - metric: "TotalTime.Avg > 180"

Key Differences

  1. Property name changed: failureCriteriafailureRules
  2. Array of rules: Each metric condition is now a separate rule
  3. Inline expressions: Use operators like >, >=, <, <=, =, !=
  4. Status code format: Changed from comma-separated to comparison expressions

Termination Rules Migration

Old Format (Removed)

terminationRules:
  - maxErrorRate: 0.2
    errorStatusCodes: "404,403,500"
    maxP90: 200
    gracePeriod: "00:00:10"
  - maxP50: 400
    gracePeriod: "00:00:15"

New Format

terminationRules:
  - metric: "ErrorRate > 0.2"
    errorStatusCodes: ">= 400"
    gracePeriod: "00:00:10"
  - metric: "TotalTime.P90 > 200"
    gracePeriod: "00:00:10"
  - metric: "TotalTime.P50 > 400"
    gracePeriod: "00:00:15"

Key Differences

  1. Metric field required: Each rule must have a metric field with an inline expression
  2. One metric per rule: Each metric condition is now a separate rule (no combining maxErrorRate and maxP90 in one rule)
  3. Grace period format: Unchanged (TimeSpan format "HH:mm:ss")

Status Code Expressions

Old Format

errorStatusCodes: "403,401,500"

New Format Options

Expression Description
">= 500" All 5xx server errors
">= 400" All 4xx and 5xx errors
"between 400 and 499" Only 4xx client errors
"= 429" Only rate limiting errors
"= 0" Connectivity failures (DNS, timeout, connection refused)
">= 0" All errors including connectivity failures

Special Note on Status Code 0

The status code 0 represents connectivity failures, including:

  • DNS resolution failures
  • Connection refused
  • Connection timeout
  • SSL/TLS handshake failures
  • Network unreachable

Metric Expression Reference

Format

MetricName[.Statistic] Operator Threshold

Available Metrics

Metric Statistics Example
ErrorRate (none) "ErrorRate > 0.05"
TotalTime .P10, .P50, .P90, .P99, .Avg, .Min, .Max "TotalTime.P90 > 250"
Throughput (none) "Throughput < 100"

Operators

  • > - Greater than
  • >= - Greater than or equal
  • < - Less than
  • <= - Less than or equal
  • = - Equal
  • != - Not equal
  • between X and Y - Range comparison (inclusive)

CLI Options

New CLI Options for Rules

Failure Rules:

lps --url https://example.com -rc 1000 --failurerule "ErrorRate > 0.05;>= 500"  --failurerule "TotalTime.P90 > 250"

Format: "metric[;errorStatusCodes]"

Termination Rules:

lps --url https://example.com -rc 1000 --terminationrule "ErrorRate > 0.10;00:05:00;>= 500" --terminationrule "TotalTime.P90 > 500;00:00:30"

Format: "metric;gracePeriod[;errorStatusCodes]"

Complete Migration Example

Before (v3.0.2.5 and earlier)

name: OldFormatExample
rounds:
  - name: TestRound
    numberOfClients: 50
    iterations:
      - name: APITest
        httpRequest:
          url: https://api.example.com/endpoint
          method: GET
        failureCriteria:
          maxErrorRate: 0.10
          errorStatusCodes: "500,502,503"
          maxP90: 500
        terminationRules:
          - maxErrorRate: 0.25
            errorStatusCodes: "500,502,503"
            gracePeriod: "00:00:30"
          - maxP90: 1000
            gracePeriod: "00:00:15"

After (v3.0.2.6+)

name: NewFormatExample
rounds:
  - name: TestRound
    numberOfClients: 50
    iterations:
      - name: APITest
        httpRequest:
          url: https://api.example.com/endpoint
          method: GET
        failureRules:
          - metric: "ErrorRate > 0.10"
            errorStatusCodes: ">= 500"
          - metric: "TotalTime.P90 > 500"
        terminationRules:
          - metric: "ErrorRate > 0.25"
            errorStatusCodes: ">= 500"
            gracePeriod: "00:00:30"
          - metric: "TotalTime.P90 > 1000"
            gracePeriod: "00:00:15"

FAQ

Q: Can I still use the old format?

A: No. The old format has been permanently removed in v3.0.2.6. You must migrate to the new format.

Q: What happens if I run an old config with the new version?

A: The test will fail validation with an error indicating the old properties are not recognized.

Q: Can I combine multiple metrics in one rule?

A: No. Each metric must be its own rule. This provides more flexibility and clearer semantics.

Q: How do I include connectivity failures in my error count?

A: Use status code 0 in your expression: errorStatusCodes: ">= 0" or errorStatusCodes: "= 0" for only connectivity failures.