For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Pular para o conteúdo

/metrics

Returns a JSON snapshot with the traffic, latency, saturation, cached SDK health and aggregated quality signals of the service. It is intended for a Prometheus or an operator to query every few seconds: it is built only from state that is already in memory and performs no active check against the SDK or the database. The endpoint also returns 200 when the service could not initialize the SDK. In that case it does not fail, but reports it in the snapshot itself with state.initialized set to false, state.classification equal to unhealthy and an SDK_UNAVAILABLE alert in alerts - which is precisely the diagnosis the endpoint is for.

get
Respostas
200

Current snapshot of operational metrics.

application/json

Operational snapshot of the service. It is built solely from state that is already in memory - it does not query the SDK or the database -, so it can be queried every few seconds without penalizing the service. The traffic, saturation and latency blocks are collected by the REST manager; service, state, usage, quality and alerts are added by Backend1N Service.

schemaVersionstringOpcional

Version of this snapshot's contract.

Example: 1.0
timestampstringOpcional

A date/time value (UTC) in "%Y-%m-%dT%H:%M:%SZ" format.

Example: 2022-01-14T10:42:05Z
get/metrics
GET /metrics HTTP/1.1
Host: 127.0.0.1:6982/
Accept: */*
{
  "schemaVersion": "1.0",
  "timestamp": "2026-09-22T10:42:05Z",
  "service": {
    "name": "facephi-backend1n-service",
    "version": "5.0.0",
    "pathBase": "",
    "uptimeSeconds": 3600,
    "configuredThreads": 1
  },
  "state": {
    "initialized": true,
    "classification": "ok",
    "sdk": {
      "initialized": true,
      "alive": true,
      "healthy": true,
      "lastInitStatus": "OK",
      "lastHealthKnown": true,
      "lastHealthCheckAt": "2026-09-22T10:41:58Z",
      "lastError": ""
    }
  },
  "traffic": {
    "totals": {
      "requests": 128,
      "success": 126,
      "clientErrors": 2,
      "serverErrors": 0,
      "unauthorized": 0
    },
    "windows": {
      "1m": {
        "requests": 4,
        "rps": 0.0666,
        "successRate": 1,
        "errorRate": 0
      },
      "5m": {
        "requests": 21,
        "rps": 0.07,
        "successRate": 1,
        "errorRate": 0
      },
      "15m": {
        "requests": 60,
        "rps": 0.0666,
        "successRate": 0.9833,
        "errorRate": 0.0166
      }
    },
    "byEndpoint": [
      {
        "method": "POST",
        "path": "/faces",
        "requests": 30,
        "success": 29,
        "clientErrors": 1,
        "serverErrors": 0,
        "unauthorized": 0
      },
      {
        "method": "GET",
        "path": "/metrics",
        "requests": 32,
        "success": 32,
        "clientErrors": 0,
        "serverErrors": 0,
        "unauthorized": 0
      }
    ]
  },
  "saturation": {
    "inflight": 1,
    "maxInflight1m": 2,
    "configuredThreads": 1,
    "queueP95Ms1m": 3,
    "backlogSuspected": false
  },
  "latency": {
    "scope": "global",
    "windows": {
      "1m": {
        "totalMs": {
          "avg": 120,
          "p50": 110,
          "p95": 240,
          "p99": 260,
          "max": 260
        },
        "queueMs": {
          "avg": 1,
          "p50": 1,
          "p95": 3,
          "p99": 4,
          "max": 4
        },
        "sdkMs": {
          "avg": 115,
          "p50": 105,
          "p95": 230,
          "p99": 250,
          "max": 250
        }
      },
      "5m": {
        "totalMs": {
          "avg": 118,
          "p50": 108,
          "p95": 235,
          "p99": 255,
          "max": 280
        },
        "queueMs": {
          "avg": 1,
          "p50": 1,
          "p95": 2,
          "p99": 4,
          "max": 6
        },
        "sdkMs": {
          "avg": 113,
          "p50": 103,
          "p95": 225,
          "p99": 245,
          "max": 270
        }
      },
      "15m": {
        "totalMs": {
          "avg": 122,
          "p50": 112,
          "p95": 245,
          "p99": 265,
          "max": 310
        },
        "queueMs": {
          "avg": 1,
          "p50": 1,
          "p95": 3,
          "p99": 5,
          "max": 9
        },
        "sdkMs": {
          "avg": 117,
          "p50": 107,
          "p95": 235,
          "p99": 255,
          "max": 300
        }
      }
    }
  },
  "usage": {
    "enabled": true,
    "total": 96,
    "operations": {
      "POST /assets/upload": 12,
      "POST /faces": 30,
      "POST /search/image/{collectionId}": 54
    }
  },
  "quality": {
    "extraction": {
      "operations": 42,
      "okCount": 40,
      "errorCount": 2,
      "facialQualityCounts": {
        "Good": 31,
        "Regular": 8,
        "Bad": 1
      },
      "faceConfidence": {
        "count": 40,
        "min": 0.72,
        "max": 0.99,
        "avg": 0.93,
        "p50": 0.95,
        "p95": 0.98
      },
      "imageQuality": {
        "count": 40,
        "min": 0.55,
        "max": 0.98,
        "avg": 0.87,
        "p50": 0.9,
        "p95": 0.97
      }
    },
    "search": {
      "operations": 54,
      "withCandidatesCount": 49,
      "withoutCandidatesCount": 5,
      "candidatesTotal": 61,
      "statusCounts": {
        "OK": 54
      },
      "bestSimilarity": {
        "count": 49,
        "min": 0.66,
        "max": 0.99,
        "avg": 0.91,
        "p50": 0.93,
        "p95": 0.98
      }
    },
    "database": {
      "operations": 96,
      "statusCounts": {
        "OK": 95,
        "Register not found in database": 1
      }
    },
    "lastFailure": {}
  },
  "alerts": []
}

Atualizado