Giter Club home page Giter Club logo

chaostoolkit-dynatrace's Introduction

Chaos Toolkit extension for Dynatrace

Release

Dynatrace support for the Chaos Toolkit.

Install

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

$ pip install chaostoolkit-dynatrace

Usage

To use this package, you must have access to a Dynatrace instance via DynatraceApi and be allowed to connect to it.

the access credentials to the api must be specified in the configuration section

{

    "configuration": {
        "dynatrace_base_url": "https://{your-environment-id}.live.dynatrace.com"
    },
    "secrets": {
        "dynatrace": {
            "token": "..."
        }
    }
}

Here is an example of how to get the failure rate of a service in Dynatrace. for this example, the api for validate de failure rate is Metric-v1

{
    "type": "probe",
    "name": "get-failure-rate-services",
    "provider": {
        "type": "python",
        "module": "chaosdynatrace.timeseries.v1.probes",
        "func": "failure_rate",
        "secrets": ["dynatrace"],
        "arguments": {
            "entity": "SERVICE-665B05BC92550119",
            "relative_time": "30mins",
            "failed_percentage": 1
        }
    }
}

The probe returns true if the api request failure percentage is less than the failed_percentage value or return false.

The extension also exports a control to send events to Dynatrace. For instance:

{
    "controls": [
        {
            "name": "dynatrace",
            "provider": {
                "type": "python",
                "secrets": ["dynatrace"],
                "module": "chaosdynatrace.events.v2.control"
            }
        }
    ]
}

This will send start/stop logs of the experiment events.

You can correlate them to traces using the Open Telemetry extension.

{
    "configuration": {
        "dynatrace_base_url": "https://{your-environment-id}.live.dynatrace.com",
        "tracing_provider": "opentelemetry",
        "tracing_opentelemetry_exporter": "oltp-http",
        "tracing_opentelemetry_collector_endpoint": "https://{your-environment-id}.live.dynatrace.com/api/v2/otlp/v1/traces",
        "tracing_opentelemetry_collector_headers": {
            "Authorization": "Api-Token <TOKEN>"
        }
    },
    "controls": [
        {
            "name": "opentracing",
            "provider": {
                "type": "python",
                "module": "chaostracing.control"
            }
        }
    ]

The logs and traces will be automatically correlated.

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.

Develop

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt 

Then, point your environment to this directory:

$ pip install -e .

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

Test

To run the tests for the project execute the following:

$ pytest

chaostoolkit-dynatrace's People

Contributors

lawouach avatar luismenco avatar mperrien avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

luismenco

chaostoolkit-dynatrace's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.