Skip to main content

Kafka extension for Chaos Toolkit extensions

Project description

Chaos Toolkit Extensions for Kafka

Version License

Build Python versions

This project contains Chaos Toolkit activities to create kafka chaos experiments.

Install

This package requires Python 3.8+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-kafka

Usage

A typical experiment using this extension would look like this:

{
  "title": "Reboot MSK broker and check the health of a target topic!!",
  "description": "Experiment to ensure that topics should not have offline partitions after a restart",
  "configuration": {
    "aws_profile_name": "aws-profile-msk",
    "boostrap_servers": "msk_bootstrap_servers:9092",
    "aws_region": "aws_region",
    "cluster_arn": "arn_msk_broker",
    "broker_ids": [
      "1"
    ],
    "recovery_time": 120,
    "topic": "kafka-test-offline"
  },
  "steady-state-hypothesis": {
    "title": "After Rebooting the Kafka broker, the topic shouldn't have offline partitions",
    "probes": [
      {
        "name": "Check that Kafka topic doesn't have offline partitions!!",
        "type": "probe",
        "tolerance": true,
        "provider": {
          "type": "python",
          "module": "chaoskafka.probes",
          "func": "topic_has_no_offline_partitions",
          "arguments": {
            "bootstrap_servers": "${boostrap_servers}",
            "topic": "${topic}"
          }
        }
      }
    ]
  },
  "method": [
    {
      "type": "action",
      "name": "Reboot MSK broker",
      "provider": {
        "type": "python",
        "module": "chaosaws.msk.actions",
        "func": "reboot_msk_broker",
        "arguments": {
          "cluster_arn": "${cluster_arn}",
          "broker_ids": "${broker_ids}"
        }
      },
      "pauses": {
        "after": "${recovery_time}"
      }
    }
  ]
}

That's it!

Please explore the code to see existing probes and actions.

Test

To run the tests for the project execute the following:

$ pdm run test

Formatting and Linting

We use ruff to both lint and format this repositories code.

Before raising a Pull Request, we recommend you run formatting against your code with:

$ pdm run format

This will automatically format any code that doesn't adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

$ pdm run lint

To ensure that any unused import statements/strings that are too long, etc. are also picked up.

Contribute

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chaostoolkit_kafka-0.1.2.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

chaostoolkit_kafka-0.1.2-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file chaostoolkit_kafka-0.1.2.tar.gz.

File metadata

  • Download URL: chaostoolkit_kafka-0.1.2.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for chaostoolkit_kafka-0.1.2.tar.gz
Algorithm Hash digest
SHA256 39f3ea1617e3dab8d0aa066db63697631cf9ad49e6fd856e51ee5b4fb6398227
MD5 ebdcbd539b7098f3a28aaf78e8ceb844
BLAKE2b-256 e2b5259134ae9adb1dd2ace52453855ab150562e85e7ad5ec642a0aa7c2c6308

See more details on using hashes here.

File details

Details for the file chaostoolkit_kafka-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for chaostoolkit_kafka-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9876c86a3fc898ef83f6dbf902c713ed4450411ab0f616e063708a87634f5b99
MD5 15fd251915fd6dc8ec001d8f92021900
BLAKE2b-256 33e77bf97c16f88d4d3af60e561d8f0436acfc44e13602ffe2cbd7cf8db63109

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page