> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-delivery/use-gitops/gitops-entities/agents/view-gitops-agent-metrics-in-harness.md).

# View GitOps Agent metrics in Harness

View GitOps Agent metrics for CPU, memory, and latency on the Metrics tab in Harness, and use them to decide when to scale.

{% hint style="info" %}
This feature is in Beta[^1] and requires enablement. [View all early access features.](https://developer.harness.io/release-notes/features.md)

{% @harness-feature-flag-access/request-feature-flag-access module="continuous-delivery" pagePath="continuous-delivery/use-gitops/gitops-entities/agents/view-gitops-agent-metrics-in-harness" pageTitle="View%20GitOps%20Agent%20metrics%20in%20Harness" featureFlags="%5B%7B%22name%22%3A%22GitOps%20Agent%20metrics%20in%20Harness%22%2C%22key%22%3A%22CDS\_GITOPS\_AGENT\_METRICS\_ENABLED%22%2C%22status%22%3A%22BETA%22%2C%22description%22%3A%22Enables%20the%20GitOps%20Agent%20to%20report%20process%20metrics%20to%20Harness%20and%20shows%20them%20on%20the%20Metrics%20tab%20of%20Agent%20Details.%22%7D%5D" %}
{% endhint %}

The GitOps Agent runs on your infrastructure and sends a small snapshot of its own process metrics to Harness. Harness displays these metrics for all four GitOps Agent components on the **Metrics** tab of the agent, so you can check whether an agent is under pressure, decide when to scale a component, and compare the agent with itself from the same time last week. Harness AI and Harness Support read the same data, so Support can review agent load without access to your cluster.

You can also scrape the full set of agent metrics with Prometheus. This topic covers the Harness UI method. Go to [GitOps Agent metrics with Prometheus](https://developer.harness.io/continuous-delivery/use-gitops/gitops-entities/agents/gitops-agent-metrics.md) to use the Prometheus method.

The snapshot is built from the same metrics that the agent exposes on port `2112`, so the scrape endpoint is unchanged. Sending metrics is a best effort and runs separately from GitOps tasks, reconciliation, and agent health. If Harness is unreachable, the agent keeps working and tries again at the next interval.

## What you will learn from this topic <a href="#what-you-will-learn-from-this-topic" id="what-you-will-learn-from-this-topic"></a>

* How the agent reports [metrics to Harness](#metrics-and-reporting-behavior), and how often.
* How to [access the Metrics tab](#access-the-metrics-tab) at project, organization, and account scope.
* How to use the [tab controls](#metrics-tab-controls) and read the [tab sections](#metrics-tab-sections).
* How to [use the metrics to scale the agent](#use-the-metrics-to-scale-the-agent) and [ask Harness AI](#ask-harness-ai-about-agent-metrics) about them.
* The [permissions](#permissions) required and how long Harness [retains the data](#data-retention).

## Before you begin <a href="#before-you-begin" id="before-you-begin"></a>

Before you begin, make sure you have the following:

* **GitOps Agent version**: To view metrics on the **Metrics** tab in Harness, the agent must run version 0.129.1 or later. You can find the agent version in the **Version** field on the **Agent Details** tab.
* **Latest Helm chart**: To see Application Controller metrics on the **Metrics** tab, install or upgrade the agent with the latest [GitOps Agent Helm chart](https://github.com/harness/gitops-helm).
* **Permissions**: You need the `gitops_agent_view` permission for the agent. Go to [Permissions](#permissions) for details.

## Metrics and reporting behavior

The metrics on the tab are aggregated from the agent's Prometheus registry. The agent sends a fixed, Harness-managed list of metrics, such as process CPU, process memory, and latency for tasks, reconciliation, and HTTP requests. The agent downloads this list from Harness and sends nothing until it has it. Because the list is managed by Harness, updates do not require an agent upgrade, restart, or Helm change.

Each metric is reported for the entire component. The agent combines all label sets of a metric, so you do not see per-application or per-task breakdowns. Single-value metrics, such as Prometheus gauges and counters, are reported as they are. For example, CPU is reported as a percentage of one core, and memory is the resident memory of the agent process, not the pod. Histogram metrics, such as latency, are aggregated over a five-minute window and report the 50th, 95th, and 99th percentiles, plus a count and a sum.

The agent reports metrics every minute.

## Access the Metrics tab

Perform the following steps to view the metrics for an agent:

1. Go to **Project Settings**, **Organization Settings**, or **Account Settings** -> **GitOps Agents**, depending on the scope of your agent.
2. Select your agent, then select the **Metrics** tab.

![Metrics tab of a GitOps Agent](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-799919a29d3eb5378149e49897ead93d7b5d8857%2Fgitops-agent-metrics-tab.png?alt=media)

## Metrics tab controls

Use the controls at the top of the tab to change what you see:

* **Components**: Select the components to show. The dropdown lists **GitOps Agent**, **Repo Server**, **Application Controller**, and **ApplicationSet Controller**. All four are selected by default, and the badge shows how many are selected.
* **Refresh interval**: Select how often the page reloads the data. The default is **Off**. The options are **Off**, **30s**, **1m**, **5m**, **15m**, and **30m**.
* **Time range**: Select a preset such as **Yesterday** or **Past week**, or pick start and end dates and times on the calendar. The default is **Last 24 hours**.

On the right side of the controls, the tab shows when the agent **Started** and when it last **Reported**, for example, "Started 19 minutes ago" and "Reported a minute ago". Use these values to confirm that the agent is sending metrics.

Harness keeps 14 days of history, so choose a range of up to one week to compare the current load with the same time last week.

## Metrics tab sections

The tab has a **Live** section followed by one section for each selected component.

The **Live** section shows the current CPU and memory for each selected component as value cards by default. To change the metrics shown in this section, click the eye icon on a chart to show or hide the card with its current value.

Each component section shows charts for the selected time range. Latency charts include a percentile dropdown with **p50**, **p95**, and **p99**. The default is **p99**. A chart displays **No Data** when no metrics are available for the selected time range.

The following table lists the metrics that each component section shows.

| Component                     | Metrics                                                                                                                                                             |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **GitOps Agent**              | CPU, Memory, Task execution, Task Receiver Channel Blocked Time, Task Response Sender Channel Blocked Time, Task Complete Processing Time, Reconciler, HTTP request |
| **Repo Server**               | CPU, Memory, Git request                                                                                                                                            |
| **Application Controller**    | CPU, Memory, App reconcile, Workqueue depth                                                                                                                         |
| **ApplicationSet Controller** | CPU, Memory                                                                                                                                                         |

{% hint style="info" %}
**Stale or missing metrics**

An agent that has never reported and an agent on a version earlier than 0.129.1 show no data instead of an error.
{% endhint %}

## Use the metrics to scale the agent

Watch the latency charts of the **GitOps Agent** component for spikes. The task charts show where a task spends its time within the agent, so they indicate which worker pool to scale. For example, a spike in **Task Response Sender Channel Blocked Time** means that completed tasks wait to send results to Harness, so you can increase `GITOPS_AGENT_NUM_RESPONDERS`.

Go to [Task metrics](https://developer.harness.io/continuous-delivery/use-gitops/gitops-entities/agents/gitops-agent-metrics.md#useful-information-about-task-metrics) to review how the task metrics relate to each other and to the worker pools. Go to [Performance considerations](https://developer.harness.io/continuous-delivery/use-gitops/gitops-entities/agents/agent-argocd-performance.md) to review scaling guidance for the Application Controller and Repo Server.

## Ask Harness AI about agent metrics

Harness AI is aware of the agent metrics through a Model Context Protocol (MCP) tool. In the Harness AI chat, ask about an agent, for example, whether its metrics look healthy. Harness AI reads the metrics, summarizes resource usage, flags high latency, and tells you whether you should scale and which component to scale.

## Permissions

You need the `gitops_agent_view` permission for the agent to view its metrics. No new permission is required.

## Data retention

Harness keeps the latest values and 14 days of history for each agent. If an agent stops reporting, the latest values are shown as stale, and history ages out after 14 days.

## Next steps <a href="#next-steps" id="next-steps"></a>

* [GitOps Agent metrics with Prometheus](https://developer.harness.io/continuous-delivery/use-gitops/gitops-entities/agents/gitops-agent-metrics.md): Expose and scrape the agent metrics endpoint with Prometheus, and review the full list of available metrics.
* [Performance considerations](https://developer.harness.io/continuous-delivery/use-gitops/gitops-entities/agents/agent-argocd-performance.md): Review scaling guidance for the Application Controller and Repo Server.

{% @harness-feedback/feedback %}

[^1]: Off by default. If you want to try it and share feedback, request access and Harness will turn it on for your account. Beta features can change and may not be ready for production use.
