簡化的 API 配額指標
為提升 Compute Engine API 配額的可探索性和可管理性, Google Cloud 已將指標整合至較少的配額群組,藉此減少配額指標數量。這些簡化的配額指標也為每個配額群組提供更高的限制。
舊版和簡化版 API 配額指標
下表列出舊版 API 配額指標,以及簡化後的對等指標:
| 舊版 API 配額指標 | 簡化的 API 配額指標 |
|---|---|
compute.googleapis.com/list_requests |
compute.googleapis.com/global_reads每分鐘讀取要求數 |
compute.googleapis.com/read_requests | |
compute.googleapis.com/heavy_weight_read_requests | |
compute.googleapis.com/default列出 Compute Engine 資源的方法的舊版配額指標。 | |
compute.googleapis.com/get_macsec_config_requests | |
compute.googleapis.com/license_verification_requests |
|
compute.googleapis.com/default用於建立、修改或刪除 Compute Engine 資源的全球方法,其舊版配額指標。 |
compute.googleapis.com/global_writes每分鐘變動要求數 |
compute.googleapis.com/global_resource_write_requests | |
compute.googleapis.com/heavy_weight_write_requests | |
compute.googleapis.com/regional_v2_public_advertised_prefixes_delete_requests | |
compute.googleapis.com/regional_v2_public_advertised_prefixes_create_requests | |
compute.googleapis.com/address_move_requests | |
compute.googleapis.com/project_set_common_instance_metadata_requests | |
compute.googleapis.com/regional_v2_public_advertised_prefixes_announce_requests | |
compute.googleapis.com/license_insert_requests |
|
compute.googleapis.com/heavy_weight_read_requests_per_region |
compute.googleapis.com/reads_per_region每個區域每分鐘的讀取要求數 |
compute.googleapis.com/read_requests_per_region | |
compute.googleapis.com/list_requests_per_region | |
compute.googleapis.com/default_per_region列出 Compute Engine 資源的區域和可用區方法適用的舊版配額指標。 | |
compute.googleapis.com/license_verification_requests_per_region | |
compute.googleapis.com/instance_list_referrers_requests_per_region | |
compute.googleapis.com/operation_read_requests_per_region | |
compute.googleapis.com/network_endpoint_list_requests_per_region | |
compute.googleapis.com/regional_network_endpoint_list_requests_per_region | |
compute.googleapis.com/get_serial_port_output_requests_per_region | |
compute.googleapis.com/read_requests |
|
compute.googleapis.com/heavy_weight_write_requests_per_region |
compute.googleapis.com/writes_per_region每個區域每分鐘的變動要求數 |
compute.googleapis.com/default_per_region用於建立、修改或刪除 Compute Engine 資源的區域和地區方法,其舊版配額指標。 | |
compute.googleapis.com/global_resource_write_requests_per_region | |
compute.googleapis.com/network_endpoint_write_requests_per_region | |
compute.googleapis.com/regional_network_endpoint_write_requests_per_region | |
compute.googleapis.com/regional_public_delegated_prefixes_create_requests_per_region | |
compute.googleapis.com/address_move_requests_per_region | |
compute.googleapis.com/simulate_maintenance_event_requests_per_region | |
compute.googleapis.com/regional_public_delegated_prefixes_delete_requests_per_region | |
compute.googleapis.com/regional_public_delegated_prefixes_announce_requests_per_region |
|
compute.googleapis.com/recommend_locations_requests_per_region |
compute.googleapis.com/recommend_locations_per_region每個區域每分鐘的 RegionInstances RecommendLocations 要求數 |
compute.googleapis.com/cache_invalidation_requests |
compute.googleapis.com/global_cache_invalidation_requests每分鐘的快取失效要求數 |
在 Cloud Monitoring 資訊主頁中使用簡化指標
如要根據簡化版 API 指標監控 Compute Engine API 使用量,請在 Cloud Monitoring 資訊主頁、快訊和查詢中新增這些指標的篩選器。
建立使用簡化版 API 配額指標的資訊主頁
如要建立使用簡化指標的資訊主頁,請按照下列步驟操作:
前往 Google Cloud 控制台的「Monitoring」:
在導覽窗格中,選取「Dashboards」(資訊主頁)。
按一下「建立自訂資訊主頁」。
在資訊主頁工具列中,按一下「新增小工具」,然後選取小工具類型 (例如「折線圖」)。「設定小工具」頁面隨即開啟。
在「選取指標」部分中,執行下列操作:
- 選取資源的「消費者配額」。
- 選取「配額」Quota做為指標類別。
- 選取「頻率配額用量」指標,然後按一下「套用」。
在「新增篩選條件」部分,使用
quota_metric篩選條件,然後選取對應的簡化 API 配額指標。如要查看簡化指標,請參閱「舊版和簡化版 API 配額指標」。按一下「套用」,將小工具新增至資訊主頁。
在工具列中,按一下「儲存」即可儲存資訊主頁。
修改使用舊版配額指標的資訊主頁
如要更新含有舊版指標的資訊主頁,請按照下列步驟操作:
前往 Google Cloud 控制台的「Monitoring」:
在導覽窗格中,選取「Dashboards」(資訊主頁)。
開啟含有需要更新圖表的資訊主頁。
按一下 [編輯]。
找出要更新的小工具並編輯。
在「選取指標」部分,更新包含舊版指標的篩選器:
- 在「篩選器」欄位中,選取「
quota_metric」。 - 在「Value」(值) 欄位中,將目前的值更新為對應的簡化 API 配額指標。如要尋找舊版指標的替代指標,請參閱「舊版和簡化版 API 配額指標」。例如,將
compute.googleapis.com/read_requests變更為compute.googleapis.com/global_reads。
- 在「篩選器」欄位中,選取「
按一下「套用」即可套用變更。
在 Cloud Monitoring 快訊政策中使用簡化的 API 配額指標
如要根據簡化版 API 指標監控 Compute Engine API 使用情況,請在 Cloud Monitoring 快訊政策中新增這些指標的篩選器。
建立使用簡化 API 配額指標的警告政策
如要建立使用簡化指標的警告政策,請按照下列指示操作:
前往 Google Cloud 控制台的「Monitoring」:
在導覽窗格中,選取「快訊」。
點選「建立政策」。
在「選取指標」部分中,執行下列操作:
- 選取資源的「消費者配額」。
- 選取「配額」Quota做為指標類別。
- 選取「頻率配額用量」指標,然後按一下「套用」。
在「新增篩選條件」部分,使用
quota_metric篩選條件,然後選取對應的簡化 API 配額指標。如要查看簡化指標,請參閱「舊版和簡化版 API 配額指標」。視需要設定條件、通知管道和說明文件。
按一下 [Save Policy] (儲存政策)。
您也可以使用 Google Cloud Terraform Provider 在Google Cloud 專案中建立快訊政策。詳情請參閱「使用 Terraform 建立快訊政策」。
修改使用舊版配額警告政策
如要更新使用舊版配額指標的現有快訊政策,請按照下列步驟操作:
前往 Google Cloud 控制台的「Monitoring」:
在導覽窗格中,選取「快訊」。 「警告」頁面會顯示窗格,列出摘要資訊、事件和警告政策。
如要編輯現有政策,請按一下「政策」下方的政策名稱。
在「選取指標」部分,更新包含舊版指標的篩選器:
- 在「篩選器」欄位中,選取「
quota_metric」。 - 在「Value」(值) 欄位中,將值更新為對應的簡化 API 配額指標。如要尋找舊版指標的替代指標,請參閱「舊版和簡化版 API 配額指標」。例如,將
compute.googleapis.com/read_requests變更為compute.googleapis.com/global_reads。
- 在「篩選器」欄位中,選取「
按一下「完成」,儲存篩選器變更。
按一下 [Save Policy] (儲存政策)。
在 Cloud Monitoring 查詢中使用簡化的配額指標
如要更新以 PromQL 為基礎的警告政策或資訊主頁中的圖表,請使用查詢編輯器編輯查詢篩選器。詳情請參閱「使用 PromQL 的程式碼編輯器」。
如要更新查詢,請將篩選器中的舊版指標名稱替換為對應的簡化指標名稱。quota_metric
範例 1:
使用舊版指標的查詢:
rate(serviceruntime_googleapis_com:quota_rate_net_usage{monitored_resource="consumer_quota", \
quota_metric=~"compute.googleapis.com/read_requests"}[1m])使用簡化指標修改後的查詢:
rate(serviceruntime_googleapis_com:quota_rate_net_usage{monitored_resource="consumer_quota", \
quota_metric=~"compute.googleapis.com/global_reads"}[1m])範例 2:
使用舊版指標的查詢:
rate(serviceruntime_googleapis_com:quota_rate_net_usage{monitored_resource="consumer_quota", \ quota_metric=~"compute.googleapis.com/heavy_weight_write_requests_per_region"}[1m])
使用簡化指標修改後的查詢:
rate(serviceruntime_googleapis_com:quota_rate_net_usage{monitored_resource="consumer_quota", \ quota_metric=~"compute.googleapis.com/writes_per_region"}[1m])