actionload

inject_gradual_traffic_into_endpoint

Load traffic into the given endpoint.

Activity as code

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

Typeaction
Modulechaosreliably.activities.load.probes
Nameinject_gradual_traffic_into_endpoint
Returnmapping

Usage

JSON

{
  "name": "inject-gradual-traffic-into-endpoint",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosreliably.activities.load.actions",
    "func": "inject_gradual_traffic_into_endpoint",
    "arguments": {
      "endpoint": ""
    }
  }
}

YAML

name: inject-gradual-traffic-into-endpoint
provider:
  arguments:
    endpoint: ""
  func: inject_gradual_traffic_into_endpoint
  module: chaosreliably.activities.load.actions
  type: python
type: action

Arguments

NameTypeDefaultRequiredTitleDescription
endpointstringYesEndpointURL to target the traffic to
step_durationinteger5NoStep DurationDuration of each step of the load test
step_additional_vuinteger1NoAdditional Virtual User Per StepHow many new virtual users to add at each step
vu_per_second_rateinteger1NoVirtual User Per SecondRate of virtual user per second
test_durationinteger30NoLoad Test DurationTotal duration of the load test
results_json_filepathstring/tmp/results.jsonNoLocal Path of Load Test ResultsPath to a local file where results will be written to
enable_opentracingbooleanfalseNoEnable Open Telemetry TracesEnable Open Telemetry traces for load tests requests. Requires that the Open Telemetry environment variables are properly populated during the execution

Load traffic into the given endpoint. Uses an approach that creates an incremental load into the endpoint rather than swarming it. The point of this action is to ensure your endpoint is active while you perform another action. This you means you likely want to run this action in the background.

You may set a bearer token if your application uses one to authenticate. Pass test_bearer_token as a secret key in the secrets payload.

Signature

def inject_gradual_traffic_into_endpoint(
        endpoint: str,
        step_duration: int = 5,
        step_additional_vu: int = 1,
        vu_per_second_rate: int = 1,
        test_duration: int = 30,
        results_json_filepath: Optional[str] = None,
        enable_opentracing: bool = False,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass