Firebase 電話番号確認のオブザーバビリティ

Firebase PNV は、Cloud Monitoring と Cloud Logging の両方と統合されます。

Google Cloud Monitoring

Firebase PNV は、ラベル methodoutcomesms_region を持つ単一の指標 fpnv.googleapis.com/verification_count をエクスポートします。

指標タイプリリース ステージ (リソース階層レベル)
表示名
種類、タイプ、単位
モニタリング対象リソース
説明
ラベル
fpnv.googleapis.com/verification_count ベータ版(プロジェクト)
Firebase Phone Number Verification 指標
DELTAINT641
fpnv.googleapis.com/App
電話番号の確認試行回数。
method: 使用された検証方法。常に API
outcome: 検証試行の結果(SUCCESSFAILUREQUOTA_EXCEEDEDBACKEND_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"