Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Acessar métricas e cotas
Como ver métricas no console
É possível visualizar as funções do Cloud Run noGoogle Cloud console com tempos de execução, contagens de execução e uso da memória. Essas métricas também estão disponíveis no Cloud Monitoring, em que é possível configurar alertas personalizados para essas métricas. Consulte a
documentação do Cloud Monitoring para mais informações.
As métricas para chamadas de API ficam disponíveis para visualização na
página de visão geral da API
do console Google Cloud .
Já as métricas de cotas de chamadas de API e execução de funções ficam disponíveis
para visualização na página de cotas da API
do console do Google Cloud . É possível configurar alertas sobre erros de cota no
Cloud Monitoring
filtrando as execuções que têm um valor out of quota
para o rótulo de métrica STATUS. Consulte Introdução a alertas para mais informações.
Como ler métricas de maneira programática
O snippet a seguir mostra como é possível ler as métricas no código.
Node.js
// Imports the Google Cloud client libraryconstmonitoring=require('@google-cloud/monitoring');// Creates a clientconstclient=newmonitoring.MetricServiceClient();asyncfunctionreadTimeSeriesData(){/** * TODO(developer): Uncomment and edit the following lines of code. */// const projectId = 'YOUR_PROJECT_ID';// const filter = 'metric.type="compute.googleapis.com/instance/cpu/utilization"';constrequest={name:client.projectPath(projectId),filter:filter,interval:{startTime:{// Limit results to the last 20 minutesseconds:Date.now()/1000-60*20,},endTime:{seconds:Date.now()/1000,},},};// Writes time series dataconst[timeSeries]=awaitclient.listTimeSeries(request);timeSeries.forEach(data=>{console.log(`${data.metric.labels.instance_name}:`);data.points.forEach(point=>{console.log(JSON.stringify(point.value));});});}readTimeSeriesData();
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-09-05 UTC."],[[["\u003cp\u003eYou can view Cloud Run function metrics like execution times, counts, and memory usage in the Google Cloud console and Cloud Monitoring.\u003c/p\u003e\n"],["\u003cp\u003eMetrics for API calls can be viewed on the API overview page in the Google Cloud console.\u003c/p\u003e\n"],["\u003cp\u003eQuota metrics for API calls and function execution are available in the API quotas page of the Google Cloud console.\u003c/p\u003e\n"],["\u003cp\u003eYou can set up alerts for quota errors in Cloud Monitoring by filtering executions with an \u003ccode\u003eout of quota\u003c/code\u003e status.\u003c/p\u003e\n"],["\u003cp\u003eMetrics can also be read programmatically from your code using the Google Cloud client library, as shown in the provided Node.js example.\u003c/p\u003e\n"]]],[],null,["# View metrics and quotas\n=======================\n\nViewing metrics in the console\n------------------------------\n\nYou can [view your Cloud Run functions](https://console.cloud.google.com/functions/list)\nwith their execution times, execution counts, and memory usage in the\nGoogle Cloud console. These metrics are also available in\n[Cloud Monitoring](https://console.cloud.google.com/monitoring),\nwhere you can set up custom alerting on these metrics. See the\n[Cloud Monitoring documentation](/monitoring/docs) for more information.\n\nYou can view the metrics for API calls in the\n[API overview page](https://console.cloud.google.com/apis/api/cloudfunctions.googleapis.com/overview)\nof the Google Cloud console.\n\nFinally, you can view the quota metrics for both API calls and function\nexecution in the [API quotas page](https://console.cloud.google.com/apis/api/cloudfunctions.googleapis.com/quotas)\nof the Google Cloud console. You can set up alerting on quota errors in\n[Cloud Monitoring](https://console.cloud.google.com/monitoring)\nby filtering executions that have an `out of quota`\nvalue for the `STATUS` metric label. See [Introduction to Alerting](/monitoring/alerts)\nfor more information.\n\nReading metrics programmatically\n--------------------------------\n\nThe following snippet illustrates how you can also read metrics from your code. \n\n### Node.js\n\n // Imports the Google Cloud client library\n const monitoring = require('https://cloud.google.com/nodejs/docs/reference/monitoring/latest/overview.html');\n\n // Creates a client\n const client = new monitoring.https://cloud.google.com/nodejs/docs/reference/monitoring/latest/overview.html();\n\n async function readTimeSeriesData() {\n /**\n * TODO(developer): Uncomment and edit the following lines of code.\n */\n // const projectId = 'YOUR_PROJECT_ID';\n // const filter = 'metric.type=\"compute.googleapis.com/instance/cpu/utilization\"';\n\n const request = {\n name: client.projectPath(projectId),\n filter: filter,\n interval: {\n startTime: {\n // Limit results to the last 20 minutes\n seconds: Date.now() / 1000 - 60 * 20,\n },\n endTime: {\n seconds: Date.now() / 1000,\n },\n },\n };\n\n // Writes time series data\n const [timeSeries] = await client.listTimeSeries(request);\n timeSeries.forEach(data =\u003e {\n console.log(`${data.metric.labels.instance_name}:`);\n data.points.forEach(point =\u003e {\n console.log(JSON.stringify(point.value));\n });\n });\n }\n readTimeSeriesData();"]]