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

/api/v1/selphid/metrics

Returns a cheap JSON snapshot of the service, suitable for frequent scraping: it never calls the SDK nor runs a health check. The traffic, saturation, latency and quality figures are accumulated in memory since the service started. It is available in every image variant and never requires a JWT.

Block
Content

schemaVersion, timestamp

Payload version (1.0) and UTC instant of the snapshot

service

name (facephi-selphid-service), version, pathBase (/api/v1/selphid), uptimeSeconds and configuredThreads

state

initialized, sdk (result of the last call to GET /api/v1/selphid/health) and classification

traffic

Every request served, management endpoints included: totals, 1m/5m/15m windows and byEndpoint

saturation

inflight, maxInflight1m, configuredThreads, queueP95Ms1m and backlogSuspected

latency

Total (totalMs), queue (queueMs) and processing (sdkMs) latency in milliseconds (avg, p50, p95, p99, max) per window

usage

Requests per business endpoint (operations, keyed by <METHOD> <path>) and their total. The management endpoints are not counted

quality

Aggregated quality of the extraction, facial authentication and passive liveness results

alerts

Active alerts

When metrics_enabled is false no request is recorded: traffic, latency, usage and the in-flight and queue figures of saturation stay at zero. errorRate counts every 4xx and 5xx response, 401 included.

A sample is of low quality only when the SDK could not evaluate it: an invalid extraction, a Bad facialQuality, a faceConfidence below 0.5, a None, NoneBecause* or Invalid* status or diagnostic, or an Error or Invalid fPadStatus/fMadStatus. Business verdicts such as a Negative or Uncertain authentication, a Spoof or NoLive diagnostic, a Failed PAD/MAD status or NoneBecauseTokenSecurity (a token reused in another session) are counted in quality but never raise the LOW_QUALITY alert nor degrade the classification.

Alerts:

code

severity

message

Active when

SDK_UNAVAILABLE

critical

SDK health check failed

The SDK is not initialized, or the last call to /health failed

HIGH_ERROR_RATE

warning

5m error rate is above the warning threshold

The 5-minute error rate reaches metrics_error_rate_warning

SATURATED

warning

Queue latency and inflight indicate saturation

state.classification is saturated

LOW_QUALITY

warning

Recent SelphID quality signals show degraded results

The last low-quality sample happened within metrics_quality_alert_window_seconds

IDLE

info

Traffic is below the idle threshold

state.classification is idle

The classification thresholds (metrics_*) are configured at startup in config.json or with the FACEPHI_SELPHID_REST_METRICS_* environment variables.

get
Respostas
200

Operational metrics snapshot.

application/json

Operational metrics snapshot. The traffic, saturation, latency and quality figures are accumulated in memory since the service started. Key order is not part of the contract; ignore unknown fields.

schemaVersionstringOpcional

Version of the payload format.

Example: 1.0
timestampstringOpcional

UTC instant of the snapshot, with second precision.

Example: 2026-10-21T10:00:00Z
get/api/v1/selphid/metrics
GET /api/v1/selphid/metrics HTTP/1.1
Accept: */*
200

Operational metrics snapshot.

{
  "schemaVersion": "1.0",
  "timestamp": "2026-10-21T10:00:00Z",
  "service": {
    "name": "facephi-selphid-service",
    "version": "6.22.0",
    "pathBase": "/api/v1/selphid",
    "uptimeSeconds": 3600,
    "configuredThreads": 8
  },
  "state": {
    "initialized": true,
    "classification": "ok",
    "sdk": {
      "alive": true,
      "healthy": true,
      "initialized": true,
      "lastHealthKnown": true,
      "lastHealthCheckAt": "2026-10-21T09:59:30Z",
      "lastError": ""
    }
  },
  "traffic": {
    "totals": {
      "requests": 1520,
      "success": 1500,
      "clientErrors": 18,
      "serverErrors": 0,
      "unauthorized": 2
    },
    "windows": {
      "1m": {
        "requests": 95,
        "rps": 0.32,
        "successRate": 0.98,
        "errorRate": 0.02,
        "clientErrors": 2,
        "serverErrors": 0,
        "unauthorized": 0
      },
      "5m": {
        "requests": 95,
        "rps": 0.32,
        "successRate": 0.98,
        "errorRate": 0.02,
        "clientErrors": 2,
        "serverErrors": 0,
        "unauthorized": 0
      },
      "15m": {
        "requests": 95,
        "rps": 0.32,
        "successRate": 0.98,
        "errorRate": 0.02,
        "clientErrors": 2,
        "serverErrors": 0,
        "unauthorized": 0
      }
    },
    "byEndpoint": [
      {
        "method": "POST",
        "path": "/api/v1/selphid/extract",
        "requests": 1520,
        "success": 1500,
        "clientErrors": 18,
        "serverErrors": 0,
        "unauthorized": 2
      }
    ]
  },
  "saturation": {
    "inflight": 1,
    "maxInflight1m": 3,
    "configuredThreads": 8,
    "queueP95Ms1m": 4,
    "backlogSuspected": false
  },
  "latency": {
    "scope": "global",
    "windows": {
      "1m": {
        "totalMs": {
          "avg": 120,
          "p50": 110,
          "p95": 240,
          "p99": 320,
          "max": 410
        },
        "queueMs": {
          "avg": 120,
          "p50": 110,
          "p95": 240,
          "p99": 320,
          "max": 410
        },
        "sdkMs": {
          "avg": 120,
          "p50": 110,
          "p95": 240,
          "p99": 320,
          "max": 410
        }
      },
      "5m": {
        "totalMs": {
          "avg": 120,
          "p50": 110,
          "p95": 240,
          "p99": 320,
          "max": 410
        },
        "queueMs": {
          "avg": 120,
          "p50": 110,
          "p95": 240,
          "p99": 320,
          "max": 410
        },
        "sdkMs": {
          "avg": 120,
          "p50": 110,
          "p95": 240,
          "p99": 320,
          "max": 410
        }
      },
      "15m": {
        "totalMs": {
          "avg": 120,
          "p50": 110,
          "p95": 240,
          "p99": 320,
          "max": 410
        },
        "queueMs": {
          "avg": 120,
          "p50": 110,
          "p95": 240,
          "p99": 320,
          "max": 410
        },
        "sdkMs": {
          "avg": 120,
          "p50": 110,
          "p95": 240,
          "p99": 320,
          "max": 410
        }
      }
    }
  },
  "usage": {
    "enabled": true,
    "operations": {
      "POST /api/v1/selphid/extract": 820,
      "POST /api/v1/selphid/passive-liveness/evaluate": 640
    },
    "total": 1460
  },
  "quality": {
    "facialAuthentication": {
      "samples": 300,
      "positive": 280,
      "negative": 20,
      "similarity": {
        "samples": 120,
        "avg": 0.81,
        "min": 0.12,
        "max": 0.99
      }
    },
    "extraction": {
      "okCount": 818,
      "errorCount": 2,
      "faceConfidence": {
        "samples": 120,
        "avg": 0.81,
        "min": 0.12,
        "max": 0.99
      },
      "facialQualityCounts": {
        "ANY_ADDITIONAL_PROPERTY": 1
      }
    },
    "liveness": {
      "diagnosticCounts": {
        "ANY_ADDITIONAL_PROPERTY": 1
      },
      "noLiveDetails": {
        "fPadStatusCounts": {
          "ANY_ADDITIONAL_PROPERTY": 1
        },
        "fMadStatusCounts": {
          "ANY_ADDITIONAL_PROPERTY": 1
        },
        "fPadScore": {
          "samples": 120,
          "avg": 0.81,
          "min": 0.12,
          "max": 0.99
        },
        "fMadScore": {
          "samples": 120,
          "avg": 0.81,
          "min": 0.12,
          "max": 0.99
        },
        "coercionScore": {
          "samples": 120,
          "avg": 0.81,
          "min": 0.12,
          "max": 0.99
        }
      }
    },
    "tracking": {
      "statusCounts": {
        "ANY_ADDITIONAL_PROPERTY": 1
      }
    },
    "summary": {
      "lowQualitySamples": 3,
      "lowQualitySince": "2026-10-21T09:12:44Z"
    }
  },
  "alerts": [
    {
      "code": "LOW_QUALITY",
      "severity": "warning",
      "message": "Recent SelphID quality signals show degraded results",
      "since": "2026-10-21T09:58:12Z"
    }
  ]
}

Atualizado