การสังเกตการณ์การยืนยันหมายเลขโทรศัพท์ Firebase

Firebase PNV ผสานรวมกับทั้ง Cloud Monitoring และ Cloud Logging

Google Cloud Monitoring

Firebase PNV ส่งออกเมตริกเดียวคือ fpnv.googleapis.com/verification_count โดยมีป้ายกำกับ method, outcome และ sms_region ดังนี้

ประเภทเมตริก ระยะเปิดตัว(ระดับลำดับชั้นของทรัพยากร)
ชื่อที่แสดง
ประเภท ชนิด หน่วย
ทรัพยากรที่มีการตรวจสอบ
คำอธิบาย
ป้ายกำกับ
fpnv.googleapis.com/verification_count เบต้า(โปรเจ็กต์)
Firebase Phone Number Verification เมตริก
DELTAINT641
fpnv.googleapis.com/App
จำนวนครั้งที่พยายามยืนยันหมายเลขโทรศัพท์
method: วิธีการยืนยันที่ใช้ เสมอ API
outcome: ผลลัพธ์ของการพยายามยืนยัน (SUCCESS, FAILURE, QUOTA_EXCEEDED, BACKEND_ERROR)
sms_region: ภูมิภาคที่ส่งคำขอ

Google Cloud Logging

คุณใช้ Cloud Logging เพื่อดูข้อมูลเพิ่มเติมเกี่ยวกับคำขอการยืนยันหมายเลขโทรศัพท์ที่เฉพาะเจาะจงได้ ทุกครั้งที่พยายามยืนยันหมายเลขโทรศัพท์ ระบบจะส่งรายการบันทึกที่มีโครงสร้าง

รหัสบันทึก: 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. */
  }
}

เช่น หากต้องการค้นหาบันทึกทั้งหมดสำหรับการพยายามยืนยันที่อิงตาม API ซึ่งมาจากแอปหนึ่งๆ และไม่สำเร็จไม่ว่าด้วยเหตุผลใดก็ตาม ให้ทำดังนี้

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"