Beobachtbarkeit der Firebase-Bestätigung der Telefonnummer

Firebase PNV lässt sich sowohl in Cloud Monitoring als auch in Cloud Logging einbinden.

Google Cloud Monitoring

Firebase PNV exportiert einen einzelnen Messwert, fpnv.googleapis.com/verification_count, mit den Labels method, outcome und sms_region:

Messwerttyp Startphase (Ebenen der Ressourcenhierarchie)
Anzeigename
Art, Typ, Einheit
Überwachte Ressourcen
Beschreibung
Labels
fpnv.googleapis.com/verification_count BETA(Projekt)
Firebase Phone Number Verification Messwerte
DELTAINT641
fpnv.googleapis.com/App
Anzahl der Versuche zur Bestätigung der Telefonnummer
method: Verwendete Bestätigungsmethode. Immer API.
outcome: Das Ergebnis des Überprüfungsversuchs (SUCCESS, FAILURE, QUOTA_EXCEEDED, BACKEND_ERROR).
sms_region: Die Region, aus der die Anfrage stammt.

Google Cloud Logging

Mit Cloud Logging können Sie weitere Informationen zu bestimmten Anfragen zur Bestätigung von Telefonnummern abrufen. Bei jedem Versuch, eine Telefonnummer zu bestätigen, wird ein strukturierter Logeintrag ausgegeben:

Log-ID: 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. */
  }
}

Wenn Sie beispielsweise alle Logs für API-basierte Bestätigungsversuche finden möchten, die von einer bestimmten App stammen und aus irgendeinem Grund fehlgeschlagen sind:

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"