Google Cloud Console의 API 개요 페이지에서 API 호출의 측정항목을 확인할 수 있습니다.
마지막으로 Google Cloud 콘솔의 API 할당량 페이지에서 API 호출 및 함수 실행에 대한 할당량 측정항목을 확인할 수 있습니다. STATUS 측정항목 라벨에 out of quota 값이 있는 실행을 필터링하여 Cloud Monitoring에서 할당량 오류에 대한 알림을 설정할 수 있습니다. 자세한 내용은 알림 소개를 참조하세요.
프로그래매틱 방식으로 측정항목 읽기
다음 스니펫은 코드에서 측정항목을 읽는 방법을 보여줍니다.
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();
[[["이해하기 쉬움","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-03-25(UTC)"],[[["You can view Cloud Run function metrics like execution times, counts, and memory usage in the Google Cloud console and Cloud Monitoring."],["Metrics for API calls can be viewed on the API overview page in the Google Cloud console."],["Quota metrics for API calls and function execution are available in the API quotas page of the Google Cloud console."],["You can set up alerts for quota errors in Cloud Monitoring by filtering executions with an `out of quota` status."],["Metrics can also be read programmatically from your code using the Google Cloud client library, as shown in the provided Node.js example."]]],[]]