# Real Time Transaction Monitoring

## Overview

The Risk Rule Evaluation Service provides the ability to evaluate transaction in real-time using a REST API. Whenever a workflow is [deployed](/risk/workflows.md#deploy-workflow), the Canso platform automatically packages all rules in the workflow and spins up the application. This application runs on the data plane i.e. the customer's Kubernetes cluster. The Canso Developer Agent automates the process of deploying the application and any related infra dependencies.

Once deployed, this application starts accepting requests to evaluate incoming transactions against eligible workflows rules defined as part of the [Workflow](/risk/workflows.md#create-workflow). The application is capable of supporting a double-digit millisecond latency (P99 of <100 ms) in most cases and can autoscale by itself within the limits set at the time of deployment.

The Txn. Monitoring & Evalution app can be configured such that it integrates with Online Feature stores to retrieve feature values.

## Prerequisites

To interact with the Risk Evaluation API, ensure you have the following:

1. **Ingress Host and Path**:
   * Identify the ingress host and path for your service.
     * **Ingress Host**: You can find the ingress host by running the following command on your Kubernetes cluster:

       ```bash
       kubectl get ingress -n <namespace> -o yaml
       ```

       Look for the `HOSTS` column to find the appropriate ingress host.
     * **Ingress Path**: Ensure you also note the `PATH` associated with your service in the ingress output.
   * Replace `{YOUR_INGRESS_HOST}` and `{YOUR_INGRESS_PATH}` in your API calls with the values retrieved from the above command.
2. **Authentication**: Basic Authentication is required. Use your Canso credentials:
   * **Authorization Header**: `Authorization: Basic {BASE64_ENCODED_CREDENTIALS}`

## How Rule Evaluation Works

1. **Rule Retrieval**: Fetch active/eligible rules for the specified workflow
2. **Feature Lookups**: Retrieve machine learning feature values from the online feature store
3. **Parallel Evaluation**: Parallel Evaluation of rules in a workflow for better performance

## Monitoring

The service exports the following metrics to Prometheus by default.

* `rule_evaluation_latency_seconds_count`
* `rule_evaluation_requests_total`

Prometheus is automatically set up in the Data plane i.e. customer's cluster when the Canso Superchart is installed. Refer to [🚢 Install Canso Helm Charts](/getting-started/canso-helm-charts.md) for more details.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.canso.ai/risk/txn-evaluation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
