> For the complete documentation index, see [llms.txt](https://docs.turium.ai/home/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.turium.ai/home/algoreus/turium-connector-documentation/turium-fabriq-overview/how-to-guides/cerebellum-operations-and-monitoring-user-guide/metrics.md).

# Metrics

* [System metrics](#system-metrics)
* [Flow Control](#flow-control)
* [Rejected requests](#rejected-requests)

When building applications with Algoreus, you have the ability to incorporate metrics to monitor the behavior and performance of your application. Algoreus Cerebellum provides both system metrics and user-defined metrics.

***

### System metrics  <a href="#system-metrics" id="system-metrics"></a>

They are pre-defined and common across applications. They include metrics such as event processing count and data operation count. On the other hand, user-defined metrics are specific to your application and can be added to track custom aspects of your application.

Algoreus supports two types of metrics: count and gauge.

* Count metrics allow you to increment or decrement a metric by a specified value:

  `count(metricName, delta)`
* Gauge metrics enable you to set the metric to a specific value:

  `gauge(metricName, value)`

You can emit these metrics within the methods that define the components of your application. The emitted metrics can be retrieved using Algoreus Cerebellum, alongside the system metrics. Ensure that your metric names consist only of alphanumeric characters.

To prevent overloading the system under high load, Algoreus provides an option to enable or disable metrics using the `app.program.metrics.enabled` parameter. By default, program metrics are enabled (`true`). This option can be configured at different levels:

1. System-wide: In the configuration file, you can control whether application nodes emit metrics.
2. Per run: You can override the system-wide setting by using the `config system.metrics.enabled` as a program argument during a specific run.
3. Program preference: To establish a permanent preference, you can set `system.metrics.enabled` for a specific program.

***

### Flow Control <a href="#flow-control" id="flow-control"></a>

Algoreus includes a flow control mechanism to prevent an excessive number of requests, which could lead to issues with axon runs. This mechanism applies to start requests for various types of axons and jobs.

Flow control relies on two thresholds:

1. Launch threshold: This threshold limits the number of launch requests. If the number of launch requests that are not yet in the running state exceeds the launch threshold, new requests will be rejected.
2. Runs threshold: This threshold limits the number of outstanding launch requests in the system. If the number of outstanding launch requests that have not yet finished exceeds the runs threshold, new requests will be rejected.

### Rejected requests <a href="#rejected-requests" id="rejected-requests"></a>

When either threshold is reached, new start requests will be rejected. For example, a rejected batch axon will be logged as "Rejected" status, and a notification will be displayed in the user interface explaining the rejection.

Metrics: To monitor the flow control status, you can access the following metrics:

* Launching metric: This metric reports the number of launch requests in the system that are in the provisioning or starting states.

  `Metrics name: flowcontrol.launching.count POST /v3/metrics/query?metric=system.flowcontrol.launching.count`
* Running metric: This metric reports the number of running axons and jobs in the system. The run threshold is based on the sum of the launching and running metrics.

  `Metrics name: flowcontrol.running.count POST /v3/metrics/query?metric=system.flowcontrol.running.count`
* Rejected metric: This metric reports the number of rejected runs due to the flow control mechanism.

  `Metrics name: program.rejected.runs POST /v3/metrics/query?metric=system.program.rejected.runs`

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.turium.ai/home/algoreus/turium-connector-documentation/turium-fabriq-overview/how-to-guides/cerebellum-operations-and-monitoring-user-guide/metrics.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
