Observability

Prometheus metrics, status fields, and monitoring the Remediator Agent in production.

Prometheus Metrics

The agent serves Prometheus metrics on container port 8080 (metrics.port), exposed through the service-agent-metrics-service Service on port 8443. The endpoint is plain HTTP by default (metrics.secure=false).

Available Metrics

Reconcile and GitOps metrics are shared by all Service Agent controllers and carry a controller_type label — filter on controller_type="remediator" for the Remediator Agent. All of these also carry namespace and k8s_uid, identifying the custom resource the run belongs to.

MetricTypeLabelsDescription
agent_reconcile_totalCountercontroller_type, result="success|error"Reconciliation runs
agent_reconcile_duration_secondsHistogramcontroller_type, result="success|error"Duration of each reconciliation run
agent_outcome_totalCountercontroller_type, outcome_typeGeneric outcomes. outcome_type="REMEDIATION_PLANS_GENERATED" counts plans produced
agent_gitops_outcome_totalCountercontroller_type, outcome_type, repo, source_branch, target_branchGitOps outcomes: PR_OPENED, PR_MERGED, ISSUE_CREATED
agent_gitops_outcome_latency_secondsHistogramcontroller_type, outcome_type, repoTime to reach a GitOps outcome. Currently observed for PR_MERGED (PR open to merge)
remediator_actions_executed_totalCountertype, status="success|error"Action executions by action type
remediator_violations_activeGaugeinstance_id, severityActive violations by severity
remediator_resources_skipped_unchanged_totalCountercollector_idResources skipped because they have not changed since the last run

Standard controller-runtime, workqueue, leader-election, and Kubernetes client metrics are exposed on the same endpoint.

Enable ServiceMonitor

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: nirmata-agent-metrics
  namespace: nirmata
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: nirmata-agent
  endpoints:
    - port: metrics
      path: /metrics
      scheme: http

Access Metrics Directly

kubectl -n nirmata port-forward svc/service-agent-metrics-service 8443:8443

curl -s http://localhost:8443/metrics | grep '^agent_\|^remediator_'

Example Queries

# Success rate over the last hour
sum(rate(agent_reconcile_total{controller_type="remediator",result="success"}[1h]))
/ sum(rate(agent_reconcile_total{controller_type="remediator"}[1h]))

# P95 reconciliation latency
histogram_quantile(0.95,
  sum by (le) (rate(agent_reconcile_duration_seconds_bucket{controller_type="remediator"}[1h]))
)

# PRs opened per day, by repository
sum by (repo) (
  increase(agent_gitops_outcome_total{controller_type="remediator",outcome_type="PR_OPENED"}[1d])
)

# Active critical violations
sum(remediator_violations_active{severity="critical"})

Remediator Status

The Remediator resource reports detailed status about each run.

# View full status
kubectl get remediator remediator-argo-hub -n nirmata -o yaml

# View just the last run summary
kubectl get remediator remediator-argo-hub -n nirmata \
  -o jsonpath='{.status.lastRunSummary}' | jq

Status Fields

FieldDescription
phaseCurrent operational phase: Running, Idle, or Failed
lastScheduleTimeWhen the last remediation was scheduled
lastSuccessfulTimeWhen the last successful run completed
nextScheduledTimeWhen the next run is scheduled
conditionsStep-by-step workflow tracking with collector information
lastRunSummary.startTime / endTimeRun duration timestamps
lastRunSummary.statusSuccess or failure
lastRunSummary.messageHuman-readable outcome
lastRunSummary.targetsProcessedNumber of targets scanned
lastRunSummary.violationsFoundTotal violations discovered
lastRunSummary.remediationPlansNumber of remediation plans produced
lastRunSummary.actionsExecutedNumber of actions taken (PRs created, etc.)
lastRunSummary.errorsAny errors encountered

Example Status Query

kubectl get remediator remediator-argo-hub -n nirmata \
  -o jsonpath='{.status.lastRunSummary}' | jq '{
  status: .status,
  violations: .violationsFound,
  plans: .remediationPlans,
  actions: .actionsExecuted,
  errors: .errors
}'
```bash

---

## Logs

```bash
# Follow live logs
kubectl logs -n nirmata -l app.kubernetes.io/name=nirmata-agent -f

# Last 100 lines
kubectl logs -n nirmata -l app.kubernetes.io/name=nirmata-agent --tail=100
```yaml

---

## Support Matrix

| Component | Supported |
|-----------|-----------|
| **Kubernetes** | All CNCF-compliant distributions v1.20+, including on-prem |
| **AI providers** | Nirmata AI (default), AWS Bedrock, Azure OpenAI, Anthropic API — or no AI provider at all in `prescriptive` remediation mode |
| **GitOps** | ArgoCD, FluxCD |
| **VCS** | GitHub (App & PAT), GitLab (Enterprise & SaaS) |
| **Manifests** | YAML files, simple Helm charts |