Khả năng quan sát tính năng Xác minh số điện thoại của Firebase

Firebase PNV tích hợp với cả Cloud Monitoring và Cloud Logging.

Google Cloud Monitoring

Firebase PNV xuất một chỉ số duy nhất, fpnv.googleapis.com/verification_count, với các nhãn method, outcomesms_region:

Loại chỉ số Giai đoạn ra mắt(Cấp độ phân cấp tài nguyên)
Tên hiển thị
Loại, Loại, Đơn vị
Tài nguyên được giám sát
Nội dung mô tả
Nhãn
fpnv.googleapis.com/verification_count BETA(dự án)
Firebase Phone Number Verification Chỉ số
DELTAINT641
fpnv.googleapis.com/App
Số lần xác minh số điện thoại.
method: Phương thức xác minh được sử dụng. Luôn API.
outcome: Kết quả của lần xác minh (SUCCESS, FAILURE, QUOTA_EXCEEDED, BACKEND_ERROR).
sms_region: Khu vực nơi yêu cầu bắt nguồn.

Google Cloud Logging

Bạn có thể sử dụng Cloud Logging để biết thêm thông tin về yêu cầu xác minh số điện thoại cụ thể. Mỗi lần xác minh số điện thoại sẽ phát ra một mục nhật ký có cấu trúc:

Mã nhật ký: 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. */
  }
}

Ví dụ: để tìm tất cả nhật ký cho các lần xác minh dựa trên API bắt nguồn từ một ứng dụng cụ thể và không thành công vì bất kỳ lý do nào:

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"