elsa-workflows / elsa-workflows/elsa-studio

Enhancement Proposal: Workflow Execution Statistics

Open
#187 3 comments 1 reaction 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
301
Forks
181
Avg merge
17h 12m
Merged PRs (30d)
42

Description

**Overview**
To further enhance the functionality of **Elsa.Studio**, we propose implementing a service that calculates various statistics for individual workflow definitions or multiple workflow definitions. At Nuvotex GmbH, we actively utilize this functionality to assess the health of our workflows.

**Problem Statement**
Currently, assessing the health of a specific workflow definition can be challenging, especially when it is executed frequently. The existing method of relying solely on the instances page is time-consuming and inefficient. Additionally, as the number of executions grows, the instances page becomes cluttered, making it difficult to identify relevant information. Furthermore, determining whether the number of faults is a cause for concern remains problematic. For instance, having 55 faults might be acceptable if the overall success rate remains above 96%. However, this assessment is currently cumbersome.

**Proposed Solution**
We propose creating a service that analyzes all workflow instances within a specified time frame (e.g., the last X days) for each defined workflow. The service would aggregate relevant data and provide insights into the health and performance of workflow definitions. Specifically, the following information would be stored for each workflow definition:

1. **WorkflowDefinitionSummary**: An overview of key details related to the workflow definition.
2. Lists of **WorkflowInstanceSummary**:
- **Finished:** Instances that completed successfully.
- **Faulted:** Instances that encountered errors.
- **Executing:** Instances currently in progress.
- And other relevant categories.

By implementing this feature, users would gain immediate visibility into their workflow definitions’ performance, allowing for better decision-making and proactive maintenance.

To calculate success rates and fault percentages, consider the following formulas:

**Success rate:**
`if (TotalRuns == 0)
{
return 1;
}
return (double)(TotalRuns - TotalFaults) / TotalRuns;
`

**Fault rate:**
`if (TotalRuns == 0)
{
return 0;
}
return (double)TotalFaults / TotalRuns;
`
etc.

Subsequently, these statistics can be incorporated into the workflow definition row by introducing a new column labeled ‘Health’.
![image](https://github.com/elsa-workflows/elsa-studio/assets/159041713/ea112d25-7c92-4a6c-9c05-4e2c62fe2661)
The green chip displays the success rate as a percentage over the **past X days**. By default, we set this value to **3**, with a maximum allowable range of **60 days**.

![image](https://github.com/elsa-workflows/elsa-studio/assets/159041713/f479b3b3-a8f2-4e30-99e0-3e8b9f075e7e)
The red chip corresponds to the count of faults observed over the past X days. In this specific instance, we encountered 55 faults, which, within our context, is deemed acceptable.

![image](https://github.com/elsa-workflows/elsa-studio/assets/159041713/876331b6-b6bb-45c8-9599-c97251bd13d8)
We dynamically adjust the color of the success rate chip based on its percentage. Currently, this is hard-coded to align with our internal quality assurance criteria.

![image](https://github.com/elsa-workflows/elsa-studio/assets/159041713/98951cae-a89f-4830-90cf-d7549874b52a)
Moreover, by centralizing the instances within a stats object, we gain the ability to swiftly identify which instances have encountered faults. When users click on the chip displaying the fault count, a new dialog opens, providing access to the specific faults. These can be viewed either in a new tab or within the current one by clicking on the corresponding row.

These features prove invaluable for our team, especially considering the multitude of workflows that are continually executed. Ensuring everything functions as intended remains a top priority.

Should you wish to incorporate these enhancements into the base version of **Elsa.Studio**, we’d be delighted to share our code. Currently, these features are implemented in **Elsa.Studio** rather than **Elsa.Core**. For our specific use case, the client-side execution of the code has proven to be sufficiently fast.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.