action Load Balancer

add_latency_to_endpoint

Add latency to a particular URL served by your load balancer

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

Usage

JSON

{
  "name": "add-latency-to-endpoint",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.lb.actions",
    "func": "add_latency_to_endpoint",
    "arguments": {
      "url": ""
    }
  }
}

YAML

name: add-latency-to-endpoint
provider:
  arguments:
    url: ''
  func: add_latency_to_endpoint
  module: chaosgcp.lb.actions
  type: python
type: action

Arguments

NameTypeDefaultRequiredTitleDescription
project_idstringYesProjectName of the GCP project in which the resource is running
regionstringNoRegionalSet this to the correct region if it is regional
urlstringYesFull Target URLFull target URL including the path
latencyfloat0.3YesLatencyLatency to inject in seconds
percentagefloat90.0YesPercentageVolume of requests impacted by the latency

Add latency to a particular URL.

This is a high level shortcut to the inject_traffic_delay which infers all the appropriate parameters from the URL itself. It does this by querying the GCP project for all LB information and matches the correct target from there.

This might no work on all combinaison of Load Balancer and backend services that GCP support but should work well with LB + Cloud Run.

The latency is expressed in seconds with a default set to 0.3 seconds.

Signature

def add_latency_to_endpoint(
        url: str,
        latency: float = 0.3,
        percentage: float = 90.0,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass