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

# Relatório de Compliance

> Retorna um relatório abrangente de compliance com métricas de incidentes, remediação, SLA e aprovações para a janela de tempo especificada

<ParamField query="namespace" type="string">
  Filtrar por namespace do Kubernetes
</ParamField>

<ParamField query="from" type="string">
  Data inicial no formato RFC3339
</ParamField>

<ParamField query="to" type="string">
  Data final no formato RFC3339 (padrão: agora). A janela padrão é de 7 dias caso não seja especificada.
</ParamField>

## Conteúdo do Relatório

O relatório de compliance agrega métricas de todos os recursos AIOps:

* **Métricas de Incidentes**: Total de incidentes, por severidade/estado, MTTD, MTTR, média de tentativas de remediação
* **Métricas de Remediação**: Total de remediações, taxa de sucesso, por tipo de ação, contagem de auto vs agêntico
* **Métricas de SLA**: Percentual de conformidade, violações de resposta/resolução, tempos médios
* **Métricas de Aprovação**: Aprovados automaticamente/manualmente, rejeitados, expirados, tempo médio de decisão
* **Resumo de Auditoria**: Total de eventos, por severidade, por tipo de evento

<ResponseExample>
  ```json Response 200 theme={"system"}
  {
    "apiVersion": "v1",
    "kind": "ComplianceReport",
    "spec": {
      "Period": {
        "Start": "2026-03-15T00:00:00Z",
        "End": "2026-03-22T00:00:00Z"
      },
      "IncidentMetrics": {
        "TotalIncidents": 45,
        "BySeverity": {"critical": 5, "high": 12, "medium": 18, "low": 10},
        "ByState": {"Resolved": 38, "Escalated": 4, "Analyzing": 3},
        "MTTD": 32000000000,
        "MTTR": 510000000000,
        "MeanRemediationAttempts": 1.8
      },
      "RemediationMetrics": {
        "TotalRemediations": 52,
        "SuccessRate": 0.88,
        "AutoRemediatedCount": 38,
        "AgenticCount": 8
      },
      "SLAMetrics": {
        "CompliancePercentage": 95.6,
        "ResponseSLAViolations": 2,
        "ResolutionSLAViolations": 1
      },
      "ApprovalMetrics": {
        "TotalRequests": 14,
        "AutoApproved": 8,
        "ManualApproved": 4,
        "Rejected": 1,
        "Expired": 1
      }
    }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /analytics/compliance
openapi: 3.1.0
info:
  title: ChatCLI AIOps Platform API
  description: >-
    REST API for the ChatCLI AIOps Platform — incidents, SLOs, runbooks,
    approvals, postmortems, analytics, audit, federation and health.


    The playground below uses **editable server variables** so you can point
    requests at your own self-hosted instance. Adjust `host`, `port` and
    `basePath` to match your deployment, then click **Try it**.
  version: 1.0.0
  contact:
    name: ChatCLI
    url: https://github.com/diillson/chatcli
  license:
    name: Apache-2.0
    identifier: Apache-2.0
servers:
  - url: http://{host}:{port}/{basePath}
    description: >-
      Self-hosted ChatCLI AIOps Platform — adjust host, port and basePath to
      match your deployment.
    variables:
      host:
        default: localhost
        description: >-
          Hostname or IP of your ChatCLI operator. For Kubernetes, use the
          Service DNS (e.g. chatcli-api.chatcli-system.svc) or your Ingress
          host.
      port:
        default: '8090'
        description: >-
          Port the API listens on. Default is 8090; configurable via Helm value
          `apiPort` or env var CHATCLI_API_PORT.
      basePath:
        default: api/v1
        description: >-
          API base path. Always `api/v1` unless you have a custom proxy rewrite
          in front of the operator.
security:
  - ApiKeyAuth: []
tags:
  - name: Incidents
    description: >-
      Incident lifecycle: list, fetch, acknowledge, resolve, snooze, timeline
      and remediation views.
  - name: Runbooks
    description: Remediation runbooks (list, create, update, delete).
  - name: SLOs
    description: Service Level Objectives and error budgets.
  - name: Approvals
    description: Approval workflow for risky remediations.
  - name: Postmortems
    description: Auto-generated postmortems with review, feedback and close.
  - name: Remediations
    description: Remediation plans and agentic execution history.
  - name: AI Insights
    description: AI root-cause analysis and recommendations per incident.
  - name: Analytics
    description: 'Operational analytics: MTTD, MTTR, trends, capacity, compliance.'
  - name: Audit
    description: Immutable audit log and exports.
  - name: Federation
    description: 'Multi-cluster federation: clusters, status and cross-cluster correlations.'
  - name: Health
    description: Liveness and readiness probes.
paths:
  /analytics/compliance:
    get:
      tags:
        - Analytics
      summary: Compliance Report
      description: >-
        Returns a compliance report with incident, remediation, SLA and approval
        metrics for the requested time window.
      operationId: analyticsCompliance
      parameters:
        - name: namespace
          in: query
          required: false
          description: Filter by namespace.
          schema:
            type: string
        - name: from
          in: query
          required: false
          description: Start date (RFC3339).
          schema:
            type: string
            format: date-time
        - name: to
          in: query
          required: false
          description: 'End date (RFC3339). Default: now. Default window: 7 days.'
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: Compliance report
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ComplianceReport'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    ComplianceReport:
      type: object
      properties:
        apiVersion:
          type: string
          example: v1
        kind:
          type: string
          example: ComplianceReport
        spec:
          type: object
          properties:
            Period:
              type: object
              properties:
                Start:
                  type: string
                  format: date-time
                End:
                  type: string
                  format: date-time
            IncidentMetrics:
              type: object
              additionalProperties: true
            RemediationMetrics:
              type: object
              additionalProperties: true
            SLAMetrics:
              type: object
              additionalProperties: true
            ApprovalMetrics:
              type: object
              additionalProperties: true
    Error:
      type: object
      required:
        - apiVersion
        - kind
        - error
      properties:
        apiVersion:
          type: string
          example: v1
        kind:
          type: string
          example: Error
        error:
          oneOf:
            - type: object
              required:
                - code
                - message
              properties:
                code:
                  type: integer
                  example: 404
                message:
                  type: string
                  example: Resource not found
                details:
                  type: string
            - type: string
        code:
          type: integer
          description: Top-level code (only used by some endpoints).
          example: 400
  responses:
    Unauthorized:
      description: Missing or invalid API token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Rate limit exceeded for this token's role
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Bearer token issued by the operator. Format: `Authorization: Bearer
        <token>`.

````