Metrics Exporters

AI Guard supports two exporter types for shipping metrics data. The OneTrust exporter sends pre-aggregated metrics directly to the OneTrust Discovery Platform API. The OTLP exporter sends standard OpenTelemetry data points to a collector over gRPC.

OneTrust Exporter (Production)

The OneTrust exporter transforms OpenTelemetry ResourceMetrics into the OneTrust ObservabilityMetricsRequest format and POSTs them to the Discovery Platform API. This is the default exporter for production Workernode deployments.

Configuration

metrics:
  exporter:
    type: onetrust
    collector-endpoint: "${DATADISCOVERY_ONPREM_AGENT_URI:-http://datadiscovery-onprem-agent:8080}"
    interval: ${METRICS_EXPORT_INTERVAL:-hour}
    initial-backoff: 0.15
    max-retry-duration: 30.0
    trusted-root-path: ${METRICS_ENDPOINT_TRUSTED_ROOT_PATH:-}
    trusted-root-address: ${METRICS_ENDPOINT_TRUSTED_ROOT_ADDRESS:-}

Configuration Fields

FieldEnv VarDefaultDescription
collector-endpointDATADISCOVERY_ONPREM_AGENT_URIhttp://datadiscovery-onprem-agent:8080Base URL of the Discovery Platform. POSTs to {endpoint}/api/discovery-platform/v1/send-async
intervalMETRICS_EXPORT_INTERVALhourAggregation window. Currently only hour is supported (3600s)
initial-backoffβ€”0.15Seconds before the first retry on failure (exponential backoff)
max-retry-durationβ€”30.0Maximum total seconds spent retrying before dropping the export
trusted-root-pathMETRICS_ENDPOINT_TRUSTED_ROOT_PATHβ€”Optional. PEM CA certificate for the endpoint
trusted-root-addressMETRICS_ENDPOINT_TRUSTED_ROOT_ADDRESSβ€”Optional. Override host:port for the endpoint

Data Transform

The exporter transforms OpenTelemetry data into the OneTrust format. The transform behavior depends on the meter type:

Counters

Each counter data point produces a single entry with statistic: COUNT and the delta count as the value.

Applies to: ai_guard.redact, ai_guard.classification, ai_guard.user

Histograms

Each histogram data point produces up to four entries with pre-computed statistics:

StatisticValue
AVGsum / count
MINMinimum recorded value in the interval
MAXMaximum recorded value in the interval
P9999th percentile, interpolated from histogram bucket boundaries

Applies to: ai_guard.agent

Request Format

Each export sends a single JSON POST to {collector-endpoint}/api/discovery-platform/v1/send-async:

{
  "requestType": "OBSERVABILITY_METRICS",
  "source": "AI_OBSERVABILITY",
  "observabilityMetrics": [
    {
      "resourceType": "AGENT",
      "uniqueIdentifier": "my-agent",
      "metricsKey": "ai_guard.redact",
      "metricsValue": 42,
      "aggregatedDuration": 3600,
      "statistic": "COUNT",
      "source": "AI_GUARD",
      "platform": "AMAZON_BEDROCK",
      "startTime": "2026-03-07T00:00:00Z",
      "additionalAttributes": "{\"action\":\"redact\",\"actor\":\"user\"}"
    }
  ],
  "evaluationJobMetricsDetails": []
}
FieldDescription
resourceTypeAlways "AGENT"
uniqueIdentifierThe agent_id attribute from the metric
metricsKeyThe meter name (e.g., ai_guard.redact)
metricsValueThe numeric value
aggregatedDurationExport interval in seconds (3600)
statisticCOUNT, AVG, MIN, MAX, or P99
platformThe platform attribute mapped to AIPlatform enum
startTimeISO 8601 timestamp of the interval start
additionalAttributesJSON string of remaining attributes

Retry Behavior

On a failed POST, the client retries with exponential backoff:

  1. Wait initial-backoff seconds (default: 0.15s)
  2. Double the wait time on each subsequent attempt
  3. Stop after max-retry-duration seconds total (default: 30s)
  4. If all retries are exhausted, the export is dropped and an error is logged

OTLP Exporter (Development / Custom)

The OTLP exporter sends standard OpenTelemetry data points over gRPC to a collector. A PeriodicReader flushes accumulated data on the configured interval.

Configuration

metrics:
  exporter:
    type: otlp
    collector-endpoint: "http://${OTEL_GRPC_HOST}:${OTEL_GRPC_PORT}"
    collector-token-path: "${COLLECTOR_TOKEN_PATH}"
    interval: ${OTEL_EXPORT_INTERVAL:-3600}
    temporality: cumulative

Configuration Fields

FieldDescription
collector-endpointgRPC endpoint URL of the OpenTelemetry Collector
collector-token-pathPath to a file containing the Bearer token for collector authentication
intervalExport interval in seconds
temporalityAggregation temporality: cumulative or delta

Temporality

ModeBehaviorDownstream
CumulativeEach data point is a running total from process startConsumers derive per-interval values by diffing consecutive exports
DeltaEach data point covers only the current intervalValues can be used directly without diffing

Cumulative notes:

  • A counter reset (service restart) is detected when start_time changes or the value decreases
  • The consumer starts a new accumulation rather than diffing across the reset boundary

Delta notes:

  • Values reset to zero at the start of each interval
  • No reset detection needed downstream

Disabling Metrics

If the metrics section is omitted from the configuration file, metrics collection is disabled entirely. The service will not register any meters, and POST /metric requests will return 400 Bad Request.

What's Next?