actionLoad Balancer

inject_traffic_delay

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

Activity as code

Below are the details and signature of the activity Python module.

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

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