Skip to content

Extension chaoshoneycomb

Version 0.6.2
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-honeycomb

Version License

Build, Test, and Lint Python versions

This project contains Chaos Toolkit activities for the Honeycomb platform.

Install

This package requires Python 3.7+

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

$ pip install chaostoolkit-honeycomb

Usage

{
    "title": "SLO should not be impacted",
    "description": "n/a",
    "secrets": {
        "honeycomb": {
            "api_key": {
                "type": "env",
                "key": "HONEYCOMB_API_KEY"
            }
        }
    },
    "steady-state-hypothesis": {
        "title": "Use SLO as Steady-State Hypothesis verification",
        "probes": [
            {
                "name": "slo has enough budget left",
                "type": "probe",
                "tolerance": true,
                "provider": {
                    "type": "python",
                    "secrets": ["honeycomb"],
                    "module": "chaoshoneycomb.slo.probes",
                    "func": "slo_has_enough_remaining_budget",
                    "arguments": {
                        "dataset_slug": "ds",
                        "slo_id": "slo1",
                        "min_budget": 7.5
                    }
                }
            }
        ]
    }
}

That’s it!

Please explore the code to see existing probes and actions.

Configuration

Specify the Honeycomb API key either via the secrets block or via the HONEYCOMB_API_KEY environment variable. In that later case, you can in fact skip the declaration on the secrets block as the extension will look for it anyway.

Test

To run the tests for the project execute the following:

$ pdm run test

Formatting and Linting

We use a combination of black, ruff, and isort 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 black code style, sprinkling with tests and submit a PR for review.

To contribute to this project, you will also need to install pdm.

Exported Activities

marker


add_marker

Type action
Module chaoshoneycomb.marker.actions
Name add_marker
Return mapping

Add a marker.

Leave the default "__all__" for dataset_slug to set an environment marker.

Signature:

def add_marker(message: str,
               marker_type: str = 'chaostoolkit-experiment',
               dataset_slug: str = '__all__',
               url: Optional[str] = None,
               configuration: Dict[str, Dict[str, str]] = None,
               secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
message string Yes
marker_type string “chaostoolkit-experiment” No
dataset_slug string all No
url object null No

Usage:

{
  "name": "add-marker",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaoshoneycomb.marker.actions",
    "func": "add_marker",
    "arguments": {
      "message": ""
    }
  }
}
name: add-marker
provider:
  arguments:
    message: ''
  func: add_marker
  module: chaoshoneycomb.marker.actions
  type: python
type: action

query


query_results

Type probe
Module chaoshoneycomb.query.probes
Name query_results
Return mapping

Fetch the results of a query

Signature:

def query_results(dataset_slug: str,
                  query_result_id: str,
                  timeout: int = 30,
                  configuration: Dict[str, Dict[str, str]] = None,
                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
dataset_slug string Yes
query_result_id string Yes
timeout integer 30 No

Usage:

{
  "name": "query-results",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaoshoneycomb.query.probes",
    "func": "query_results",
    "arguments": {
      "dataset_slug": "",
      "query_result_id": ""
    }
  }
}
name: query-results
provider:
  arguments:
    dataset_slug: ''
    query_result_id: ''
  func: query_results
  module: chaoshoneycomb.query.probes
  type: python
type: probe

result_data_must_be_greater_than

Type probe
Module chaoshoneycomb.query.probes
Name result_data_must_be_greater_than
Return boolean

Verifies the value for given property is higher than the given min_value.

To select the most appropriate data, set other_properties to a set of properties and their values.

Signature:

def result_data_must_be_greater_than(
        dataset_slug: str,
        query_result_id: str,
        property_name: str,
        min_value: float,
        other_properties: Optional[Dict[str, Any]] = None,
        timeout: int = 30,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
dataset_slug string Yes
query_result_id string Yes
property_name string Yes
min_value number Yes
other_properties object null No
timeout integer 30 No

Usage:

{
  "name": "result-data-must-be-greater-than",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaoshoneycomb.query.probes",
    "func": "result_data_must_be_greater_than",
    "arguments": {
      "dataset_slug": "",
      "query_result_id": "",
      "property_name": "",
      "min_value": null
    }
  }
}
name: result-data-must-be-greater-than
provider:
  arguments:
    dataset_slug: ''
    min_value: null
    property_name: ''
    query_result_id: ''
  func: result_data_must_be_greater_than
  module: chaoshoneycomb.query.probes
  type: python
type: probe

result_data_must_be_lower_than

Type probe
Module chaoshoneycomb.query.probes
Name result_data_must_be_lower_than
Return boolean

Verifies the value for given property is lower than the given max_value.

To select the most appropriate data, set other_properties to a set of properties and their values.

Signature:

def result_data_must_be_lower_than(
        dataset_slug: str,
        query_result_id: str,
        property_name: str,
        max_value: float,
        other_properties: Optional[Dict[str, Any]] = None,
        timeout: int = 30,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
dataset_slug string Yes
query_result_id string Yes
property_name string Yes
max_value number Yes
other_properties object null No
timeout integer 30 No

Usage:

{
  "name": "result-data-must-be-lower-than",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaoshoneycomb.query.probes",
    "func": "result_data_must_be_lower_than",
    "arguments": {
      "dataset_slug": "",
      "query_result_id": "",
      "property_name": "",
      "max_value": null
    }
  }
}
name: result-data-must-be-lower-than
provider:
  arguments:
    dataset_slug: ''
    max_value: null
    property_name: ''
    query_result_id: ''
  func: result_data_must_be_lower_than
  module: chaoshoneycomb.query.probes
  type: python
type: probe

slo


get_slo

Type probe
Module chaoshoneycomb.slo.probes
Name get_slo
Return mapping

Signature:

def get_slo(dataset_slug: str,
            slo_id: str,
            detailed: bool = True,
            configuration: Dict[str, Dict[str, str]] = None,
            secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
dataset_slug string Yes
slo_id string Yes
detailed boolean true No

Usage:

{
  "name": "get-slo",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaoshoneycomb.slo.probes",
    "func": "get_slo",
    "arguments": {
      "dataset_slug": "",
      "slo_id": ""
    }
  }
}
name: get-slo
provider:
  arguments:
    dataset_slug: ''
    slo_id: ''
  func: get_slo
  module: chaoshoneycomb.slo.probes
  type: python
type: probe

list_burn_alerts

Type probe
Module chaoshoneycomb.slo.probes
Name list_burn_alerts
Return mapping

Signature:

def list_burn_alerts(
        dataset_slug: str,
        slo_id: str,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
dataset_slug string Yes
slo_id string Yes

Usage:

{
  "name": "list-burn-alerts",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaoshoneycomb.slo.probes",
    "func": "list_burn_alerts",
    "arguments": {
      "dataset_slug": "",
      "slo_id": ""
    }
  }
}
name: list-burn-alerts
provider:
  arguments:
    dataset_slug: ''
    slo_id: ''
  func: list_burn_alerts
  module: chaoshoneycomb.slo.probes
  type: python
type: probe

slo_has_enough_remaining_budget

Type probe
Module chaoshoneycomb.slo.probes
Name slo_has_enough_remaining_budget
Return boolean

Signature:

def slo_has_enough_remaining_budget(
        dataset_slug: str,
        slo_id: str,
        min_budget: float = 1.0,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
dataset_slug string Yes
slo_id string Yes
min_budget number 1.0 No

Usage:

{
  "name": "slo-has-enough-remaining-budget",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaoshoneycomb.slo.probes",
    "func": "slo_has_enough_remaining_budget",
    "arguments": {
      "dataset_slug": "",
      "slo_id": ""
    }
  }
}
name: slo-has-enough-remaining-budget
provider:
  arguments:
    dataset_slug: ''
    slo_id: ''
  func: slo_has_enough_remaining_budget
  module: chaoshoneycomb.slo.probes
  type: python
type: probe

trigger


get_trigger

Type probe
Module chaoshoneycomb.trigger.probes
Name get_trigger
Return mapping

Signature:

def get_trigger(dataset_slug: str,
                trigger_id: str,
                configuration: Dict[str, Dict[str, str]] = None,
                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
dataset_slug string Yes
trigger_id string Yes

Usage:

{
  "name": "get-trigger",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaoshoneycomb.trigger.probes",
    "func": "get_trigger",
    "arguments": {
      "dataset_slug": "",
      "trigger_id": ""
    }
  }
}
name: get-trigger
provider:
  arguments:
    dataset_slug: ''
    trigger_id: ''
  func: get_trigger
  module: chaoshoneycomb.trigger.probes
  type: python
type: probe

trigger_is_resolved

Type probe
Module chaoshoneycomb.trigger.probes
Name trigger_is_resolved
Return boolean

Checks that the trigger is in resolved (not “triggered”) state.

Signature:

def trigger_is_resolved(dataset_slug: str,
                        trigger_id: str,
                        configuration: Dict[str, Dict[str, str]] = None,
                        secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
dataset_slug string Yes
trigger_id string Yes

Usage:

{
  "name": "trigger-is-resolved",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaoshoneycomb.trigger.probes",
    "func": "trigger_is_resolved",
    "arguments": {
      "dataset_slug": "",
      "trigger_id": ""
    }
  }
}
name: trigger-is-resolved
provider:
  arguments:
    dataset_slug: ''
    trigger_id: ''
  func: trigger_is_resolved
  module: chaoshoneycomb.trigger.probes
  type: python
type: probe

trigger_is_unresolved

Type probe
Module chaoshoneycomb.trigger.probes
Name trigger_is_unresolved
Return boolean

Checks that the trigger is in unresolved (“triggered”) state.

Signature:

def trigger_is_unresolved(dataset_slug: str,
                          trigger_id: str,
                          configuration: Dict[str, Dict[str, str]] = None,
                          secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
dataset_slug string Yes
trigger_id string Yes

Usage:

{
  "name": "trigger-is-unresolved",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaoshoneycomb.trigger.probes",
    "func": "trigger_is_unresolved",
    "arguments": {
      "dataset_slug": "",
      "trigger_id": ""
    }
  }
}
name: trigger-is-unresolved
provider:
  arguments:
    dataset_slug: ''
    trigger_id: ''
  func: trigger_is_unresolved
  module: chaoshoneycomb.trigger.probes
  type: python
type: probe