Skip to main content
The operator can query a Prometheus server to learn resource usage baselines for each ApplicationPersona. This provides actual CPU and memory usage data alongside the declared persona constraints, helping teams right-size their resource limits.

How it works

During each ApplicationPersona reconciliation (every 60 seconds), the controller queries Prometheus for the last hour of container metrics and stores the results in .status.resourceBaseline.

Baseline fields

Values are formatted in Kubernetes resource units: CPU in millicores (e.g., 150m), memory in Mi or Gi (e.g., 256Mi, 1.2Gi).

PromQL queries

The operator runs four queries per reconciliation:

Average CPU

Average memory

Peak CPU

Peak memory

Pods are matched using a regex pattern <appName>.* based on the persona’s spec.name field. The container!="POD" and container!="" filters exclude pause containers and empty container names.

Graceful failure

If Prometheus is unreachable or returns no data:
  • The baseline fields are left empty (not cleared)
  • The reconciliation continues normally
  • Validation and health checks are unaffected
  • A log message is emitted but no error condition is set
This ensures Prometheus is purely additive — it enriches status but never blocks the controller.

Configuration

Via Helm

Via CLI flag

The Prometheus URL must be reachable from inside the cluster. Use the in-cluster service DNS name, not an external URL. The operator uses a 30-second HTTP timeout per query.

Checking baselines

Or query the resource directly:

ApplicationPersona validation

How validation uses resource constraints

Cluster discovery

Cluster-level resource aggregation