ターゲット ディスカバリの場合、Managed Service for Prometheus Operator には、同じ Namespace 内の推論最適化ゲートウェイ エクスポータに対応する PodMonitoring リソースが必要です。
次の PodMonitoring 構成を使用できます。
# Copyright 2025 Google LLC## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## https://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.apiVersion:monitoring.googleapis.com/v1kind:PodMonitoringmetadata:name:inference-optimized-gateway-monitoringlabels:app.kubernetes.io/name:inference-optimized-gatewayapp.kubernetes.io/part-of:google-cloud-managed-prometheusspec:endpoints:-port:metricsscheme:httpinterval:5spath:/metricsselector:matchLabels:app:inference-gateway-ext-proc
port フィールドと matchLabels フィールドの値が、モニタリング対象の推論最適化ゲートウェイ Pod の値と一致することを確認します。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-30 UTC。"],[],[],null,["# Inference Optimized Gateway\n\n\u003cbr /\u003e\n\nThis document describes how to configure your Google Kubernetes Engine deployment\nso that you can use Google Cloud Managed Service for Prometheus to collect metrics from\n\nInference Optimized Gateway. This document shows you how to do the following:\n\n- Set up Inference Optimized Gateway to report metrics.\n- Configure a PodMonitoring resource for Managed Service for Prometheus to collect the exported metrics.\n- Access a dashboard in Cloud Monitoring to view the metrics.\n\n\u003cbr /\u003e\n\nThese instructions apply only if you are using [managed collection](/stackdriver/docs/managed-prometheus/setup-managed)\nwith Managed Service for Prometheus.\nIf you are using self-deployed collection, then see the\n\n[Inference Optimized Gateway documentation](https://github.com/kubernetes-sigs/gateway-api-inference-extension/blob/main/site-src/guides/metrics.md)\n\nfor installation information.\n\nThese instructions are provided as an example and are expected to work in\nmost Kubernetes environments.\n\nIf you are having trouble installing an\napplication or exporter due to restrictive security or organizational policies,\nthen we recommend you consult open-source documentation for support.\n\nFor information about Inference Optimized Gateway, see [Inference Optimized Gateway](https://github.com/kubernetes-sigs/gateway-api-inference-extension/).\n\nPrerequisites\n-------------\n\nTo collect metrics from\n\nthe Inference Optimized Gateway exporter\n\nby using\nManaged Service for Prometheus and managed collection, your deployment must\nmeet the following requirements:\n\n- Your cluster must be running Google Kubernetes Engine version 1.21.4-gke.300 or later.\n- You must be running Managed Service for Prometheus with managed collection enabled. For more information, see [Get started with managed collection](/stackdriver/docs/managed-prometheus/setup-managed).\n\n \u003cbr /\u003e\n\n\u003cbr /\u003e\n\nInference Optimized Gateway exposes Prometheus-format metrics automatically; you do not have to install it separately. To verify that the Inference Optimized Gateway exporter is emitting metrics on the expected endpoints, do the following:\n\n\u003cbr /\u003e\n\n1. Set up port forwarding by using the following command:\n\n ```\n kubectl -n NAMESPACE_NAME port-forward POD_NAME 9090\n ```\n2. Access the endpoint `localhost:9090/metrics` by using the `curl` utility in another terminal session as described in the [Scrape Metrics document](https://github.com/kubernetes-sigs/gateway-api-inference-extension/blob/main/site-src/guides/metrics.md#scrape-metrics).\n\nDefine a PodMonitoring resource\n-------------------------------\n\nFor target discovery, the Managed Service for Prometheus Operator\nrequires a PodMonitoring resource that corresponds to the Inference Optimized Gateway exporter\nin the same namespace.\n\nYou can use the following PodMonitoring configuration: \n\n # Copyright 2025 Google LLC\n #\n # Licensed under the Apache License, Version 2.0 (the \"License\");\n # you may not use this file except in compliance with the License.\n # You may obtain a copy of the License at\n #\n # https://www.apache.org/licenses/LICENSE-2.0\n #\n # Unless required by applicable law or agreed to in writing, software\n # distributed under the License is distributed on an \"AS IS\" BASIS,\n # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n # See the License for the specific language governing permissions and\n # limitations under the License.\n\n apiVersion: monitoring.googleapis.com/v1\n kind: PodMonitoring\n metadata:\n name: inference-optimized-gateway-monitoring\n labels:\n app.kubernetes.io/name: inference-optimized-gateway\n app.kubernetes.io/part-of: google-cloud-managed-prometheus\n spec:\n endpoints:\n - port: metrics\n scheme: http\n interval: 5s\n path: /metrics\n selector:\n matchLabels:\n app: inference-gateway-ext-proc\n\nEnsure that the values of the `port` and `matchLabels` fields match those of the Inference Optimized Gateway pods you want to monitor.\n\nTo apply configuration changes from a local file, run the following command:\n\n```\nkubectl apply -n NAMESPACE_NAME -f FILE_NAME\n```\n\n\u003cbr /\u003e\n\nYou can also\n[use Terraform](/stackdriver/docs/managed-prometheus/setup-managed#terraform-scrape)\nto manage your configurations.\n\nVerify the configuration\n------------------------\n\nYou can use Metrics Explorer to verify that you correctly configured\nthe Inference Optimized Gateway exporter. It might take one or two minutes for\nCloud Monitoring to ingest your metrics.\n\nTo verify the metrics are ingested, do the following:\n\n1. In the Google Cloud console, go to the\n *leaderboard* **Metrics explorer** page:\n\n [Go to **Metrics explorer**](https://console.cloud.google.com/monitoring/metrics-explorer)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Monitoring**.\n2. In the toolbar of the query-builder pane, select the button whose name is either *code* **MQL** or *code* **PromQL**.\n3. Verify that **PromQL** is selected in the **Language** toggle. The language toggle is in the same toolbar that lets you format your query.\n4. Enter and run the following query: \n\n ```\n inference_model_request_total{cluster=\"CLUSTER_NAME\", namespace=\"NAMESPACE_NAME\"}\n ```\n\n\u003cbr /\u003e\n\nView dashboards\n---------------\n\nThe Cloud Monitoring integration includes\n\nthe **Inference Optimized Gateway Prometheus Overview** dashboard.\n\nDashboards are automatically installed when you configure the integration.\nYou can also view static previews of dashboards without installing the\nintegration.\n\n\nTo view an installed dashboard, do the following:\n\n1. In the Google Cloud console, go to the **Dashboards** page:\n\n [Go to **Dashboards**](https://console.cloud.google.com/monitoring/dashboards)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Monitoring**.\n2. Select the **Dashboard List** tab.\n3. Choose the **Integrations** category.\n4. Click the name of the dashboard, for example, **Inference Optimized Gateway Prometheus Overview**.\n\n\u003cbr /\u003e\n\nTo view a static preview of the dashboard, do the following:\n\n1. In the Google Cloud console, go to the\n **Integrations**\n page:\n\n [Go to **Integrations**](https://console.cloud.google.com/monitoring/integrations)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Monitoring**.\n2. Click the **Kubernetes Engine** deployment-platform filter.\n3. Locate the Inference Optimized Gateway integration and click **View Details**.\n4. Select the **Dashboards** tab.\n\n\u003cbr /\u003e\n\nTroubleshooting\n---------------\n\nFor information about troubleshooting metric ingestion problems, see\n[Problems with collection from exporters](/stackdriver/docs/managed-prometheus/troubleshooting#exporter-problems) in [Troubleshooting ingestion-side problems](/stackdriver/docs/managed-prometheus/troubleshooting#ingest-problems)."]]