No project description provided
Project description
๐ต๏ธ Root Cause Analysis for Microservices based on Causal Inference: How Far Are We?
This repository includes artifacts for reuse and reproduction of experimental results presented in our ASE'24 paper titled "Root Cause Analysis for Microservices based on Causal Inference: How Far Are We?".
Table of Contents
- Installation
- How-to-use
- Reproducibility
- Download Datasets
- Download Paper and Supplementary Material
- Licensing
- Acknowledgments
Prerequisites
We recommend using machines equipped with at least 8 cores, 16GB RAM, and ~30GB available disk space with Ubuntu 22.04 and Python3.10 to stably reproduce the experimental results in our paper.
Installation
Detailed installation instructions for all methods can be found in SETUP.md. The default
environment, are used for most methods, can be easily installed as follows. We require Ubuntu and Python 3.10 to reproduce our results stably.
Open your terminal and run the following commands
sudo apt update -y
sudo apt install -y build-essential \
libxml2 libxml2-dev zlib1g-dev \
python3-tk graphviz
Clone RCAEval from GitHub
git clone https://github.com/phamquiluan/RCAEval.git && cd RCAEval
Install RCAEval using pip
pip install pip==20.0.2
pip install -e .[default]
Or, install RCAEval from PyPI
# Install RCAEval from PyPI
pip install RCAEval[default]
How-to-use
Data format
The data must be a pandas.DataFrame
that consists of multivariate time series metrics data. We require the data to have a column named time
that stores the timestep. Each other column stores a time series for metrics data with the name format of <service>_<metric>
. For example, the column cart_cpu
stores the CPU utilization of service cart
. A sample of valid data could be downloaded using the download_data()
method that we will demonstrate shortly below.
Basic usage example
RCAEval stores all the RCA methods in the e2e
module (implemented in RCAEval.e2e
). The basic sample commands to perform root cause analysis using RCAEval are presented as follows,
TBD
Reproducibility
Reproduce RQ1 - Causal Discovery Performance
We provide a script named rq1.py
to assist in reproducing the RQ1 results from our paper. This script can be executed using Python with the following syntax:
python rq1.py [-h] [--dataset] [--method] [--length LENGTH]
The available options and their descriptions are as follows:
options:
-h, --help Show this help message and exit
--dataset Choose a dataset. Valid options:
[circa10, circa50, rcd10, rcd50, causil10, causil50]
--method METHOD Choose a method (e.g. `pc`, `fci`, etc.)
--length LENGTH Specify the length of the time series (used for RQ4)
For example, in Table 3, PC achieves F1, F1-S, and SHD scores of 0.49, 0.65, and 16 on the CIRCA 10 dataset. To reproduce these results, you can run the following commands:
python rq1.py --dataset circa10 --method pc
The expected output should be exactly as presented in the paper (it takes less than 1 minute to run the code)
F1: 0.49
F1-S: 0.65
SHD: 16
Avg speed: 0.08
We can replace the pc method with other methods (e.g., fci, granger) and substitute circa10 with other datasets to replicate the corresponding results shown in Table 3. This reproduction process is also integrated into our Continuous Integration (CI) setup. For more details, refer to the .github/workflows/reproduce-rq1.yml file.
Reproduce RQ2 - Root Cause Analysis Performance
We provide a script named rq2.py
to assist in reproducing the RQ2 results from our paper. This script can be executed using Python with the following syntax:
python rq2.py [-h] [--dataset] [--method] [--tbias TBIAS] [--length LENGTH]
The available options and their descriptions are as follows:
options:
-h, --help Show this help message and exit
--dataset Choose a dataset. Valid options:
[online-boutique, sock-shop-1, sock-shop-2, train-ticket,
circa10, circa50, rcd10, rcd50, causil10, causil50]
--method METHOD Choose a method (e.g. `nsigma`, `baro`, etc.)
--tdelta Specify $t_delta$ to simulate delay in anomaly detection
--length LENGTH Specify the length of the time series (used for RQ4)
For example, in Table 5, BARO [ $t_\Delta = 0$ ] achieves Avg@5 of 0.97, 1, 0.91, 0.98, and 0.67 for CPU, MEM, DISK, DELAY, and LOSS fault types on the Online Boutique dataset. To reproduce these results, you can run the following commands:
python rq2.py --dataset online-boutique --method baro
The expected output should be exactly as presented in the paper (it takes less than 1 minute to run the code)
--- Evaluation results ---
Avg@5-CPU: 0.97
Avg@5-MEM: 1.0
Avg@5-DISK: 0.91
Avg@5-DELAY: 0.98
Avg@5-LOSS: 0.67
---
Avg speed: 0.07
As presented in Table 5, BARO [ $t_\Delta = 60$ ] achieves Avg@5 of 0.94, 0.99, 0.87, 0.99, and 0.6 for CPU, MEM, DISK, DELAY, and LOSS fault types on the Online Boutique dataset. To reproduce these results, you can run the following commands:
python rq2.py --dataset online-boutique --method baro --tdelta 60
The expected output should be exactly as presented in the paper (it takes less than 1 minute to run the code)
--- Evaluation results ---
Avg@5-CPU: 0.94
Avg@5-MEM: 0.99
Avg@5-DISK: 0.87
Avg@5-DELAY: 0.99
Avg@5-LOSS: 0.6
---
Avg speed: 0.07
We can replace the baro method with other methods (e.g., nsigma, fci_randomwalk) and substitute online-boutique with other datasets to replicate the corresponding results shown in Table 5. This reproduction process is also integrated into our Continuous Integration (CI) setup. For more details, refer to the .github/workflows/reproduce-rq2.yml file.
Reproduce RQ3 - Efficiency
The running time of each method is recorded in the scripts of RQ1 and RQ2 as we described and presented above.
Reproduce RQ4 - Data lengths
Our RQ4 relies on the scripts of RQ1 and RQ2 as we described and presented above, with the option --length
.
As presented in Figure 3, BARO maintains stable accuracy on the Online Boutique dataset when we vary the data length from 60 to 600. To reproduce these results, for example, you can run the following Bash script:
for length in 60 120 180 240 300 360 420 480 540 600; do
python rq2.py --dataset online-boutique --method baro --length $length
done
Expected output after running the above code (it takes few minutes)
The output list presents the Avg@5
scores when we vary the data length. You can see that BARO can maintain a stable performance.
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 125/125 [00:08<00:00, 14.64it/s]
--- Evaluation results ---
Avg@5-CPU: 0.84
Avg@5-MEM: 0.98
Avg@5-DISK: 0.94
Avg@5-DELAY: 0.98
Avg@5-LOSS: 0.66
---
Avg speed: 0.07
=== VARY LENGTH: 120 ===
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 125/125 [00:08<00:00, 14.37it/s]
--- Evaluation results ---
Avg@5-CPU: 0.82
Avg@5-MEM: 0.99
Avg@5-DISK: 0.94
Avg@5-DELAY: 0.98
Avg@5-LOSS: 0.66
---
Avg speed: 0.07
=== VARY LENGTH: 180 ===
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 125/125 [00:08<00:00, 14.46it/s]
--- Evaluation results ---
Avg@5-CPU: 0.82
Avg@5-MEM: 0.99
Avg@5-DISK: 0.94
Avg@5-DELAY: 0.98
Avg@5-LOSS: 0.66
---
Avg speed: 0.07
=== VARY LENGTH: 240 ===
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 125/125 [00:08<00:00, 14.47it/s]
--- Evaluation results ---
Avg@5-CPU: 0.82
Avg@5-MEM: 0.99
Avg@5-DISK: 0.94
Avg@5-DELAY: 0.98
Avg@5-LOSS: 0.66
---
Avg speed: 0.07
=== VARY LENGTH: 300 ===
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 125/125 [00:08<00:00, 14.40it/s]
--- Evaluation results ---
Avg@5-CPU: 0.82
Avg@5-MEM: 0.99
Avg@5-DISK: 0.94
Avg@5-DELAY: 0.98
Avg@5-LOSS: 0.66
---
Avg speed: 0.07
=== VARY LENGTH: 360 ===
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 125/125 [00:08<00:00, 14.42it/s]
--- Evaluation results ---
Avg@5-CPU: 0.82
Avg@5-MEM: 0.99
Avg@5-DISK: 0.94
Avg@5-DELAY: 0.98
Avg@5-LOSS: 0.66
---
Avg speed: 0.07
=== VARY LENGTH: 420 ===
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 125/125 [00:08<00:00, 14.53it/s]
--- Evaluation results ---
Avg@5-CPU: 0.82
Avg@5-MEM: 0.99
Avg@5-DISK: 0.94
Avg@5-DELAY: 0.98
Avg@5-LOSS: 0.66
---
Avg speed: 0.07
=== VARY LENGTH: 480 ===
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 125/125 [00:08<00:00, 14.37it/s]
--- Evaluation results ---
Avg@5-CPU: 0.82
Avg@5-MEM: 0.99
Avg@5-DISK: 0.94
Avg@5-DELAY: 0.98
Avg@5-LOSS: 0.66
---
Avg speed: 0.07
=== VARY LENGTH: 540 ===
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 125/125 [00:08<00:00, 14.50it/s]
--- Evaluation results ---
Avg@5-CPU: 0.82
Avg@5-MEM: 0.99
Avg@5-DISK: 0.94
Avg@5-DELAY: 0.98
Avg@5-LOSS: 0.66
---
Avg speed: 0.07
=== VARY LENGTH: 600 ===
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 125/125 [00:08<00:00, 14.49it/s]
--- Evaluation results ---
Avg@5-CPU: 0.82
Avg@5-MEM: 0.99
Avg@5-DISK: 0.94
Avg@5-DELAY: 0.98
Avg@5-LOSS: 0.66
---
Avg speed: 0.07
Download Datasets
Our datasets and their description are publicly available in Zenodo repository with the following information:
- Dataset DOI:
- Dataset URL: https://zenodo.org/records/13305663
We also provide utility functions to download our datasets using Python. The downloaded datasets will be available at directory data
.
from RCAEval.utility import (
download_syn_rcd_dataset,
download_syn_circa_dataset,
download_syn_causil_dataset,
download_rca_circa_dataset,
download_rca_rcd_dataset,
download_online_boutique_dataset,
download_sock_shop_1_dataset,
download_sock_shop_2_dataset,
download_train_ticket_dataset,
)
download_syn_rcd_dataset()
download_syn_circa_dataset()
download_syn_causil_dataset()
download_rca_circa_dataset()
download_rca_rcd_dataset()
download_online_boutique_dataset()
download_sock_shop_1_dataset()
download_sock_shop_2_dataset()
download_train_ticket_dataset()
Expected output after running the above code (it takes few minutes to download our datasets)
$ python test.py
Downloading syn_rcd.zip..: 100%|โโโโโโโโโโ| 11.2M/11.2M [00:03<00:00, 3.56MiB/s]
Downloading syn_circa.zip..: 100%|โโโโโโโโ| 52.5M/52.5M [00:06<00:00, 7.51MiB/s]
Downloading syn_causil.zip..: 100%|โโโโโโโ| 73.8M/73.8M [00:09<00:00, 8.05MiB/s]
Downloading rca_circa.zip..: 100%|โโโโโโโโ| 52.7M/52.7M [00:06<00:00, 7.95MiB/s]
Downloading rca_rcd.zip..: 100%|โโโโโโโโโโ| 22.7M/22.7M [00:04<00:00, 5.16MiB/s]
Downloading online-boutique.zip..: 100%|โโ| 31.0M/31.0M [00:04<00:00, 6.49MiB/s]
Downloading sock-shop-1.zip..: 100%|โโโโโโ| 3.54M/3.54M [00:02<00:00, 1.68MiB/s]
Downloading sock-shop-2.zip..: 100%|โโโโโโ| 79.1M/79.1M [00:09<00:00, 8.38MiB/s]
Downloading train-ticket.zip..: 100%|โโโโโโโ| 280M/280M [00:27<00:00, 10.1MiB/s]
Download Paper and Supplementary Material
- Our paper can be downloaded at docs/ase-paper.pdf
- Our supplementary material can be downloaded at docs/ase-paper-supplementary-material.pdf
Licensing
This repository includes code from various sources with different licenses. We have included their corresponding LICENSE into the LICENSES directory:
- CIRCA: Licensed under the BSD 3-Clause License. Original source: CIRCA GitHub Repository.
- RCD: Licensed under the MIT License. Original source: RCD GitHub Repository.
- E-Diagnosis: Licensed under the BSD 3-Clause License. Original source: PyRCA GitHub Repository.
- CausalAI: Licensed under the BSD 3-Clause License. Original source: CausalAI GitHub Repository.
- MicroCause: Licensed under the BSD 3-Clause License. Original source: MicroCause GitHub Repository.
For the code implemented by us and for our datasets, we distribute them under the MIT LICENSE.
Acknowledgments
We would like to express our sincere gratitude to the researchers and developers who created the baselines used in our study. Their work has been instrumental in making this project possible. We deeply appreciate the time, effort, and expertise that have gone into developing and maintaining these resources. This project would not have been feasible without their contributions.
Contact
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file RCAEval-0.0.11-py3-none-any.whl
.
File metadata
- Download URL: RCAEval-0.0.11-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bea5346ea28647d21572cb636da083802e5c0213bba67812e5ab7213055a270c |
|
MD5 | 5973775f7b1ad903952e71be3b14c7a4 |
|
BLAKE2b-256 | aa2d4b970fafec25804608b86263cea9af8d7a9d52240e69f75cda0a6a1599c2 |