action Load Balancer

inject_traffic_delay

Add/set delay for a percentage of requests going through a url map on a given path

Run it now
View details
Typeaction
Modulechaosgcp.lb.actions
Nameinject_traffic_delay
Returnmapping

Usage

JSON

{
  "name": "inject-traffic-delay",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.lb.actions",
    "func": "inject_traffic_delay",
    "arguments": {
      "url_map": "",
      "target_name": "",
      "target_path": ""
    }
  }
}

YAML

name: inject-traffic-delay
type: action
provider:
  type: python
  module: chaosgcp.lb.actions
  func: inject_traffic_delay
  arguments:
    url_map: ''
    target_name: ''
    target_path: ''

Arguments

NameTypeDefaultRequiredTitleDescription
url_mapstringYesURL Map NameName of the URL map to add the fault to
target_namestringYesPath Matcher NameName of the patch matcher to add the fault to
target_pathstringYesPathPath to impact with the fault. Must already exist in the path matcher definition
impacted_percentagefloat50.0NoPercentage of Impacted RequestsVolume of requests to impact with the delay
delay_in_secondsinteger1NoDelay in SecondsDelay to add in seconds
delay_in_nanosinteger0NoDelay in NanosecondsDelay to add in nanoseconds
project_idstringNoProjectName of the GCP project in which the resource is running
regionalbooleanfalseNoRegionalSet this if the project is regional
regionstringNoRegionalSet this to the correct region if it is regional

This does not work with classic load balancer. Note also the fault may take a couple of minutes to propagated through GCP infrastructure and may not be immediatly on.

See: https://cloud.google.com/load-balancing/docs/l7-internal/setting-up-traffic-management#configure_fault_injection

Signature

def inject_traffic_delay(
        url_map: str,
        target_name: str,
        target_path: str,
        impacted_percentage: float = 50.0,
        delay_in_seconds: int = 1,
        delay_in_nanos: int = 0,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass