Firebase Phone Number Verification observability

Firebase PNV integrates with both Cloud Monitoring and Cloud Logging.

Google Cloud Monitoring

Firebase PNV exports a single metric, fpnv.googleapis.com/verification_count, with the labels method, outcome, and sms_region:

Metric type Launch stage(Resource hierarchy levels)
Display name
Kind, Type, Unit
Monitored resources
Description
Labels
fpnv.googleapis.com/verification_count BETA(project)
Firebase Phone Number Verification Metrics
DELTAINT641
fpnv.googleapis.com/App
Number of phone number verification attempts.
method: Verification method used. Always API.
outcome: The outcome of the verification attempt (SUCCESS, FAILURE, QUOTA_EXCEEDED, BACKEND_ERROR).
sms_region: The region from which the request originated.

Google Cloud Logging

You can use Cloud Logging to get more information about specific phone number verification request. Every phone number verification attempt emits a structured log entry:

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

For example, to find all logs for API-based verification attempts that originated from a specific app and failed for any reason:

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"