با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
چه به تازگی توسعه اپلیکیشن خود را شروع کرده اید یا یک برنامه تولید کامل داشته باشید، می خواهید مطمئن شوید که هزینه های خود را درک کرده اید و چگونه از صورتحساب های غافلگیرکننده جلوگیری کنید.
آزمایش کد خود قبل از استقرار در تولید، به دلایل زیادی، مانند تشخیص خطاهایی که ممکن است هزینههای قابل توجهی برای شما داشته باشد، ایده خوبی است. همانطور که زیرساخت برنامه خود را ایجاد می کنید، ما به شدت توصیه می کنیم ابتدا با استفاده از Firebase Local Emulator Suite صورت محلی آزمایش کنید .
Local Emulator Suite به شما امکان می دهد نمونه هایی از Cloud Functions ، Cloud Firestore ، Realtime Database و موارد دیگر را به صورت محلی روی دستگاه دسکتاپ خود اجرا کنید. این نه تنها تکرار سریع عملکردهای جدید - به ویژه Cloud Functions - را برای شما آسانتر میکند، بلکه تضمین میکند که هزینههای Firebase که ممکن است در نتیجه آزمایش در برابر خدمات در تولید باشد متحمل نشوید.
همانطور که در حال آزمایش هستید، این دلایل رایج بیش از حد مصرف و هزینه را بررسی کنید:
فراموش کردن اضافه کردن محدودیت به یک جستجوی پایگاه داده با میلیون ها نتیجه
ترکیبی از Cloud Functions که باعث بار کاری بیش از حد فن یا حتی حلقه های بی نهایت می شود
سطوح استفاده و هزینه خود را مشاهده کنید
شما باید بدانید که الگوهای استفاده عادی برای برنامه شما چگونه به نظر می رسد و مطمئن شوید که در آستانه های مهم برای شما باقی می مانند.
مشاهده استفاده از محصول به صورت جداگانه
برای بسیاری از محصولات در کنسول Firebase میتوانید استفاده از محصول جداگانه را در برگه «استفاده» مشاهده کنید.
میتوانید محدودههای تاریخی خاصی را در این داشبوردها مشاهده کنید.
میتوانید مصرف کلی پروژه خود را در داشبورد استفاده و صورتحساب در کنسول Firebase مشاهده کنید (به تنظیمات پروژه > استفاده و صورتحساب بروید).
میتوانید میزان استفاده ماهانه خود و نحوه اندازهگیری سطوح استفاده شما تا سهمیه استفاده بدون هزینه اختصاص داده شده را مشاهده کنید.
برای بررسی خلاصه استفاده روزانه و نحوه اندازه گیری آن تا سهمیه اختصاص داده شده استفاده بدون هزینه، روی هر محصول کلیک کنید.
به یاد داشته باشید که هر محصول دارای سهمیه های مختلف استفاده و بنابراین زمان بندی متفاوتی است، به عنوان مثال:
استفاده از Cloud Firestore و Cloud Storage روزانه محاسبه می شود.
استفاده Cloud Functions ماهانه محاسبه می شود.
ایمیل های هشدار بودجه را تنظیم کنید
با ایجاد بودجه در Google Cloud Billing و تنظیم هشدارهای بودجه، از غافلگیری صورت حساب خود جلوگیری کنید.
بودجه ها مبالغ پولی کلی هستند که هر ماه برای خرج کردن آنها برنامه ریزی می کنید.
هشدارهای بودجه، اعلانهای ایمیلی هستند که در صورتی که پروژه شما از آستانه هزینه تعیینشده فراتر رود، به تیم شما ارسال میشود.
بهطور پیشفرض، Firebase و Google Cloud خدمات و استفاده را بر اساس بودجه و آستانههای شما خاموش نمیکنند، زیرا اگرچه ممکن است مشکلی در برنامه خود داشته باشید که باعث افزایش هزینهها شود، اما ممکن است رشد مثبت غیرمنتظرهای را در برنامه خود تجربه کنید. شما نمیخواهید برنامهتان در زمانی که بیشتر به آن نیاز دارید، بهطور غیرمنتظره خاموش شود.
اگر اخیراً به برنامه قیمت گذاری Blaze ارتقا داده اید، ممکن است قبلاً یک هشدار بودجه داشته باشید. اما اگر میخواهید درباره هشدارهای بودجه بیشتر بدانید، یک هشدار جدید تنظیم کنید یا یک هشدار موجود را اصلاح کنید، این بخش برای شما مناسب است!
بودجه و هشدار اولیه بودجه را تنظیم کنید
این بخش بودجه ها و هشدارهای بودجه را در سطح بالا با زمینه Firebase توصیف می کند. برای اطلاعات دقیق، حتماً هشدارهای تنظیم بودجه را در اسناد Google Cloud بررسی کنید.
در اینجا نحوه تنظیم بودجه و هشدار اولیه بودجه آورده شده است:
به تنظیمات بودجه بروید:
به پروژه خود در کنسول Firebase دسترسی پیدا کنید، سپس به صفحه استفاده و صورتحساب > جزئیات و تنظیمات بروید.
در بخش بودجه و هشدارها ، روی ایجاد اولین بودجه کلیک کنید. این شما را به صفحه بودجهها و هشدارها در کنسول Cloud میبرد.
توجه داشته باشید که اگر قبلاً بودجه ای تنظیم کرده اید، آن را به جای پیوند "ایجاد اولین بودجه" در اینجا خواهید دید.
مراحل زیر را برای تنظیم بودجه و هشدار بودجه ایمیل شده تکمیل کنید:
یک بودجه موجود را انتخاب کنید یا یک بودجه جدید ایجاد کنید.
به بودجه خود یک نام توصیفی بدهید.
محدوده را برای هشدار بودجه تنظیم کنید، از جمله پروژه(ها) و سرویس(هایی) که می خواهید هشدار بودجه برای آنها اعمال شود. هنگام شروع هشدارهای بودجه، احتمالاً می خواهید همه خدمات را انتخاب کنید.
مقدار > نوع بودجه را با استفاده از یکی از این گزینه ها تنظیم کنید:
مقدار مشخصی از پول - از این نوع زمانی که برای اولین بار شروع به کار می کنید یا برنامه خود را آزمایش می کنید، استفاده کنید
مبلغی برابر با مبلغی که پروژه شما در ماه گذشته خرج کرده است - زمانی که برنامه شما به طور پیوسته در حال رشد است و نمی خواهید مبلغ بودجه را هر ماه به روز کنید از این نوع استفاده کنید.
درصد هشدارهای بودجه را تنظیم کنید.
برای آزمایش اولیه، چندین درصد مانند 1٪، 2٪، 5٪ و 50٪ واقعی را امتحان کنید.
برای برنامههای تولیدی، درصدهای محوری مانند 50 درصد و 100 درصد واقعی و همچنین 150 درصد از پیشبینیشده را امتحان کنید.
تعیین کنید چه کسی باید ایمیل دریافت کند.
به طور پیشفرض، هر کسی که مجوزهای صورتحساب مناسب را داشته باشد، ایمیل اعلان را دریافت میکند (بهطور پیشفرض، مدیران حساب صورتحساب و کاربران حساب صورتحساب در حساب Cloud Billing مرتبط).
همچنین می توانید برای سایر افراد تیم خود ایمیل ارسال کنید. این کار مستلزم ایجاد یک فضای کاری Cloud Monitoring و سپس افزودن یک کانال اعلان مبتنی بر ایمیل به بخش Alerting فضای کاری است. برای اطلاعات بیشتر در مورد این تنظیم، به تنظیم هشدارهای صورتحساب پیشرفته و منطق مراجعه کنید.
اگر اعلانی را برای درصد پایینی از بودجه (مثل 1٪) تنظیم کنید، باید ظرف چند ساعت یا چند روز ایمیلی دریافت کنید که به شما بگوید پروژه شما به آن آستانه رسیده است.
از Cloud Monitoring برای ایجاد هشدارهای پیچیدهتر برای صورتحساب و استفاده، از جمله هشدارهای سفارشی که اعلانها را به رسانههای دیگر مانند Slack ارسال میکنند، استفاده کنید.
منطق صورتحساب اضافی را بر اساس Google CloudPub/Sub ایجاد کنید.
تاریخ آخرین بهروزرسانی 2025-08-22 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-08-22 بهوقت ساعت هماهنگ جهانی."],[],[],null,["Whether you're just starting out developing your app or you have a full-blown\nproduction app, you want to make sure you understand your costs and how to avoid\nsurprise bills.\n\nIf you haven't already, check out the [Firebase pricing\nplans](/docs/projects/billing/firebase-pricing-plans) to understand how billing\nfor works for Firebase.\n| **Important:** **Firebase pricing plans apply to the entire project, not just to\nindividual apps registered in the project.** When you're determining which pricing plan is right for you, consider the usage from *all the apps* registered in the same project. Learn more about [best practices](/docs/projects/dev-workflows/general-best-practices) for when to add multiple apps to the same Firebase project. \n\nThis page guides you through important aspects of understanding and monitoring\nyour usage and spend levels, including:\n\n- [Testing your code](#test-code)\n- [Viewing your usage and spending levels](#view-usage-and-spending-levels)\n- [Setting up budget alert emails](#set-up-budget-alert-emails)\n\n*** ** * ** ***\n\nTest your code\n\nTesting your code before deploying to production is a great idea for many\nreasons, like catching errors that might cost you significant amounts of money.\nAs you're building the infrastructure for your app, **we highly recommend first\ntesting locally using the [Firebase Local Emulator Suite](/docs/emulator-suite)**.\n\nThe Local Emulator Suite allows you to run instances of Cloud Functions,\nCloud Firestore, the Realtime Database and more all locally on your desktop machine.\nThis not only makes it easier for you to quickly iterate on new functionality ---\nparticularly Cloud Functions --- but it also ensures that you don't incur any\nFirebase costs that might result from testing against services in production.\n\nAs you're testing, check for these common causes of exceeding expected usage and\nspend:\n\n- Forgetting to add a limit to a database query with millions of results\n\n- Combinations of Cloud Functions that cause excessive fan-out workloads\n or even infinite loops\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n\u003cbr /\u003e\n\nView your usage and spending levels\n\nYou need to know what normal usage patterns look like for your app and make sure\nyou're staying within thresholds important to you.\n| Most Firebase products provide product-specific documentation about usage, quotas, and pricing. They also often provide usage-to-billing examples for the product. Visit a product's section in the Firebase documentation to find this type of information.\n|\n| For example, here's documentation to\n| [understand billing for Cloud Firestore](/docs/firestore/pricing).\n\nView individual product usage\n\nYou can view individual product usage in the \"Usage\" tab for many products in\nthe Firebase console.\n\n- You can view specific date ranges in these dashboards.\n\n- Product-level dashboards are available for\n [Authentication](//console.firebase.google.com/project/_/authentication/usage)\n and all the infrastructure products:\n [Realtime Database](//console.firebase.google.com/project/_/database/usage),\n [Cloud Firestore](//console.firebase.google.com/project/_/firestore/usage),\n [Cloud Storage](//console.firebase.google.com/project/_/storage/usage),\n [Cloud Functions](//console.firebase.google.com/project/_/functions/usage),\n and [Hosting](//console.firebase.google.com/project/_/hosting/usage).\n\nView overall project usage\n\nYou can view your project's overall usage in the\n[*Usage and billing* dashboard](//console.firebase.google.com/project/_/usage)\nin the Firebase console (go to *Project Settings* \\\u003e *Usage and billing*).\n\n- You can view your monthly usage and how your usage levels are\n measuring up to the allocated no-cost usage quota.\n\n- Click into any product to review a daily summary of usage and how it\n measures up to the allocated no-cost usage quota.\n\nRemember that each product has different usage quotas and thus different\ntimelines, for example:\n\n- Cloud Firestore and Cloud Storage usage are calculated daily.\n\n- Cloud Functions usage is calculated monthly.\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n\u003cbr /\u003e\n\nSet up budget alert emails\n\nAvoid surprises on your bill by creating budgets in\nGoogle Cloud Billing and setting up budget alerts.\n\n- *Budgets* are general monetary amounts that you plan on spending each month.\n\n- *Budget alerts* are email notifications sent to your team if your project\n exceeds a set spending threshold.\n\n| Be aware that **budgets and budget alerts do\n| *not* cap your usage or charges** and that there's a delay between incurring costs and receiving a budget alert (depending on the service, up to a few days). Budgets and budget alerts are intended to help you monitor your spending and to *alert* you about your costs so that you can take action, if needed. For example, you might consider [using\n| budget notifications to programmatically disable Cloud Billing on a\n| project](//cloud.google.com/billing/docs/how-to/disable-billing-with-notifications).\n\nBy default, Firebase and Google Cloud don't turn off services and usage based on\nyour budget and thresholds because although you *might* have a bug in your app\ncausing an increase in charges, you might just be experiencing unexpected\npositive growth of your app. You don't want your app to shut down unexpectedly\nwhen you need it to work the most.\n\nYou might already have a budget alert if you upgraded to a Blaze pricing plan\nrecently. But if you want to learn more about budget alerts, set up a new alert,\nor modify an existing alert, this section is for you!\n| [All Firebase\n| projects are actually Google Cloud projects](/docs/projects/learn-more#firebase-cloud-relationship) behind the scenes, which means billing is shared across Firebase and Google Cloud and you can view the same project in both the Firebase console and the Google Cloud console.\n\nSet up a budget and a basic budget alert\n\nThis section describes budgets and budget alerts at a high-level with a\nFirebase-context. For detailed information, make sure to check out\n[Set budget alerts](//cloud.google.com/billing/docs/how-to/budgets)\nin the Google Cloud documentation.\n| **Note:** To set up a budget or a budget alert, you need to be an Owner of the associated Cloud Billing account.\n\nHere's how to set up a budget and a basic budget alert:\n\n1. Navigate to the budget settings:\n\n 1. Access your project in the Firebase console, then go to the\n **Usage and billing** \\\u003e [**Details \\& settings** page](//console.firebase.google.com/u/0/project/_/usage/details).\n\n 2. In the **Budgets \\& Alerts** section, click **Create first budget** . This\n takes you to the **Budgets \\& alerts** page in the\n Cloud console.\n\n Note that if you already have a budget set up, you'll see it here\n instead of the \"Create first budget\" link.\n2. Complete the following steps to set up a budget and an emailed budget alert:\n\n 1. Select an existing budget or create a new one.\n\n 2. Give your budget a descriptive name.\n\n 3. Set the scope for the budget alert, including the project(s) and\n service(s) that you want the budget alert to apply to. You probably want\n to select *All services* when getting started with budget alerts.\n\n 4. Set the *Amount* \\\u003e *Budget type* using one of these options:\n\n - **A set amount of money** -- use this type when you're first starting\n out or testing your app\n\n - **An amount equal to what your project spent last month** --\n use this type when your app is growing steadily and you don't want\n to keep updating the budget amount every month\n\n 5. Set up *Percent of budget* alerts.\n\n - For initial testing, try out several percentages, like 1%, 2%, 5%,\n and 50% of *Actual*.\n\n - For production apps, try out pivotal percentages, like\n 50% and 100% of *Actual* as well as 150% of *Forecasted*.\n\n | **Tip:** Set a limited number of alert thresholds for your production apps. You want to be informed, but you don't want so many email notifications that you stop paying attention to them.\n 6. Set up who should get emails.\n\n - By default, anyone with the appropriate billing permissions gets the\n notification email (by default, Billing Account Administrators and\n Billing Account Users on the associated Cloud Billing account).\n\n - You can also send emails to other people on your team. This requires\n creating a Cloud Monitoring Workspace and then adding an\n email-based notification channel to the *Alerting* section of the\n workspace. For more information about this setup, visit\n [Set up advanced billing alerts and logic](/docs/projects/billing/advanced-billing-alerts-logic).\n\nIf you set up a notification for a low *Percent of budget* (like 1%),\nyou should get an email within a couple hours or a couple of days telling\nyou that your project has hit that threshold.\n\nNext steps\n\n- Consider using\n [budget notifications to programmatically disable Cloud Billing on a project](//cloud.google.com/billing/docs/how-to/disable-billing-with-notifications).\n\n- Visit\n [Set up advanced billing alerts and logic](/docs/projects/billing/advanced-billing-alerts-logic)\n to learn how to do the following:\n\n - Use Cloud Monitoring to create more sophisticated alerts for billing\n and usage, including custom alerts that send notifications to other\n mediums, like Slack.\n\n - Create additional billing logic based on Google Cloud Pub/Sub."]]