管理 Application Insights 的使用量和成本Manage usage and costs for Application Insights

注意

本文說明如何了解和控制 Application Insights 的成本。This article describes how to understand and control your costs for Application Insights. 監視使用量和估計成本這篇相關文章會說明如何針對不同的定價模型,檢視多項 Azure 監視功能的使用量和估計成本。A related article, Monitoring usage and estimated costs describes how to view usage and estimated costs across multiple Azure monitoring features for different pricing models.

Application Insights 設計的目的在取得您所需的各項資源,以監視 Web 應用程式的可用性、效能及使用情況 (不論應用程式是裝載在雲端還是內部部署環境)。Application Insights is designed to get everything you need to monitor the availability, performance, and usage of your web applications, whether they're hosted on Azure or on-premises. Application Insights 支援熱門的語言和架構,例如 .NET、Java 以及 Node.js,並與 DevOps 流程與工具整合,例如 Azure DevOps、Jira 和 PagerDuty。Application Insights supports popular languages and frameworks, such as .NET, Java, and Node.js, and integrates with DevOps processes and tools like Azure DevOps, Jira, and PagerDuty. 了解何種因素決定了應用程式的監視成本非常重要。It's important to understand what determines the costs of monitoring your applications. 在本文中,我們會複習驅動應用程式監視成本的因素,以及如何主動監視及控制成本。In this article, we review what drives your application monitoring costs and how you can proactively monitor and control them.

如果您有關於 Application Insights 定價方式的疑問,請在我們的 Microsoft 問與答頁面中張貼問題。If you have questions about how pricing works for Application Insights, you can post a question in our Microsoft Q&A question page.

定價模式Pricing model

Azure Application Insights 的價格是 隨用隨付 模式 (以擷取的資料量做為根據),而且可選擇性地用於需要長時間保留資料的情況。The pricing for Azure Application Insights is a Pay-As-You-Go model based on data volume ingested and optionally for longer data retention. 每項 Application Insights 資源都是個別計費的服務,並且會計入到您的 Azure 訂用帳戶帳單。Each Application Insights resource is charged as a separate service and contributes to the bill for your Azure subscription. 資料量是以 Application Insights 從應用程式接收的未壓縮 JSON 資料套件大小來測量。Data volume is measured as the size of the uncompressed JSON data package that's received by Application Insights from your application. 資料量的測量單位為 GB (10 ^ 9 個位元組) 。Data volume is measured in GB (10^9 bytes). 使用即時計量資料流不會產生任何資料量費用。There is no data volume charge for using the Live Metrics Stream.

多重步驟 Web 測試會產生額外費用。Multi-step web tests incur an additional charge. 多重步驟 Web 測試係指執行一系列動作的 Web 測試。Multi-step web tests are web tests that perform a sequence of actions. 單一頁面的「Ping 測試」不另外收費。There's no separate charge for ping tests of a single page. 針對來自 Ping 測試和多重步驟測試的遙測,收費方式與來自您應用程式的其他遙測一樣。Telemetry from ping tests and multi-step tests is charged the same as other telemetry from your app.

Application Insights 選項 [啟用自訂計量維度的警示] 也會產生額外的成本,因為這會額外建立預先彙總指標。The Application Insights option to Enable alerting on custom metric dimensions can also generate in additional costs because this can result in the creation of additional pre-aggregation metrics. 深入了解 Application Insights 中以記錄為基礎和預先彙總的計量,以及關於 Azure 監視器自訂計量的價格Learn more about log-based and pre-aggregated metrics in Application Insights and about pricing for Azure Monitor custom metrics.

工作區型 Application InsightsWorkspace-based Application Insights

對於將資料傳送至 Log Analytics 工作區的 Application Insights 資源 (稱為工作區型 Application Insights 資源),資料擷取和保留的計費是由 Application Insights 資料所在的工作區來完成。For Application Insights resources which send their data to a Log Analytics workspace, called workspace-based Application Insights resources, the billing for data ingestion and retention is done by the workspace where the Application Insights data is located. 這可讓客戶利用 Log Analytics 定價模式的所有選項,除了「隨用隨付」以外,還包括「容量保留」。This enables customers to leverage all options of the Log Analytics pricing model that includes Capacity Reservations in addition to Pay-As-You-Go. Log Analytics 也有更多的資料保留選項,包括依資料類型的保留期Log Analytics also has more options for data retention, including retention by data type. 工作區中的 Application Insights 資料類型會有 90 天的保留期,而不會產生任何費用。Application Insights data types in the workspace receive 90 days of retention without charges. Web 測試的使用情況與啟用自訂計量維度的警示仍會透過 Application Insights 回報。Usage of web tests and enabling alerting on custom metric dimensions is still reported through Application Insights. 了解如何使用使用量和估計成本Azure 成本管理 + 計費Log Analytics 查詢,追蹤 Log Analytics 中的資料擷取和保留成本。Learn how to track data ingestion and retention costs in Log Analytics using the Usage and estimated costs, Azure Cost Management + Billing and Log Analytics queries.

估算應用程式的管理成本Estimating the costs to manage your application

如果您尚未使用 Application Insights,則可以使用 Azure 監視器定價計算機來估算 Application Insights 的使用成本。If you're not yet using Application Insights, you can use the Azure Monitor pricing calculator to estimate the cost of using Application Insights. 一開始請先在 [搜尋] 方塊中輸入「Azure 監視器」,然後按一下產生的 [Azure 監視器] 圖格。Start by entering "Azure Monitor" in the Search box, and clicking on the resulting Azure Monitor tile. 將頁面向下捲動至 Azure 監視器,然後從 [類型] 下拉式清單中選取 [Application Insights]。Scroll down the page to Azure Monitor, and select Application Insights from the Type dropdown. 您可以在這裡輸入每月預期收集的資料 GB 數,因此,問題在於 Application Insights 會收集多少資料來監視您的應用程式。Here you can enter the number of GB of data you expect to collect per month, so the question is how much data will Application Insights collect monitoring your application.

有兩種方法可以解決這種情況:使用預設的監視和調適型取樣 (可在 ASP.NET SDK 中取得),或根據其他類似的客戶情況來估計可能的資料擷取。There are two approaches to address this: use of default monitoring and adaptive sampling, which is available in the ASP.NET SDK, or estimate your likely data ingestion based on what other similar customers have seen.

使用取樣時的資料收集Data collection when using sampling

使用 ASP.NET SDK 的調適型取樣,會自動調整資料量,使其保持在預設 Application Insights 監視的指定最大流量速率內。With the ASP.NET SDK's adaptive sampling, the data volume is adjusted automatically to keep within a specified maximum rate of traffic for default Application Insights monitoring. 如果應用程式產生的遙測量很低 (例如,在偵錯時或由於低使用量的緣故),只要數量低於設定的每秒事件數目層級,取樣處理器就不會捨棄項目。If the application produces a low amount of telemetry, such as when debugging or due to low usage, items won't be dropped by the sampling processor as long as volume is below the configured events per second level. 對於大量應用程式,預設閾值為每秒五個事件,調適型取樣會將每日事件數目限制為 432,000。For a high volume application, with the default threshold of five events per second, adaptive sampling will limit the number of daily events to 432,000. 使用 1 KB 的一般平均事件大小,這會對應13.4 到每個節點每31天的遙測資料(每個節點裝載您的應用程式),因為取樣是在每個節點的本機完成。Using a typical average event size of 1 KB, this corresponds to 13.4 GB of telemetry per 31-day month per node hosting your application since the sampling is done local to each node.

注意

Azure 監視器記錄資料大小的計算單位為 GB (1 GB = 10 ^ 9 個位元組) 。Azure Monitor log data size is calculated in GB (1 GB = 10^9 bytes).

對於不支援調適型取樣的軟體開發套件,您可以採用擷取取樣,當 Application Insights 收到資料時,根據要保留的資料百分比,或適用於 ASP.NET、ASP.NET Core 和 Java 網站的固定取樣率,來進行取樣,藉此減少從網頁伺服器和網頁瀏覽器傳送的流量For SDKs that don't support adaptive sampling, you can employ ingestion sampling, which samples when the data is received by Application Insights based on a percentage of data to retain, or fixed-rate sampling for ASP.NET, ASP.NET Core, and Java websites to reduce the traffic sent from your web server and web browsers

從類似客戶收集內容中了解Learn from what similar customers collect

在適用於 Application Insights 的 Azure 監視定價計算機中,如果您啟用「根據應用程式活動估算資料量」功能,您可以提供應用程式的相關輸入 (如果您要收集用戶端遙測,則可提供每月要求和每月頁面檢視次數),然後計算機會讓您知道類似的應用程式所收集資料量的中位數和第 90 個百分位數。In the Azure Monitoring Pricing calculator for Application Insights, if you enable the "Estimate data volume based on application activity" functionality, you can provide inputs about your application (requests per month and page views per month, in case you will collect client-side telemetry), and then the calculator will tell you the median and 90th percentile amount of data collected by similar applications. 這些應用程式跨越 Application Insights 設定的範圍 (例如,有些有預設的取樣,有些沒有取樣等等),因此,您仍然可以使用取樣,控制將擷取的資料量減少到遠低於中位數層級以下。These applications span the range of Application Insights configuration (e.g some have default sampling, some have no sampling etc.), so you still have the control to reduce the volume of data you ingest far below the median level using sampling. 但這是了解其他類似客戶看法的起點。But this is a starting point to understand what other, similar customers are seeing.

了解您的使用量並估算成本Understand your usage and estimate costs

Application Insights 可讓您根據最近的使用模式,輕鬆了解可能產生的成本。Application Insights makes it easy to understand what your costs are likely to be based on recent usage patterns. 若要開始,請在 Azure 入口網站中,針對 Application Insights 資源,移至 [使用量和估計成本] 頁面:To get started, in the Azure portal, for the Application Insights resource, go to the Usage and estimated costs page:

選擇價格

A.A. 檢閱當月的資料量。Review your data volume for the month. 這包括從您的伺服器和用戶端應用程式,以及從可用性測試接收並保留的所有資料 (在任何取樣之後)。This includes all the data that's received and retained (after any sampling) from your server and client apps, and from availability tests.
B.B. 多重步驟的 web 測試會另外收費。A separate charge is made for Multi-step web tests. (這不包括簡單的可用性測試,其已包含在資料量費用中。)(This doesn't include simple availability tests, which are included in the data volume charge.)
C.C. 檢視上個月的資料量趨勢。View data volume trends for the past month.
D.D. 啟用資料擷取取樣Enable data ingestion sampling. E.E. 設定每日資料量上限。Set the daily data volume cap.

(請注意,本文中螢幕擷取畫面顯示的所有價格僅供範例使用。(Note that all prices displayed in screenshots in this article are for example purposes only. 如需屬於您貨幣與區域的目前定價,請參閱 Application Insights 價格。)For current prices in your currency and region, see Application Insights pricing.)

若要更深入調查 Application Insights 的使用量,請開啟 [計量] 頁面,新增名為「資料點量」的計量,然後選取 [套用分割] 選項,以根據「遙測項目類型」拆分資料。To investigate your Application Insights usage more deeply, open the Metrics page, add the metric named "Data point volume", and then select the Apply splitting option to split the data by "Telemetry item type".

Application Insights 費用會加到您的 Azure 帳單中。Application Insights charges are added to your Azure bill. 您可以在 Azure 入口網站的 [成本管理 + 計費] 區段中,或在 Azure 計費入口網站中,查看您的 Azure 帳單詳細資料。You can see details of your Azure bill in the Cost Management + Billing section of the Azure portal, or in the Azure billing portal. 如需使用 Application Insights 的詳細資料,請參閱下列內容See below for details on using this for Application Insights.

在左側功能表中,選取 [帳務]

使用資料量計量Using data volume metrics

若要深入了解您的資料量,請選取 Application Insights 資源的 計量,然後新增新的圖表。To learn more about your data volumes, selecting Metrics for your Application Insights resource, add a new chart. 對於圖表計量,請在 [以記錄為基礎的計量] 下,選取 [資料點量]。For the chart metric, under Log-based metrics, select Data point volume. 按一下 [套用分割],並依 [Telemetryitem 類型] 選取群組。Click Apply splitting, and select group by Telemetryitem type.

使用計量以查看資料量

了解資料量詳細資料的查詢Queries to understand data volume details

有兩種方法可以調查 Application Insights 的資料量。There are two approaches to investigating data volumes for Application Insights. 第一個會使用 systemEvents 資料表中的彙總資訊,而第二個使用 _BilledSize 屬性,這在每個內嵌事件上都有提供。The first uses aggregated information in the systemEvents table, and the second uses the _BilledSize property, which is available on each ingested event. systemEvents 不會有 workspace-based-application-insights 的資料大小資訊。systemEvents will not have data size information for workspace-based-application-insights.

使用彙總資料量資訊Using aggregated data volume information

例如,您可以使用 systemEvents 資料表,透過查詢來查看過去 24 小時內擷取的資料量:For instance, you can use the systemEvents table to see the data volume ingested in the last 24 hours with the query:

systemEvents
| where timestamp >= ago(24h)
| where type == "Billing"
| extend BillingTelemetryType = tostring(dimensions["BillingTelemetryType"])
| extend BillingTelemetrySizeInBytes = todouble(measurements["BillingTelemetrySize"])
| summarize sum(BillingTelemetrySizeInBytes)

或者,若要查看過去 30 天內依資料類型分類的資料量 (以位元組為單位),您可以使用:Or to see a chart of data volume (in bytes) by data type for the last 30 days, you can use:

systemEvents
| where timestamp >= startofday(ago(30d))
| where type == "Billing"
| extend BillingTelemetryType = tostring(dimensions["BillingTelemetryType"])
| extend BillingTelemetrySizeInBytes = todouble(measurements["BillingTelemetrySize"])
| summarize sum(BillingTelemetrySizeInBytes) by BillingTelemetryType, bin(timestamp, 1d) | render barchart  

請注意,您可以在 Azure 記錄警示中使用此查詢,以設定資料量的警示。Note that this query can be used in an Azure Log Alert to set up alerting on data volumes.

若要深入了解您的遙測資料變更,我們可以使用查詢,依類型取得事件計數:To learn more about your telemetry data changes, we can get the count of events by type using the query:

systemEvents
| where timestamp >= startofday(ago(30d))
| where type == "Billing"
| extend BillingTelemetryType = tostring(dimensions["BillingTelemetryType"])
| summarize count() by BillingTelemetryType, bin(timestamp, 1d)
| render barchart  

使用每個事件的資料大小資訊Using data size per event information

若要深入了解資料量的來源,您可以使用出現在每個內嵌事件上的 _BilledSize 屬性。To learn more details about the source of your data volumes, you can use the _BilledSize property that is present on each ingested event.

例如,若要查看過去 30 天內產生最多資料量的作業,我們可以加總所有相依性事件的 _BilledSizeFor example, to look at which operations generate the most data volume in the last 30 days, we can sum _BilledSize for all dependency events:

dependencies
| where timestamp >= startofday(ago(30d))
| summarize sum(_BilledSize) by operation_Name
| render barchart  

工作區型 Application Insights 資源的資料量Data volume for workspace-based Application Insights resources

若要查看上週工作區中所有工作區型 Application Insights 資源 的資料量趨勢,請前往 Log Analytics 工作區,並執行查詢:To look at the data volume trends for all of the workspace-based Application Insights resources in a workspace for the last week, go to the Log Analytics workspace and run the query:

union (AppAvailabilityResults),
      (AppBrowserTimings),
      (AppDependencies),
      (AppExceptions),
      (AppEvents),
      (AppMetrics),
      (AppPageViews),
      (AppPerformanceCounters),
      (AppRequests),
      (AppSystemEvents),
      (AppTraces)
| where TimeGenerated >= startofday(ago(7d)) and TimeGenerated < startofday(now())
| summarize sum(_BilledSize) by _ResourceId, bin(TimeGenerated, 1d)
| render areachart

若要針對以特定工作區型 Application Insights 資源,依類型來查詢資料量趨勢,請在 Log Analytics 工作區中使用:To query the data volume trends by type for a specific workspace-based Application Insights resource, in the Log Analytics workspace use:

union (AppAvailabilityResults),
      (AppBrowserTimings),
      (AppDependencies),
      (AppExceptions),
      (AppEvents),
      (AppMetrics),
      (AppPageViews),
      (AppPerformanceCounters),
      (AppRequests),
      (AppSystemEvents),
      (AppTraces)
| where TimeGenerated >= startofday(ago(7d)) and TimeGenerated < startofday(now())
| where _ResourceId contains "<myAppInsightsResourceName>"
| summarize sum(_BilledSize) by Type, bin(TimeGenerated, 1d)
| render areachart

在您的 Azure 帳單上查看 Application Insights 使用量Viewing Application Insights usage on your Azure bill

Azure 在 Azure 成本管理 + 計費中樞內提供了許多實用的功能。Azure provides a great deal of useful functionality in the Azure Cost Management + Billing hub. 例如,「成本分析」功能可讓您檢視 Azure 資源的花費。For instance, the "Cost analysis" functionality enables you to view your spends for Azure resources. 依資源類型新增篩選條件 (新增至 Application Insights 的 microsoft.insights/components) 可讓您追蹤費用。Adding a filter by resource type (to microsoft.insights/components for Application Insights) will allow you to track your spending. 然後在 [群組依據] 中選取 [計量類別] 或 [計量]。Then for "Group by" select "Meter category" or "Meter". 對於目前價格方案中的 Application Insights 資源,由於所有 Azure 監視器元件都有單一記錄後端,因此大部分使用量會顯示為「計量」類別的 Log Analytics。For Application Insights resources on the current pricing plans, most usage will show up as Log Analytics for the Meter category since there is a single logs backend for all Azure Monitor components.

若要更加了解您的使用量,請從 Azure 入口網站下載使用量More understanding of your usage can be gained by downloading your usage from the Azure portal. 在下載的試算表中,您可以看到每天每個 Azure 資源的使用量。In the downloaded spreadsheet, you can see usage per Azure resource per day. 在此 Excel 試算表中,您可以藉由先篩選「計量類別」資料行來顯示「Application Insights」和「Log Analytics」,然後在「包含 microsoft.insights/components」的「執行個體識別碼」資料行上新增篩選條件,來找到您的 Application Insights 資源使用量。In this Excel spreadsheet, usage from your Application Insights resources can be found by first filtering on the "Meter Category" column to show "Application Insights" and "Log Analytics", and then adding a filter on the "Instance ID" column which is "contains microsoft.insights/components". 由於所有 Azure 監視器元件都有單一記錄後端,因此,大部分 Application Insights 使用量都會以 Log Analytics 計量類別的計量報告。Most Application Insights usage is reported on meters with the Meter Category of Log Analytics, since there is a single logs backend for all Azure Monitor components. 只有舊版定價層和多重步驟 Web 測試的 Application Insights 資源,會以 Application Insights 的計量類別來報告。Only Application Insights resources on legacy pricing tiers and multi-step web tests are reported with a Meter Category of Application Insights. 使用量會顯示在 [已取用的數量] 資料行,每個項目的單位則會顯示在 [測量單位] 資料行。The usage is shown in the "Consumed Quantity" column and the unit for each entry is shown in the "Unit of Measure" column. 有更多詳細資料可協助您了解 Microsoft Azure 帳單More details are available to help you understand your Microsoft Azure bill.

管理您的資料量Managing your data volume

您可以使用下列技術來管理您傳送的資料量:The volume of data you send can be managed using the following techniques:

  • 取樣:您可以使用取樣來減少從伺服器和用戶端應用程式傳送的遙測量,這對計量的扭曲程度最小。Sampling: You can use sampling to reduce the amount of telemetry that's sent from your server and client apps, with minimal distortion of metrics. 取樣是您可用來調整所傳送資料量的主要工具。Sampling is the primary tool you can use to tune the amount of data you send. 深入了解取樣功能Learn more about sampling features.

  • 限制 Ajax 呼叫:您可以 限制可回報的 Ajax 呼叫次數 (在每個頁面檢視中),或關閉 Ajax 報告功能。Limit Ajax calls: You can limit the number of Ajax calls that can be reported in every page view, or switch off Ajax reporting. 請注意,停用 Ajax 呼叫將會停用 JavaScript 相互關聯Note that disabling Ajax calls will disable JavaScript correlation.

  • 停用不必要的模組編輯 ApplicationInsights.config以關閉您不需要的集合模組。Disable unneeded modules: Edit ApplicationInsights.config to turn off collection modules that you don't need. 例如,您可能會決定效能計數器或相依性資料是不必要的。For example, you might decide that performance counters or dependency data are inessential.

  • 預先彙總計量:如果您在應用程式中呼叫 TrackMetric,便可以使用接受一批測量之平均及標準差計算的多載來減少流量。Pre-aggregate metrics: If you put calls to TrackMetric in your app, you can reduce traffic by using the overload that accepts your calculation of the average and standard deviation of a batch of measurements. 或者,您也可以使用預先彙總套件Or, you can use a pre-aggregating package.

  • 每日上限:在 Azure 入口網站中建立 Application Insights 資源時,每日上限會設定為每日 100 GB。Daily cap: When you create an Application Insights resource in the Azure portal, the daily cap is set to 100 GB/day. 在 Visual Studio 中建立 Application Insights 資源時,預設值很小 (只有每日 32.3 MB)。When you create an Application Insights resource in Visual Studio, the default is small (only 32.3 MB/day). 每日上限預設值的設定是為了協助測試。The daily cap default is set to facilitate testing. 這是預期使用者在將應用程式部署至生產環境之前,會提高每日上限。It's intended that the user will raise the daily cap before deploying the app into production.

    除非您針對高流量的應用程式要求更高的最大值,否則每日的最高上限是 1,000 GB。The maximum cap is 1,000 GB/day unless you request a higher maximum for a high-traffic application.

    關於每日上限的警告電子郵件會針對您的 Application Insights 資源,傳送給下列角色的成員帳戶:「ServiceAdmin」、「AccountAdmin」、「CoAdmin」、「Owner」。Warning emails about the daily cap are sent to account that are members of these roles for your Application Insights resource: "ServiceAdmin", "AccountAdmin", "CoAdmin", "Owner".

    設定每日上限時,請務必小心。Use care when you set the daily cap. 您的目的應該是「一律不要達到每日上限」。Your intent should be to never hit the daily cap. 如果達到每日上限,就會失去當天其餘時間的資料,而無法監視應用程式。If you hit the daily cap, you lose data for the remainder of the day, and you can't monitor your application. 若要變更每日上限,請使用 [每日用量上限] 選項。To change the daily cap, use the Daily volume cap option. 您可以在 [使用量和估計成本] 窗格中存取此選項 (本文稍後會有更詳細的說明)。You can access this option in the Usage and estimated costs pane (this is described in more detail later in the article).

    我們已移除某些訂用帳戶類型的信用額度無法用於 Application Insights 的限制。We've removed the restriction on some subscription types that have credit that couldn't be used for Application Insights. 先前,如果訂用帳戶有消費限制,則 [每日上限] 對話方塊中會有指示,說明如何移除消費限制並讓每日上限提高到每日 32.3 MB 以上。Previously, if the subscription has a spending limit, the daily cap dialog has instructions to remove the spending limit and enable the daily cap to be raised beyond 32.3 MB/day.

  • 節流:節流會將資料速率限制在每秒 32,000 個事件 (每個檢測金鑰以 1 分鐘計算平均值)。Throttling: Throttling limits the data rate to 32,000 events per second, averaged over 1 minute per instrumentation key. 系統會每分鐘評估應用程式傳送的資料量。The volume of data that your app sends is assessed every minute. 如果每秒速率超過每分鐘平均值,伺服器會拒絕部分要求。If it exceeds the per-second rate averaged over the minute, the server refuses some requests. SDK 會緩衝處理資料,然後嘗試重新傳送它。The SDK buffers the data and then tries to resend it. 它會在數分鐘的期間內散佈大量資料。It spreads out a surge over several minutes. 如果應用程式始終以高於節流速率的方式傳送資料,有些資料會就遭到捨棄。If your app consistently sends data at more than the throttling rate, some data will be dropped. (ASP.NET、Java 和 JavaScript SDK 會嘗試以此方式重新傳送資料,其他 SDK 則可能直接捨棄節流的資料)。當節流發生時,會有通知警告來警示您已發生這種情況。(The ASP.NET, Java, and JavaScript SDKs try to resend data this way; other SDKs might simply drop throttled data.) If throttling occurs, a notification warning alerts you that this has occurred.

管理您的每日最大資料量Manage your maximum daily data volume

您可以使用每日用量上限來限制所收集的資料。You can use the daily volume cap to limit the data collected. 不過,如果達到上限,就會失去當天其餘時間從您應用程式傳送的所有遙測資料。However, if the cap is met, a loss of all telemetry sent from your application for the remainder of the day occurs. 建議您「不要」讓應用程式達到每日上限。It is not advisable to have your application hit the daily cap. 一旦應用程式達到每日上限,您便無法追蹤應用程式的健康情況和效能。You can't track the health and performance of your application after it reaches the daily cap.

請不要使用每日用量上限,而是改用取樣將資料量調整到您想要的程度。Instead of using the daily volume cap, use sampling to tune the data volume to the level you want. 然後,只使用每日上限作為應付萬一應用程式開始未預期地傳送大量遙測時的「最後手段」。Then, use the daily cap only as a "last resort" in case your application unexpectedly begins to send much higher volumes of telemetry.

識別要定義的每日資料限制Identify what daily data limit to define

檢閱 Application Insights 使用量和估計成本,以了解資料擷取趨勢及要定義的每日資料量上限。Review Application Insights Usage and estimated costs to understand the data ingestion trend and what is the daily volume cap to define. 請謹慎考量,因為達到限制之後,您將無法監視您的資源。It should be considered with care, since you won't be able to monitor your resources after the limit is reached.

設定每日上限Set the Daily Cap

若要變更每日上限,請在 Application Insights 資源的 [設定] 區段中,從 [使用量和估計成本] 頁面中選取 [每日上限]。To change the daily cap, in the Configure section of your Application Insights resource, in the Usage and estimated costs page, select Daily Cap.

調整每日遙測資料量上限

若要透過 Azure Resource Manager 變更每日上限,要變更的屬性為 dailyQuotaTo change the daily cap via Azure Resource Manager, the property to change is the dailyQuota. 透過 Azure Resource Manager,您也可以設定 dailyQuotaResetTime 和每日上限的 warningThresholdVia Azure Resource Manager you can also set the dailyQuotaResetTime and the daily cap's warningThreshold.

建立每日上限的警示Create alerts for the Daily Cap

當內嵌資料量達到警告層級或每日上限層級時,Application Insights 每日上限會在 Azure 活動記錄中建立事件。The Application Insights Daily Cap creates an event in the Azure activity log when the ingested data volumes reaches the warning level or the daily cap level. 您可以根據活動記錄事件建立警示You can create an alert based on these activity log events. 這些事件的訊號名稱包括:The signal names for these events are:

  • 已達到 Application Insights 元件每日上限警告閾值Application Insights component daily cap warning threshold reached

  • 已達到 Application Insights 元件每日上限Application Insights component daily cap reached

取樣Sampling

取樣 是一種方法,可減少將遙測傳送至應用程式的速率,同時保留在診斷搜尋期間尋找相關事件的能力。sampling is a method of reducing the rate at which telemetry is sent to your app, while retaining the ability to find related events during diagnostic searches. 此外,也保留正確的事件計數。You also retain correct event counts.

取樣可有效減少費用並維持在每月配額內。Sampling is an effective way to reduce charges and stay within your monthly quota. 取樣演算法會保留相關的遙測項目,因此,例如在使用 [搜尋] 時,您便可以找到與特定例外狀況相關的要求。The sampling algorithm retains related items of telemetry so, for example, when you use Search, you can find the request related to a particular exception. 此演算法也會保留正確的計數,因此您在 [計量瀏覽器] 中會看到要求率、例外狀況率及其他計數的正確值。The algorithm also retains correct counts so you see the correct values in Metric Explorer for request rates, exception rates, and other counts.

取樣有數種形式。There are several forms of sampling.

  • 調適型取樣是 ASP.NET SDK 的預設值。Adaptive sampling is the default for the ASP.NET SDK. 調適型取樣會自動針對應用程式所傳送的遙測量進行調整。Adaptive sampling automatically adjusts to the volume of telemetry that your app sends. 這會自動在 Web 應用程式的 SDK 中運作,以便降低網路上的遙測流量。It operates automatically in the SDK in your web app so that telemetry traffic on the network is reduced.
  • 是替代方法,它會在遙測從應用程式進入 Application Insights 服務時運作。Ingestion sampling is an alternative that operates at the point where telemetry from your app enters the Application Insights service. 擷取取樣不會影響從應用程式傳送的遙測量,但可減少服務所保留的量。Ingestion sampling doesn't affect the volume of telemetry sent from your app, but it reduces the volume that's retained by the service. 您可以使用擷取取樣來減少被來自瀏覽器及其他 SDK 的遙測用光的配額。You can use ingestion sampling to reduce the quota that's used up by telemetry from browsers and other SDKs.

若要設定擷取取樣,請移至 [定價] 窗格:To set ingestion sampling, go to the Pricing pane:

在 [配額和定價] 窗格中,選取 [範例] 圖格,然後選取一個取樣分數

警告

[資料取樣] 窗格只會控制擷取取樣的值。The Data sampling pane controls only the value of ingestion sampling. 它不會反映應用程式中 Application Insights SDK 所套用的取樣率。It doesn't reflect the sampling rate that's applied by the Application Insights SDK in your app. 如果已在 SDK 中對連入遙測進行取樣,就不會套用擷取取樣。If the incoming telemetry has already been sampled in the SDK, ingestion sampling isn't applied.

若要探索實際的取樣率,而不論其套用位置是哪裡,請使用分析查詢To discover the actual sampling rate, no matter where it's been applied, use an Analytics query. 此查詢看起來像這樣:The query looks like this:

requests | where timestamp > ago(1d)
| summarize 100/avg(itemCount) by bin(timestamp, 1h)
| render areachart

在每個保留的記錄中,itemCount 會指出它所代表的原始記錄數目。In each retained record, itemCount indicates the number of original records that it represents. 它等於 1 + 先前捨棄的記錄數目。It's equal to 1 + the number of previous discarded records.

變更資料保留期Change the data retention period

Application Insights 資源的預設保留期為 90 天。The default retention for Application Insights resources is 90 days. 可以為每個 Application Insights 資源選取不同的保留期間。Different retention periods can be selected for each Application Insights resource. 一組完整的可用保留期間為30、60、90、120、180、270、365、550 或 730 天。The full set of available retention periods is 30, 60, 90, 120, 180, 270, 365, 550 or 730 days. 深入了解較長資料保留期的價格。Learn more about pricing for longer data retention.

若要變更保留期,請從 Application Insights 資源移至 [使用量和估計成本] 頁面,然後選取 [資料保留] 選項:To change the retention, from your Application Insights resource, go to the Usage and Estimated Costs page and select the Data Retention option:

顯示資料保留期限變更位置的螢幕擷取畫面。

縮短保留期的時候,在移除最舊的資料之前會有幾天的寬限期。When the retention is lowered, there is a several day grace period before the oldest data is removed.

您也可以使用 retentionInDays 參數,使用 PowerShell 以程式設計方式設定保留期。The retention can also be set programatically using PowerShell using the retentionInDays parameter. 如果您將資料保留期設定為 30 天,則可以使用 immediatePurgeDataOn30Days 參數來觸發立即清除較舊的資料,這對合規性相關案例可能會有幫助。If you set the data retention to 30 days, you can trigger an immediate purge of older data using the immediatePurgeDataOn30Days parameter, which may be useful for compliance-related scenarios. 此清除功能僅透過 Azure Resource Manager 公開,而且應該小心使用。This purge functionality is only exposed via Azure Resource Manager and should be used with extreme care. 可以使用 Azure Resource Manager 設定 dailyQuotaResetTime 參數,以設定資料量上限的每日重設時間。The daily reset time for the data volume cap can be configured using Azure Resource Manager to set the dailyQuotaResetTime parameter.

使用 Application Insights 的資料傳輸費用Data transfer charges using Application Insights

將資料傳送至 Application Insights 可能會產生資料頻寬費用。Sending data to Application Insights might incur data bandwidth charges. Azure 頻寬定價頁面所述,在位於兩個區域的 Azure 服務之間資料傳輸時,會依正常費率向輸出資料傳輸收費。As described in the Azure Bandwidth pricing page, data transfer between Azure services located in two regions charged as outbound data transfer at the normal rate. 輸入資料傳輸則是免費的。Inbound data transfer is free. 不過,相較於 Application Insights 的資料擷取成本,這項費用很低 (幾 %)。However, this charge is very small (few %) compared to the costs for Application Insights log data ingestion. 因此,若要控制 Log Analytics 的成本就必須專注在已擷取的資料量上,為了協助您了解這方面的內容,這裡有指導方針。Consequently controlling costs for Log Analytics needs to focus on your ingested data volume, and we have guidance to help understand that here.

限制摘要Limits summary

每個應用程式 (亦即每個檢測金鑰) 都有一些計量和事件的數目限制。There are some limits on the number of metrics and events per application, that is, per instrumentation key. 限制取決於您選擇的定價方案Limits depend on the pricing plan that you choose.

資源Resource 預設限制Default limit 注意Note
每日資料總量Total data per day 100 GB100 GB 您可以設定上限來減少資料。You can reduce data by setting a cap. 如果您需要更多資料,可以從入口網站將限制增加到最多 1,000 GB。If you need more data, you can increase the limit in the portal, up to 1,000 GB. 若容量大於 1000 GB,請傳送電子郵件給 AIDataCap@microsoft.com。For capacities greater than 1,000 GB, send email to AIDataCap@microsoft.com.
節流Throttling 32,000 個事件/秒32,000 events/second 此限制會測量超過一分鐘。The limit is measured over a minute.
資料保留記錄Data retention Logs 30 - 730 天30 - 730 days 此資源適用于 記錄This resource is for Logs.
資料保留計量Data retention Metrics 90 天90 days 此資源適用于 計量瀏覽器This resource is for Metrics Explorer.
可用性多步驟測試詳述的結果保留期Availability multi-step test detailed results retention 90 天90 days 此資源會提供每個步驟的詳細結果。This resource provides detailed results of each step.
遙測項目大小上限Maximum telemetry item size 64 KB64 kB
每個批次的遙測項目數上限Maximum telemetry items per batch 64 K64 K
屬性和度量名稱長度Property and metric name length 150150 請參閱類型結構描述See type schemas.
屬性值字串長度Property value string length 8,1928,192 請參閱類型結構描述See type schemas.
追蹤和例外狀況訊息長度Trace and exception message length 32,76832,768 請參閱類型結構描述See type schemas.
每個應用程式的可用性測試計數Availability tests count per app 100100
分析工具資料保留期Profiler data retention 5 天5 days
每天傳送的分析工具資料Profiler data sent per day 10 GB10 GB

如需詳細資訊,請參閱關於 Application Insights 中的價格和配額For more information, see About pricing and quotas in Application Insights.

停用每日上限電子郵件Disable daily cap e-mails

若要停用每日數量上限電子郵件,請在 Application Insights 資源的 [設定] 區段之下,從 [使用量和估計成本] 窗格選取 [每日上限]。To disable the daily volume cap e-mails, under the Configure section of your Application Insights resource, in the Usage and estimated costs pane, select Daily Cap. 此處有設定可在達到上限時,以及已達到可調整的警告層級時傳送電子郵件。There are settings to send e-mail when the cap is reached, as well as when an adjustable warning level has been reached. 如果您想停用所有每日上限數量相關的電子郵件,請取消核取這兩個方塊。If you wish to disable all daily cap volume-related emails, uncheck both boxes.

舊版「企業」(每節點) 定價層Legacy Enterprise (Per Node) pricing tier

對於 Azure Application Insights 的早期採用者,還有兩種可能的定價層:基本和企業。For early adopters of Azure Application Insights, there are still two possible pricing tiers: Basic and Enterprise. 「基本」定價層如上所述,而且為預設層。The Basic pricing tier is the same as described above and is the default tier. 它包含所有企業層功能,不需要額外費用。It includes all Enterprise tier features, at no additional cost. 「基本」層主要是針對內嵌的資料量計費。The Basic tier bills primarily on the volume of data that's ingested.

這些舊版定價層已重新命名。These legacy pricing tiers have been renamed. 企業定價層現在稱為 每節點,而基本定價層現在稱為 每 GBThe Enterprise pricing tier is now called Per Node and the Basic pricing tier is now called Per GB. 這些新名稱會在下列項目和 Azure 入口網站中使用。These new names are used below and in the Azure portal.

「每節點」(先前稱為「企業」) 層會針對每個節點計費,而每個節點會收到每日資料額度。The Per Node (formerly Enterprise) tier has a per-node charge, and each node receives a daily data allowance. 在「每節點」定價層中,您要對超過內含資料額度的內嵌資料付費。In the Per Node pricing tier, you are charged for data ingested above the included allowance. 如果您使用 Operations Management Suite,您應該選擇「每節點」層。If you are using Operations Management Suite, you should choose the Per Node tier. 我們在 2018 年 4 月推出新的 Azure 監視定價模型。In April 2018, we introduced a new pricing model for Azure monitoring. 這個模型在完整的監視服務組合之間採用簡單的「隨用隨付」模型。This model adopts a simple "pay-as-you-go" model across the complete portfolio of monitoring services. 深入瞭解新的 計價模式Learn more about the new pricing model.

如需屬於您貨幣與區域的目前定價,請參閱 Application Insights 定價For current prices in your currency and region, see Application Insights pricing.

瞭解每個節點) 層的舊版 Enterprise (的計費使用量Understanding billed usage on the legacy Enterprise (Per Node) tier

如下所述,每個節點的舊版企業 () 層結合了訂用帳戶中所有 Application Insights 資源的使用量,以計算節點數目和資料超額部分。As described below in more detail, the legacy Enterprise (Per Node) tier combines usage from across all Application Insights resources in a subscription to calculate the number of nodes and the data overage. 由於此組合程式,訂用帳戶 中所有 Application Insights 資源的使用方式只會針對其中一個資源回報Due to this combination process, usage for all Application Insights resources in a subscription are reported against just one of the resources. 這會使您的 計費使用量 與您針對每個 Application Insights 資源所觀察到的使用量非常複雜。This makes reconciling your billed usage with the usage you observe for each Application Insights resources very complicated.

警告

由於追蹤和瞭解在舊版企業 (中 Application Insights 資源的使用方式) 層,我們強烈建議使用目前的隨用隨付定價層。Because of the complexity of tracking and understanding usage of Application Insights resources in the legacy Enterprise (Per Node) tier we strongly recommend using the current Pay-As-You-Go pricing tier.

「每節點」層和 Operations Management Suite 訂閱的權利Per Node tier and Operations Management Suite subscription entitlements

先前所宣布,購買 Operations Management Suite E1 和 E2 的客戶可以取得 Application Insights「每節點」做為額外的元件,無須額外付費。Customers who purchase Operations Management Suite E1 and E2 can get Application Insights Per Node as an additional component at no additional cost as previously announced. 具體來說,Operations Management Suite E1 和 E2 的每個單位皆包含一個 Application Insights「每節點」層節點的權利。Specifically, each unit of Operations Management Suite E1 and E2 includes an entitlement to one node of the Application Insights Per Node tier. 每個 Application Insights 節點包含每天最多 200 MB 擷取的資料 (與 Log Analytics 資料擷取分開計算),資料可保留 90 天而無須額外付費。Each Application Insights node includes up to 200 MB of data ingested per day (separate from Log Analytics data ingestion), with 90-day data retention at no additional cost. 本文稍後會更詳細說明此階層。The tier is described in more detailed later in the article.

由於此階層僅適用於具有 Operations Management Suite 訂閱的客戶,因此沒有 Operations Management Suite 訂閱的客戶不會看到可選取此階層的選項。Because this tier is applicable only to customers with an Operations Management Suite subscription, customers who don't have an Operations Management Suite subscription don't see an option to select this tier.

注意

為了確保您取得此權利,您的 Application Insights 資源必須在「每節點」定價層中。To ensure that you get this entitlement, your Application Insights resources must be in the Per Node pricing tier. 此權利只能以節點為單位套用。This entitlement applies only as nodes. 「每 GB」層中的 Application Insights 資源無法實現任何效益。Application Insights resources in the Per GB tier don't realize any benefit. 在 [使用量和估計成本] 窗格中所顯示的估計成本中看不到此權利。This entitlement isn't visible in the estimated costs shown in the Usage and estimated cost pane. 此外,如果您將訂閱移轉至 2018 年 4 月的新 Azure 監視定價模型,「每 GB」層將會是唯一可用的階層。Also, if you move a subscription to the new Azure monitoring pricing model in April 2018, the Per GB tier is the only tier available. 如果您擁有 Operations Management Suite 訂用帳戶,建議您不要將訂用帳戶移轉至新的 Azure 監視定價模型。Moving a subscription to the new Azure monitoring pricing model isn't advisable if you have an Operations Management Suite subscription.

「每節點」層的運作方式How the Per Node tier works

  • 在「每節點」層中,是依照傳送所有應用程式遙測的每一節點付費。You pay for each node that sends telemetry for any apps in the Per Node tier.
    • 「節點」是裝載應用程式的實體或虛擬伺服器機器,或是平台即服務 (PaaS) 角色執行個體。A node is a physical or virtual server machine or a platform-as-a-service role instance that hosts your app.
    • 開發用機器、用戶端瀏覽器及行動裝置不算節點。Development machines, client browsers, and mobile devices do not count as nodes.
    • 如果您的應用程式有數個會傳送遙測的元件,例如 Web 服務和後端背景工作角色,則會分開計算元件。If your app has several components that send telemetry, such as a web service and a back-end worker, the components are counted separately.
    • 即時計量串流資料不會計入價格用途。Live Metrics Stream data isn't counted for pricing purposes. 訂用帳戶的收費是依照每一節點,而非每一應用程式。In a subscription, your charges are per node, not per app. 如果您有五個節點傳送 12 個應用程式的遙測,則是以五個節點計算收費。If you have five nodes that send telemetry for 12 apps, the charge is for five nodes.
  • 雖然費用是按月報價,您的收費僅適用於一個節點從一個應用程式傳送遙測的任何小時。Although charges are quoted per month, you're charged only for any hour in which a node sends telemetry from an app. 每小時的費用是月費報價除以 744 (一個月 31 天的小時數)。The hourly charge is the quoted monthly charge divided by 744 (the number of hours in a 31-day month).
  • 每個節點 (資料粒度為小時) 偵測每日 200 MB 的資料量配置。A data volume allocation of 200 MB per day is given for each node that's detected (with hourly granularity). 未使用的資料配置不會累計到隔天。Unused data allocation isn't carried over from one day to the next.
    • 如果您選擇「每節點」定價方案,每個訂閱會根據傳送遙測資料至該訂閱中 Application Insights 資源的節點數,得到每日資料額度。If you choose the Per Node pricing tier, each subscription gets a daily allowance of data based on the number of nodes that send telemetry to the Application Insights resources in that subscription. 因此,如果您有 5 個節點全天候傳送資料,您會有合起來 1GB 的資料額度,套用至該訂用帳戶中的所有 Application Insights 資源。So, if you have five nodes that send data all day, you'll have a pooled allowance of 1 GB applied to all Application Insights resources in that subscription. 由於內含資料會在所有節點之間共用,因此特定節點所傳送的資料是否超過其他節點並無妨。It doesn't matter if certain nodes send more data than other nodes because the included data is shared across all nodes. 如果某一天,Application Insights 資源收到超過此訂閱的每日資料配置,則會按 GB 收取資料超量費用。If on a given day, the Application Insights resources receive more data than is included in the daily data allocation for this subscription, the per-GB overage data charges apply.
    • 每日資料額度的計算方式,是每個節點在當天傳送遙測資料的時數 (使用 UTC) 除以 24 再乘以 200 MB。The daily data allowance is calculated as the number of hours in the day (using UTC) that each node sends telemetry divided by 24 multiplied by 200 MB. 因此,如果您有四個節點在一天 24 個小時的 15 個小時內傳送遙測資料,則當天內含資料量會是 ((4 × 15) / 24) × 200 MB = 500 MB。So, if you have four nodes that send telemetry during 15 of the 24 hours in the day, the included data for that day would be ((4 × 15) / 24) × 200 MB = 500 MB. 以資料超量每一 GB 的價格是 2.30 美元來說,如果節點那一天會傳送 1 GB 的資料,費用就是 1.15 美元。At the price of 2.30 USD per GB for data overage, the charge would be 1.15 USD if the nodes send 1 GB of data that day.
    • 「每節點」層的每日額度並不與已選擇為「每 GB」層的應用程式共用。The Per Node tier daily allowance isn't shared with applications for which you have chosen the Per GB tier. 未使用額度不會逐日累計。Unused allowance isn't carried over from day-to-day.

如何判斷相異節點計數的範例Examples of how to determine distinct node count

狀況Scenario 每日節點總數Total daily node count
1 個應用程式使用 3 個 Azure App Service 執行個體和 1 個虛擬伺服器1 application using 3 Azure App Service instances and 1 virtual server 44
3 個應用程式在 2 個虛擬機器上執行,而這些應用程式的 Application Insights 資源位於相同的訂閱中,且採用「每節點」層3 applications running on 2 VMs; the Application Insights resources for these applications are in the same subscription and in the Per Node tier 22
4 個應用程式的 Application Insights 資源位於相同訂用帳戶中;每個應用程式在離峰的 16 小時期間執行 2 個執行個體,在尖峰的 8 小時期間執行 4 個執行個體4 applications whose Applications Insights resources are in the same subscription; each application running 2 instances during 16 off-peak hours, and 4 instances during 8 peak hours 13.3313.33
雲端服務有 1 個背景工作角色和 1 個 Web 角色,各執行 2 個執行個體Cloud services with 1 Worker Role and 1 Web Role, each running 2 instances 44
5 個節點的 Azure Service Fabric 叢集執行 50 個微服務,每個微服務執行 3 個執行個體A 5-node Azure Service Fabric cluster running 50 microservices; each microservice running 3 instances 55
  • 節點的精確計算取決於您的應用程式使用哪個 Application Insights SDK。The precise node counting depends on which Application Insights SDK your application is using.
    • 在 SDK 2.2 版和更新版本中,Application Insights Core SDKWeb SDK 都會將每個應用程式主機報告為節點。In SDK versions 2.2 and later, both the Application Insights Core SDK and the Web SDK report each application host as a node. 範例包括實體伺服器和虛擬機器主機的電腦名稱,或雲端服務的執行個體名稱。Examples are the computer name for physical server and VM hosts or the instance name for cloud services. 唯一的例外狀況是僅使用 .NET Core 和 Application Insights Core SDK 的應用程式。The only exception is an application that uses only the .NET Core and the Application Insights Core SDK. 在此情況下,因為主機名稱無法使用,所以只會針對所有主機報告一個節點。In that case, only one node is reported for all hosts because the host name isn't available.
    • 對於較早版本的 SDK,Web SDK 的行為就和較新版的 SDK 一樣,不過不論應用程式主機的數目是多少,Core SDK 都只會報告一個節點。For earlier versions of the SDK, the Web SDK behaves like the newer SDK versions, but the Core SDK reports only one node, regardless of the number of application hosts.
    • 如果您的應用程式使用 SDK 來將 roleInstance 設為自訂值,依預設將使用那個相同的值來判斷節點計數。If your application uses the SDK to set roleInstance to a custom value, by default, that same value is used to determine node count.
    • 如果您使用新的 SDK 版本,搭配從用戶端機器或行動裝置執行的應用程式,則節點計數可能會傳回很大的數字 (因為有大量的用戶端機器或行動裝置)。If you're using a new SDK version with an app that runs from client machines or mobile devices, the node count might return a number that's large (because of the large number of client machines or mobile devices).

自動化Automation

您可以使用 Azure Resource Management 來撰寫指令碼以設定定價層。You can write a script to set the pricing tier by using Azure Resource Management. 了解作法Learn how.

後續步驟Next steps