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
BETA
(项目)
Firebase Phone Number Verification 指标 |
|
DELTA 、INT64 、1
fpnv.googleapis.com/App |
电话号码验证尝试次数。
method :
使用的验证方法。始终为 API 。
outcome :
验证尝试的结果(SUCCESS 、FAILURE 、QUOTA_EXCEEDED 、BACKEND_ERROR )。
sms_region :
请求的来源区域。
|
Google Cloud Logging
您可以使用 Cloud Logging 详细了解特定的电话号码验证请求。每次尝试验证电话号码时,系统都会发出一条结构化日志条目:
日志 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. */
}
}
例如,如需查找源自特定应用且因任何原因而失败的所有基于 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"