/chaos-appservices

This repository is meant to share my chaos engineering experiments to achieve knowledge in designing resilient systems.

Primary LanguageC#MIT LicenseMIT

Choas App Services

This repository is meant to share my chaos engineering experiments to achieve knowledge in designing resilient systems.

For now it's available just a Function App in which latency and fault chaos policy are injected. This App Service is based on Simmy in turn based on Polly.

Dependencies

  • .NET Core 3.1 or higher

Configure

Just edit local.settings.json for local execution:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "APPINSIGHTS_INSTRUMENTATIONKEY": "test_debug",
    // Latency
    "ChaosLatencySeconds": 5,
    "ChaosLatencyInjectionRate": 0.1,
    "ChaosLatencyEnabled": true,
    // Fault
    "ChaosFaultInjectionRate": 0.05,
    "ChaosFaultEnabled": true
  }
}

On Azure add all configuration settings present in local.settings.json prefixed with Chaos.

Execute

Function App

Open Visual Studio and point your web browser to http://localhost:7071/api/ProductsFunction.

The project is configured to use Application Insights locally:

Chaos Trigger AI Screenshot

Console App

A sample console app is provided to demonstrate access to Application Insights using the REST API. It reads only trace events. The submitted KQL query is:

traces | where timestamp <= ago(1h) | limit 50

You need to configure appsettings.json with your AI Application ID and API key.

{
    "httpTimeout": 10000,
    "aiApplicationId": "{your_app_insights_app_id}",
    "aiApiKey": "{your_api_key}",
    "timesAgo": "1h"
}

AI API Access

Just create an API key and set it along with Application ID in the configuration file. The application will write to standard output the returned JSON.

Libraries