אם אתם יוצרים פונקציה חדשה, תוכלו להיעזר במאמר מדריך למתחילים לשימוש במסוף ב-Cloud Run. התוכן בדף הזה רלוונטי רק לפונקציות קיימות מדור קודם שנוצרו באמצעות Cloud Functions v1 API.
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
לבסוף, אפשר לראות את מדדי המכסה של קריאות ל-API ושל הפעלת פונקציות בדף המכסות של ה-API במסוף Google Cloud . כדי להגדיר התראות על שגיאות שקשורות למכסות ב-Cloud Monitoring, צריך לסנן את ההפעלות שיש להן ערך out of quota בתווית המדד STATUS. מידע נוסף מופיע במאמר מבוא להתראות.
קריאת מדדים באופן פרוגרמטי
קטע הקוד הבא ממחיש איך אפשר גם לקרוא מדדים מהקוד.
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"]],["עדכון אחרון: 2026-03-10 (שעון UTC)."],[],[]]