Observabilidad de la verificación del número de teléfono de Firebase

Firebase PNV se integra en Cloud Monitoring y Cloud Logging.

Google Cloud Monitoring

Firebase PNV exporta una sola métrica, fpnv.googleapis.com/verification_count, con las etiquetas method, outcome y sms_region:

Tipo de métrica Etapa de lanzamiento(niveles de jerarquía de recursos)
Nombre visible
Clase, tipo, unidad
Recursos supervisados
Descripción
Etiquetas
fpnv.googleapis.com/verification_count BETA(proyecto)
Firebase Phone Number Verification Métricas
DELTAINT641
fpnv.googleapis.com/App
Cantidad de intentos de verificación del número de teléfono.
method: Es el método de verificación que se usó. Siempre API.
outcome: Es el resultado del intento de verificación (SUCCESS, FAILURE, QUOTA_EXCEEDED, BACKEND_ERROR).
sms_region: Es la región desde la que se originó la solicitud.

Google Cloud Logging

Puedes usar Cloud Logging para obtener más información sobre solicitudes específicas de verificación de números de teléfono. Cada intento de verificación de número de teléfono emite una entrada de registro estructurada:

ID de registro: fpnv.googleapis.com/verifications

{
  "resource": {
    "type": "fpnv.googleapis.com/App",
    "labels": [
      "resource_container": /* Your Firebase / Google Cloud project ID: "project/your-project-id" */,
      "app_id": /* The ID of a Firebase app within your project  */
    ]
  },
  "severity": /* DEBUG (for successful verification) or WARNING (for failed verification) */,
  "jsonPayload": {
    "method": /* The method used for the verification attempt: METHOD_UNSPECIFIED, API */,
    "outcome": /* The final outcome of the verification attempt: OUTCOME_UNSPECIFIED, SUCCESS, FAILURE, QUOTA_EXCEEDED, BACKEND_ERROR, DEVICE_INTEGRITY_FAILURE */,
    "nonce": /* Unique ID for the verification attempt, provided to the SDK by the client if using API verification. */,
    "response_code": /* The HTTP response code returned to the client, if the interaction was over HTTP. */,
    "sms_region_code": /* The region from which the request originated. */,
    "error_code": /* A specific error code from the underlying verification service or provider, if available. */,
    "error_message": /* A message describing why the verification failed, if applicable. */
  }
}

Por ejemplo, para encontrar todos los registros de intentos de verificación basados en la API que se originaron en una app específica y fallaron por cualquier motivo, haz lo siguiente:

log_id("fpnv.googleapis.com/verifications") AND
resource.type="fpnv.googleapis.com/App" AND
resource.labels.app_id="Your Firebase app ID" AND
severity>=WARNING AND
jsonPayload.method:"API"