監控 Cloud Functions 的 App Check 要求指標
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
將 App Check SDK 新增至應用程式後,請先確認啟用 App Check 執行機制,以免影響現有的合法使用者。
針對 Cloud Functions,您可以檢查函式記錄來取得 App Check 指標。每次呼叫可叫用函式時,都會產生結構化記錄項目,如下所示:
{
"severity": "INFO", // INFO, WARNING, or ERROR
"logging.googleapis.com/labels": {"firebase-log-type": "callable-request-verification"},
"jsonPayload": {
"message": "Callable header verifications passed.",
"verifications": {
// ...
"app": "MISSING", // VALID, INVALID, or MISSING
}
}
}
您可以使用下列指標篩選器,在 Google Cloud 主控台建立記錄計數器指標,藉此在主控台中分析這些指標:
resource.type="cloud_function"
resource.labels.function_name="YOUR_CLOUD_FUNCTION"
resource.labels.region="us-central1"
labels.firebase-log-type="callable-request-verification"
使用 jsonPayload.verifications.appCheck
欄位標示指標。
後續步驟
瞭解 App Check 對使用者的影響,並準備繼續執行時,您可以為 Cloud Functions 啟用 App Check 強制執行機制。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-06-18 (世界標準時間)。
[null,null,["上次更新時間:2025-06-18 (世界標準時間)。"],[],[],null,["After you add the App Check SDK to your app, but before you enable\nApp Check enforcement, you should make sure that doing so won't disrupt your\nexisting legitimate users.\n\nFor Cloud Functions, you can get App Check metrics by examining your\nfunctions' logs. Every invocation of a callable function emits a structured log\nentry like the following example: \n\n {\n \"severity\": \"INFO\", // INFO, WARNING, or ERROR\n \"logging.googleapis.com/labels\": {\"firebase-log-type\": \"callable-request-verification\"},\n \"jsonPayload\": {\n \"message\": \"Callable header verifications passed.\",\n \"verifications\": {\n // ...\n \"app\": \"MISSING\", // VALID, INVALID, or MISSING\n }\n }\n }\n\nYou can analyze these metrics in the Google Cloud console by [creating a\nlogs-based counter metric](https://cloud.google.com/logging/docs/logs-based-metrics/counter-metrics)\nwith the following metric filter: \n\n```\nresource.type=\"cloud_function\"\nresource.labels.function_name=\"YOUR_CLOUD_FUNCTION\"\nresource.labels.region=\"us-central1\"\nlabels.firebase-log-type=\"callable-request-verification\"\n```\n\n[Label the metric](https://cloud.google.com/logging/docs/logs-based-metrics/labels#create-label)\nusing the field `jsonPayload.verifications.appCheck`.\n\nNext steps\n\nWhen you understand how App Check will affect your users and you're ready to\nproceed, you can [enable App Check enforcement](/docs/app-check/cloud-functions)\nfor Cloud Functions."]]