# Phase 7: Observability (Optional)

> This phase installs the optional observability operators and configuration.

---

LLMS index: [llms.txt](/CAI-Field-Manual-Library/llms.txt)

---

> [!NOTE]
> In Red Hat OpenShift AI 3.5, the monitoring stack uses the Cluster Observability Operator (COO) and its MonitoringStack CR for metrics collection. User Workload Monitoring (UWM) is no longer required. The RHOAI operator creates its own ServiceMonitors with `monitoring.opendatahub.io/scrape` labels that the COO-managed Prometheus scrapes.

This phase installs the **optional** observability operators and configuration:

1. **Tempo Operator** - provides the `TempoStack` CRD that the RHOAI operator's Monitoring controller requires for distributed tracing. Without this operator, the Monitoring CR cannot provision tracing infrastructure.

2. **Red Hat build of OpenTelemetry Operator** - provides the `OpenTelemetryCollector` CRD that the RHOAI operator's Monitoring controller requires. Without this operator, the Monitoring CR fails with: *"OpenTelemetryCollector operator must be installed for OpenTelemetry configuration"*. This blocks the full observability chain: MonitoringStack, ThanosQuerier, Perses, and PrometheusDatasource.

3. **Cluster Observability Operator (COO)** - required for the Observability Dashboard tab in the Red Hat OpenShift AI UI. COO provides the Perses CRDs (`Perses`, `PersesDatasource`, `PersesDashboard`) that the RHOAI operator uses to deploy the dashboard backend.

4. **Gateway Telemetry** (auto-created) - the RHOAI operator auto-creates a TelemetryPolicy and Istio Telemetry CR when telemetry is enabled on the MaasTenantConfig (3.5) or Tenant (3.4). These add per-model, per-subscription, and per-organization labels to gateway metrics for usage attribution.

5. **Loki Operator + Usage Dashboards** (RHOAI 3.5+ only) - log-based per-request usage tracking. The gateway emits structured OTLP access logs with token counts, user identity, and subscription info. Logs are shipped to a LokiStack via an OpenTelemetry Collector. The RHOAI console shows admin and user-scoped usage dashboards under **Observe & monitor**.

> [!TIP]
> All file paths and `oc apply` commands in this guide are relative to the [CAI-Field-Manual-MaaS](https://github.com/rh-aiservices-bu/CAI-Field-Manual-MaaS) repository root. Make sure you have cloned it and are working from its root directory (see [Getting Started](/CAI-Field-Manual-Library/maas/#getting-started)).

> [!IMPORTANT]
> This guide is not a replacement for the official Red Hat OpenShift AI Models as a Service documentation ([3.5](https://docs.redhat.com/en/documentation/red_hat_openshift_ai_self-managed/3.5/html/govern_llm_access_with_models-as-a-service/index) | [3.4](https://docs.redhat.com/en/documentation/red_hat_openshift_ai_self-managed/3.4/html/govern_llm_access_with_models-as-a-service/index)). It is a companion resource with opinionated Kustomize manifests and automation scripts to accelerate deployment.

## Step 1: Install the Tempo Operator

```sh
oc apply -k manifests/07-observability/tempo/
```

Wait for the operator CSV to reach `Succeeded`:

```sh
oc wait csv -n openshift-tempo-operator \
  -l operators.coreos.com/tempo-product.openshift-tempo-operator="" \
  --for=jsonpath='{.status.phase}'=Succeeded --timeout=300s
```

## Step 2: Install the Red Hat build of OpenTelemetry Operator

```sh
oc apply -k manifests/07-observability/opentelemetry/
```

Wait for the operator CSV to reach `Succeeded`:

```sh
oc wait csv -n openshift-opentelemetry-operator \
  -l operators.coreos.com/opentelemetry-product.openshift-opentelemetry-operator="" \
  --for=jsonpath='{.status.phase}'=Succeeded --timeout=300s
```

## Step 3: Install the Cluster Observability Operator

```sh
oc apply -k manifests/07-observability/coo/
```

Wait for the operator CSV to reach `Succeeded`:

```sh
oc wait csv -n openshift-cluster-observability-operator \
  -l operators.coreos.com/cluster-observability-operator.openshift-cluster-observability="" \
  --for=jsonpath='{.status.phase}'=Succeeded --timeout=300s
```

## Step 4: Enable DSCI Monitoring

Now that all three observability operators are installed, configure the DSCI monitoring section to trigger the operator's observability cascade (MonitoringStack, ThanosQuerier, Perses, tracing):

```sh
oc patch dsci default-dsci --type=merge -p '{
  "spec": {
    "monitoring": {
      "namespace": "redhat-ods-monitoring",
      "metrics": {
        "replicas": 1,
        "storage": {
          "size": "5Gi",
          "retention": "90d"
        }
      },
      "traces": {
        "sampleRatio": "0.1",
        "storage": {
          "backend": "pv",
          "retention": "2160h"
        }
      }
    }
  }
}'
```

> [!IMPORTANT]
> This step is required for the Observability Dashboard tab in the RHOAI UI to show metrics. Without it, the DSCI monitoring section remains empty (`metrics: {}`) and the dashboard has no data source.

Wait for the DSCI to reconcile:

```sh
oc wait --for=jsonpath='{.status.phase}'=Ready dsci/default-dsci --timeout=300s
```

## Step 5: Enable Gateway Telemetry

The RHOAI operator auto-creates a TelemetryPolicy and an Istio Telemetry CR when telemetry is enabled on the MaaS tenant configuration. These add per-model, per-subscription, and per-organization labels to gateway Prometheus metrics. No manual YAML application is needed.

**RHAIE Version: 3.5, 3.6**


**MaasTenantConfig**

Patch the `MaasTenantConfig` to enable telemetry:

```sh
oc patch maastenantconfig default-tenant -n models-as-a-service \
  --type=merge -p '{"spec":{"telemetry":{"enabled":true}}}'
```

The operator creates a TelemetryPolicy with `model`, `subscription`, `organization_id`, and `cost_center` labels, plus an Istio Telemetry CR for `REQUEST_DURATION` per subscription. Verify they exist:

```sh
oc get telemetrypolicies.extensions.kuadrant.io -n openshift-ingress
oc get telemetry.telemetry.istio.io -n openshift-ingress
```

Enable per-user metrics, which the MaaS UI Usage tab needs to show per-user activity (RHOAI disables captureUser by default for GDPR compliance):

```sh
oc patch maastenantconfig default-tenant -n models-as-a-service \
  --type=merge -p '{"spec":{"telemetry":{"metrics":{"captureUser":true}}}}'
```


**RHAIE Version: 3.4**


**Tenant**

Patch the `Tenant` CR to enable telemetry:

```sh
oc patch tenant default-tenant -n models-as-a-service \
  --type=merge -p '{"spec":{"telemetry":{"enabled":true}}}'
```

Verify the auto-created resources:

```sh
oc get telemetrypolicies.extensions.kuadrant.io -n openshift-ingress
oc get telemetry.telemetry.istio.io -n openshift-ingress
```


> [!NOTE]
> The manifests in `manifests/07-observability/telemetry/` are kept as a reference. The operator-created resources may differ slightly in label expressions and dimensions. You do not need to apply them manually.

## Step 6: Usage Dashboards with Loki (RHOAI 3.5+ Only)

RHOAI 3.5 introduces log-based usage dashboards that provide per-request token consumption, user attribution, and subscription tracking. Unlike the Prometheus-based metrics (which aggregate data), this approach emits structured OTLP access logs from the gateway and stores them in Loki for exact per-call granularity.

When enabled, the RHOAI operator automatically creates:

- **EnvoyFilter** `maas-model-access-logs` - emits OTLP structured access logs from the gateway on every inference request
- **OpenTelemetry Collector** `usage-logs` - collects the access logs and exports them to the LokiStack
- **Tenancy Proxy** `usage-logs-tenancy-proxy` - filters user-scoped usage data so non-admin users only see their own consumption
- **Perses Dashboards** - admin (`dashboard-4-maas-usage-logs-admin`) and user-scoped (`dashboard-5-maas-usage-logs`) dashboards visible in the RHOAI console under **Observe & monitor**

### Step 6a: Install the Loki Operator

```sh
oc apply -k manifests/07-observability/loki/
```

Wait for the operator CSV:

```sh
oc wait csv -n openshift-operators-redhat \
  -l operators.coreos.com/loki-operator.openshift-operators-redhat="" \
  --for=jsonpath='{.status.phase}'=Succeeded --timeout=300s
```

### Step 6b: Deploy S3 Storage for Loki

Loki requires S3-compatible object storage. For non-production deployments, the guide includes a MinIO setup:

```sh
oc apply -k manifests/07-observability/usage-logging/
```

This deploys MinIO in `redhat-ods-monitoring`, creates a `loki` bucket, a storage secret, and the LokiStack CR.

> [!NOTE]
> The LokiStack manifest uses `gp3-csi` as default StorageClass (common on AWS). If your cluster uses a different default (e.g. `ocs-external-storagecluster-ceph-rbd` on OCS), edit `manifests/07-observability/usage-logging/lokistack.yaml` before applying. For production, replace MinIO with an ObjectBucketClaim (NooBaa/ODF) or a cloud S3 bucket and update `minio-secret` with the real credentials.

Wait for the LokiStack to be ready:

```sh
oc wait lokistack/usage -n redhat-ods-monitoring \
  --for=jsonpath='{.status.conditions[?(@.type=="Ready")].status}'=True --timeout=300s
```

### Step 6c: Enable Usage Logging

Patch the MaaS Config to enable the usage logging pipeline:

```sh
oc patch configs.maas.opendatahub.io default --type=merge \
  -p '{"spec":{"usageLogging":true}}'
```

The RHOAI operator will create the EnvoyFilter, OTEL Collector, Tenancy Proxy, and Perses Dashboards automatically. Verify:

```sh
oc get envoyfilter maas-model-access-logs -n openshift-ingress
oc get opentelemetrycollector usage-logs -n redhat-ods-monitoring
oc get persesdashboard -n redhat-ods-monitoring | grep usage-logs
```

The usage dashboards will appear in the RHOAI console under **Observe & monitor > Dashboard**, showing per-model token consumption, per-user breakdowns, and subscription usage.

## Step 7: Limitador Persistence with Redis (Optional)

By default, Limitador stores rate-limit counters in memory. If the Limitador pod restarts, scales, or gets rescheduled, all counters reset to zero. For example, with a 7-day rate limit window, a pod restart on day 6 gives every user a full quota refresh for the remaining window period. For production deployments, configure Redis as a persistent backend so counters survive pod lifecycle events.

> [!NOTE]
> Limitador supports additional storage backends beyond Redis. See the [Limitador configuration documentation](https://github.com/Kuadrant/limitador/blob/main/doc/server/configuration.md) for details. This guide focuses on Redis.

### Step 7a: Deploy Redis (Dev/Test)

```sh
oc apply -k manifests/07-observability/redis/
```

Wait for the Redis deployment:

```sh
oc wait --for=condition=available deployment/redis -n redis-limitador --timeout=120s
```

> [!WARNING]
> This deploys a single-replica, non-HA Redis instance with persistence disabled (no RDB/AOF). Data is stored in memory only and will be lost if the Redis pod itself restarts. This is for development and testing. For production, use a supported Redis-based data store - see the production guidance below.

### Step 7b: Configure Limitador for Redis

Patch the Limitador CR to use the Redis secret created by the kustomize manifests:

```sh
oc patch limitador limitador -n kuadrant-system --type=merge -p '{
  "spec": {
    "storage": {
      "redis": {
        "configSecretRef": {
          "name": "redis-config"
        }
      }
    }
  }
}'
```

The Limitador operator will restart the pod automatically.

### Step 7c: Verify Redis Connection

Verify the Limitador CR has the Redis storage configured:

```sh
oc get limitador limitador -n kuadrant-system -o jsonpath='{.spec.storage}'
# Expected: {"redis":{"configSecretRef":{"name":"redis-config"}}}
```

Test that counters survive a pod restart. First make a few inference requests (using an existing API key) to populate Redis, then restart Limitador:

```sh
# Check Redis has keys (should be > 0 after making requests):
oc exec -n redis-limitador deploy/redis -- redis-cli DBSIZE

# Restart Limitador:
oc delete pod -n kuadrant-system -l app=limitador
oc wait --for=condition=ready pod -n kuadrant-system -l app=limitador --timeout=60s

# Check Redis still has keys after restart:
oc exec -n redis-limitador deploy/redis -- redis-cli DBSIZE
```

If the DBSIZE is the same before and after the restart, counters survived and Redis persistence is working.

### Production Redis guidance

For production deployments, use a supported Redis-based data store instead of the dev instance above. Supported options include Redis Enterprise, Amazon ElastiCache, and Dragonfly.

The configuration is the same - create a Secret with the Redis URL and patch the Limitador CR:

```sh
# Example with a production Redis endpoint
oc -n kuadrant-system create secret generic redis-config \
  --from-literal=URL=rediss://user:password@your-redis.example.com:6380 \
  --dry-run=client -o yaml | oc apply -f -
```

For complete production setup steps, see the [Red Hat Connectivity Link - Configure Redis](https://docs.redhat.com/en/documentation/red_hat_connectivity_link/1.4/html/install_connectivity_link/rhcl-install-on-ocp#configure-redis_install-on-ocp) documentation.

> [!TIP]
> The [Track model usage with the OpenShift AI Usage Dashboard](https://developers.redhat.com/articles/2026/07/06/track-model-usage-openshift-ai-usage-dashboard) article explains how Limitador counters feed the usage dashboard metrics (`authorized_calls`, `rate_limited`, `authorized_hits`). Without Redis, these metrics reset on pod restart. For accurate long-term usage tracking, RHOAI 3.5 also provides logs-based usage dashboards (Step 6 above) which are independent of Limitador counter persistence.

## Verification

Check all four observability operators are installed:

```sh
oc get csv -n openshift-tempo-operator | grep tempo
# Expected: tempo-operator   Succeeded

oc get csv -n openshift-opentelemetry-operator | grep opentelemetry
# Expected: opentelemetry-operator   Succeeded

oc get csv -n openshift-cluster-observability-operator | grep cluster-observability-operator
# Expected: cluster-observability-operator   Succeeded

oc get csv -n openshift-operators-redhat | grep loki
# Expected: loki-operator   Succeeded
```

Check the required CRDs are registered:

```sh
# Tempo
oc get crd tempostacks.tempo.grafana.com

# OpenTelemetry
oc get crd opentelemetrycollectors.opentelemetry.io

# COO / Perses
oc get crd perses.perses.dev

# Loki
oc get crd lokistacks.loki.grafana.com
```

Check the TelemetryPolicy exists (auto-created by the operator):

```sh
oc get telemetrypolicies.extensions.kuadrant.io -n openshift-ingress
```

Check the Istio Telemetry exists (auto-created by the operator):

```sh
oc get telemetry.telemetry.istio.io -n openshift-ingress
```

> [!NOTE]
> If these resources are missing, verify that `spec.telemetry.enabled: true` is set on the MaasTenantConfig (3.5) or Tenant (3.4) CR.

Check Redis is running (if deployed):

```sh
oc get deployment redis -n redis-limitador
# Expected: READY 1/1

oc get secret redis-config -n kuadrant-system
# Expected: secret exists

oc get limitador limitador -n kuadrant-system -o jsonpath='{.spec.storage}'
# Expected: {"redis":{"configSecretRef":{"name":"redis-config"}}}

oc exec -n redis-limitador deploy/redis -- redis-cli DBSIZE
# Expected: > 0 (after making at least one inference request)
```

## Appendix

### Directory Structure

```text
manifests/07-observability/
  tempo/
    kustomization.yaml           # Tempo operator subscription
    namespace.yaml               # openshift-tempo-operator namespace
    operatorgroup.yaml           # Tempo OperatorGroup
    subscription.yaml            # Tempo Subscription
  opentelemetry/
    kustomization.yaml           # OpenTelemetry operator subscription
    namespace.yaml               # openshift-opentelemetry-operator namespace
    operatorgroup.yaml           # OpenTelemetry OperatorGroup
    subscription.yaml            # OpenTelemetry Subscription
  coo/
    kustomization.yaml           # COO operator subscription
    namespace.yaml               # COO namespace
    operatorgroup.yaml           # COO OperatorGroup
    subscription.yaml            # COO Subscription
  loki/
    kustomization.yaml               # Loki operator subscription
    namespace.yaml                   # openshift-operators-redhat namespace
    operatorgroup.yaml               # Loki OperatorGroup
    subscription.yaml                # Loki Subscription
  telemetry/
    gateway-telemetry-policy.yaml    # Kuadrant TelemetryPolicy (reference - auto-created by operator)
    istio-gateway-telemetry.yaml     # Istio Telemetry CR (reference - auto-created by operator)
    kustomization.yaml
  usage-logging/
    kustomization.yaml               # MinIO + LokiStack
    minio.yaml                       # MinIO deployment + bucket job
    minio-secret.yaml                # S3 credentials for Loki
    lokistack.yaml                   # LokiStack CR (edit storageClassName for your cluster)
  redis/
    kustomization.yaml               # Redis dev instance for Limitador persistence
    namespace.yaml                   # redis-limitador namespace
    redis.yaml                       # Redis Deployment + Service (dev-only)
    redis-secret.yaml                # Redis URL secret (in kuadrant-system)
    limitador-patch.yaml             # Limitador CR patch reference (not applied by kustomize)
```

## References

- [RHOAI 3.5 - Enabling the observability stack](https://docs.redhat.com/en/documentation/red_hat_openshift_ai_self-managed/3.5/html/managing_openshift_ai/managing-observability_managing-rhoai#enabling-the-observability-stack_managing-rhoai)
- [RHOAI 3.4 - Enabling the observability stack](https://docs.redhat.com/en/documentation/red_hat_openshift_ai_self-managed/3.4/html/managing_openshift_ai/managing-observability_managing-rhoai#enabling-the-observability-stack_managing-rhoai)
- [Cluster Observability Operator documentation](https://docs.redhat.com/en/documentation/red_hat_openshift_cluster_observability_operator/1-latest)
- [RHOAI 3.5 Observability dashboard](https://docs.redhat.com/en/documentation/red_hat_openshift_ai_self-managed/3.5/html/govern_llm_access_with_models-as-a-service/deploy-and-manage-models-as-a-service#maas-observability_maas-deploy)
- [RHOAI 3.4 Observability dashboard](https://docs.redhat.com/en/documentation/red_hat_openshift_ai_self-managed/3.4/html/govern_llm_access_with_models-as-a-service/deploy-and-manage-models-as-a-service_maas#maas-observability_maas-deploy)
- [Kuadrant TelemetryPolicy](https://docs.kuadrant.io/dev/kuadrant-operator/doc/reference/telemetrypolicy/)
- [Track model usage with the OpenShift AI Usage Dashboard](https://developers.redhat.com/articles/2026/07/06/track-model-usage-openshift-ai-usage-dashboard)
- [MaaS upstream - Logs-based Usage Dashboards](https://opendatahub-io.github.io/models-as-a-service/dev/observability/setup/#logs-based-usage-dashboards)
- [RHCL - Configure Redis for Limitador](https://docs.redhat.com/en/documentation/red_hat_connectivity_link/1.4/html/install_connectivity_link/rhcl-install-on-ocp#configure-redis_install-on-ocp)
- [MaaS upstream - Limitador Persistence](https://opendatahub-io.github.io/models-as-a-service/dev/advanced-administration/limitador-persistence/)
- [Limitador server configuration (storage backends)](https://github.com/Kuadrant/limitador/blob/main/doc/server/configuration.md)

## Next step

Proceed to [Phase 8: External Models](/CAI-Field-Manual-Library/maas/external-models/).
