> ## Documentation Index
> Fetch the complete documentation index at: https://developer.onetrust.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Metrics Overview

AI Guard exposes an observability pipeline that captures classification activity, redaction actions, agent response times, and user sessions. Metrics flow from the SDK through the AI Guard service to a time-series database or directly to OneTrust AI Governance.

## Pipeline Architecture

```
┌─────────────┐    POST /metric     ┌──────────────┐     Export      ┌─────────────────────┐
│  SDK Client │──────────────────►  │  AI Guard    │───────────────► │  OneTrust AI Gov    │
│  (Python)   │                     │  Service     │                 │  Discovery Platform │
└─────────────┘                     └──────┬───────┘                 └─────────────────────┘
                                           │
                             Auto-generated│
                             classification│
                             counters      │
                                           │
                                    ┌──────▼───────┐     Flush       ┌─────────────────────┐
                                    │  Meters &    │───────────────► │  OTLP Collector     │
                                    │  Aggregation │                 │  (InfluxDB/Grafana) │
                                    └──────────────┘                 └─────────────────────┘
```

### How It Works

1. **SDK submits metrics** — Your application calls `client.metric()` to record agent response times, user sessions, and redaction events
2. **Auto-generated metrics** — The AI Guard service automatically counts classification matches per classifier (the `ai_guard.classification` meter)
3. **Aggregation** — The service aggregates metrics internally using OpenTelemetry instrumentation
4. **Export** — Aggregated metrics are flushed on a configurable interval to either the OneTrust Discovery Platform API or an OpenTelemetry Collector

## What Gets Tracked

| Metric                    | Source                  | What It Measures                                 |
| ------------------------- | ----------------------- | ------------------------------------------------ |
| **Classification counts** | Auto-generated          | How often each classifier detects sensitive data |
| **Redaction events**      | SDK (`client.metric()`) | How often data is redacted or blocked            |
| **Agent response time**   | SDK (`client.metric()`) | LLM agent latency in milliseconds                |
| **User sessions**         | SDK (`client.metric()`) | User interaction and session counts              |

## Data Privacy

> 📘 Important
>
> The metrics pipeline transmits **only aggregated counts and statistics**. Prompts, responses, and classified text content are **never** sent to OneTrust Cloud. The AI Guard service processes all text locally within your infrastructure.

## Agent Identity

In OneTrust AI Governance, a unique AI agent is represented by the combination of `agent_id` + `platform`. These attributes are required on all metrics and are automatically injected by the SDK client.

## Export Modes

AI Guard supports two export modes:

| Mode         | Destination             | Use Case                                                             |
| ------------ | ----------------------- | -------------------------------------------------------------------- |
| **OneTrust** | Discovery Platform API  | Production — metrics feed into AI Governance dashboards              |
| **OTLP**     | OpenTelemetry Collector | Development or custom observability stacks (InfluxDB, Grafana, etc.) |

See [Metrics Exporters](https://developer.onetrust.com/onetrust/docs/ai-guard-exporters) for configuration details.

## What's Next?

* [Meter Definitions](https://developer.onetrust.com/onetrust/docs/ai-guard-meters) — Detailed specifications for each meter
* [Metrics Exporters](https://developer.onetrust.com/onetrust/docs/ai-guard-exporters) — Configure OTLP and OneTrust export modes
* [Observability & Metrics (SDK)](https://developer.onetrust.com/onetrust/docs/ai-guard-metrics) — Send metrics from your application