Skip to content

Commit d10f326

Browse files
authored
Merge pull request #100206 from kraigb/kraigb-edits
Fill out application insights options for host.json
2 parents ebe3f82 + 98b10db commit d10f326

File tree

1 file changed

+112
-30
lines changed

1 file changed

+112
-30
lines changed

articles/azure-functions/functions-host-json.md

Lines changed: 112 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: host.json reference for Azure Functions 2.x
33
description: Reference documentation for the Azure Functions host.json file with the v2 runtime.
44
ms.topic: conceptual
5-
ms.date: 09/08/2018
5+
ms.date: 01/06/2020
66
---
77

88
# host.json reference for Azure Functions 2.x and later
@@ -22,7 +22,7 @@ Some host.json settings are only used when running locally in the [local.setting
2222

2323
## Sample host.json file
2424

25-
The following sample *host.json* files have all possible options specified.
25+
The following sample *host.json* file has all possible options specified (excluding any that are for internal use only).
2626

2727
```json
2828
{
@@ -62,7 +62,48 @@ The following sample *host.json* files have all possible options specified.
6262
"applicationInsights": {
6363
"samplingSettings": {
6464
"isEnabled": true,
65-
"maxTelemetryItemsPerSecond" : 20
65+
"maxTelemetryItemsPerSecond" : 20,
66+
"evaluationInterval": "01:00:00",
67+
"initialSamplingPercentage": 1.0,
68+
"samplingPercentageIncreaseTimeout" : "00:00:01",
69+
"samplingPercentageDecreaseTimeout" : "00:00:01",
70+
"minSamplingPercentage": 0.1,
71+
"maxSamplingPercentage": 0.1,
72+
"movingAverageRatio": 1.0
73+
},
74+
"samplingExcludedTypes" : "Dependency;Event",
75+
"samplingIncludedTypes" : "PageView;Trace",
76+
"enableLiveMetrics": true,
77+
"enableDependencyTracking": true,
78+
"enablePerformanceCountersCollection": true,
79+
"httpAutoCollectionOptions": {
80+
"enableHttpTriggerExtendedInfoCollection": true,
81+
"enableW3CDistributedTracing": true,
82+
"enableResponseHeaderInjection": true
83+
},
84+
"snapshotConfiguration": {
85+
"agentEndpoint": null,
86+
"captureSnapshotMemoryWeight": 0.5,
87+
"failedRequestLimit": 3,
88+
"handleUntrackedExceptions": true,
89+
"isEnabled": true,
90+
"isEnabledInDeveloperMode": false,
91+
"isEnabledWhenProfiling": true,
92+
"isExceptionSnappointsEnabled": false,
93+
"isLowPrioritySnapshotUploader": true,
94+
"maximumCollectionPlanSize": 50,
95+
"maximumSnapshotsRequired": 3,
96+
"problemCounterResetInterval": "24:00:00",
97+
"provideAnonymousTelemetry": true,
98+
"reconnectInterval": "00:15:00",
99+
"shadowCopyFolder": null,
100+
"shareUploaderProcess": true,
101+
"snapshotInLowPriorityThread": true,
102+
"snapshotsPerDayLimit": 30,
103+
"snapshotsPerTenMinutesLimit": 1,
104+
"tempFolder": null,
105+
"thresholdForSnapshotting": 1,
106+
"uploaderProxy": null
66107
}
67108
}
68109
},
@@ -92,32 +133,73 @@ This setting is a child of [logging](#logging).
92133

93134
Controls options for Application Insights, including [sampling options](./functions-monitoring.md#configure-sampling).
94135

95-
```json
96-
{
97-
"applicationInsights": {
98-
"enableDependencyTracking": true,
99-
"enablePerformanceCountersCollection": true,
100-
"samplingExcludedTypes": "Trace;Exception",
101-
"samplingIncludedTypes": "Request;Dependency",
102-
"samplingSettings": {
103-
"isEnabled": true,
104-
"maxTelemetryItemsPerSecond" : 20
105-
}
106-
}
107-
}
108-
```
136+
For the complete JSON structure, see the earlier [example host.json file](#sample-hostjson-file).
109137

110138
> [!NOTE]
111-
> Log sampling may cause some executions to not show up in the Application Insights monitor blade.
112-
113-
|Property |Default | Description |
114-
|---------|---------|---------|
115-
|enableDependencyTracking|true|Enables dependency tracking.|
116-
|enablePerformanceCountersCollection|true|Enables performance counters collection.|
117-
|samplingExcludedTypes|null|A semi-colon delimited list of types that you do not want to be sampled. Recognized types are: Dependency, Event, Exception, PageView, Request, Trace. All instances of the specified types are transmitted; the types that are not specified are sampled.|
118-
|samplingIncludedTypes|null|A semi-colon delimited list of types that you want to be sampled. Recognized types are: Dependency, Event, Exception, PageView, Request, Trace. The specified types are sampled; all instances of the other types will always be transmitted.|
119-
|samplingSettings.isEnabled|true|Enables or disables sampling.|
120-
|samplingSettings.maxTelemetryItemsPerSecond|20|The threshold at which sampling begins.|
139+
> Log sampling may cause some executions to not show up in the Application Insights monitor blade. To avoid log sampling, add `samplingExcludedTypes: "Request"` to the `applicationInsights` value.
140+
141+
| Property | Default | Description |
142+
| --------- | --------- | --------- |
143+
| samplingSettings | n/a | See [applicationInsights.samplingSettings](#applicationinsightssamplingsettings). |
144+
| samplingExcludedTypes | null | A semi-colon delimited list of types that you don't want to be sampled. Recognized types are: Dependency, Event, Exception, PageView, Request, Trace. All instances of the specified types are transmitted; the types that aren't specified are sampled. |
145+
| samplingIncludedTypes | null | A semi-colon delimited list of types that you want to be sampled; an empty list implies all types. Type listed in `samplingExcludedTypes` override types listed here. Recognized types are: Dependency, Event, Exception, PageView, Request, Trace. All instances of the specified types are transmitted; the types that aren't specified are sampled. |
146+
| enableLiveMetrics | true | Enables live metrics collection. |
147+
| enableDependencyTracking | true | Enables dependency tracking. |
148+
| enablePerformanceCountersCollection | true | Enables Kudu performance counters collection. |
149+
| liveMetricsInitializationDelay | 00:00:15 | For internal use only. |
150+
| httpAutoCollectionOptions | n/a | See [applicationInsights.httpAutoCollectionOptions](#applicationinsightshttpautocollectionoptions). |
151+
| snapshotConfiguration | n/a | See [applicationInsights.snapshotConfiguration](#applicationinsightssnapshotconfiguration). |
152+
153+
### applicationInsights.samplingSettings
154+
155+
|Property | Default | Description |
156+
| --------- | --------- | --------- |
157+
| isEnabled | true | Enables or disables sampling. |
158+
| maxTelemetryItemsPerSecond | 20 | The target number of telemetry items logged per second on each server host. If your app runs on many hosts, reduce this value to remain within your overall target rate of traffic. |
159+
| evaluationInterval | 01:00:00 | The interval at which the current rate of telemetry is reevaluated. Evaluation is performed as a moving average. You might want to shorten this interval if your telemetry is liable to sudden bursts. |
160+
| initialSamplingPercentage| 1.0 | The initial sampling percentage applied at the start of the sampling process to dynamically vary the percentage. Don't reduce value while you're debugging. |
161+
| samplingPercentageIncreaseTimeout | 00:00:01 | When the sampling percentage value changes, this property determines how soon afterwards Application Insights is allowed to raise sampling percentage again to capture more data. |
162+
| samplingPercentageDecreaseTimeout | 00:00:01 | When the sampling percentage value changes, this property determines how soon afterwards Application Insights is allowed to lower sampling percentage again to capture less data. |
163+
| minSamplingPercentage | 0.1 | As sampling percentage varies, this property determines the minimum allowed sampling percentage. |
164+
| maxSamplingPercentage | 0.1 | As sampling percentage varies, this property determines the maximum allowed sampling percentage. |
165+
| movingAverageRatio | 1.0 | In the calculation of the moving average, the weight assigned to the most recent value. Use a value equal to or less than 1. Smaller values make the algorithm less reactive to sudden changes. |
166+
167+
### applicationInsights.httpAutoCollectionOptions
168+
169+
|Property | Default | Description |
170+
| --------- | --------- | --------- |
171+
| enableHttpTriggerExtendedInfoCollection | true | Enables or disables extended HTTP request information for HTTP triggers: incoming request correlation headers, multi-instrumentation keys support, HTTP method, path, and response. |
172+
| enableW3CDistributedTracing | true | Enables or disables support of W3C distributed tracing protocol (and turns on legacy correlation schema). Enabled by default if `enableHttpTriggerExtendedInfoCollection` is true. If `enableHttpTriggerExtendedInfoCollection` is false, this flag applies to outgoing requests only, not incoming requests. |
173+
| enableResponseHeaderInjection | true | Enables or disables injection of multi-component correlation headers into responses. Enabling injection allows Application Insights to construct an Application Map to when several instrumentation keys are used. Enabled by default if `enableHttpTriggerExtendedInfoCollection` is true. This setting doesn't apply if `enableHttpTriggerExtendedInfoCollection` is false. |
174+
175+
### applicationInsights.snapshotConfiguration
176+
177+
For more information on snapshots, see [Debug snapshots on exceptions in .NET apps](/azure-monitor/app/snapshot-debugger) and [Troubleshoot problems enabling Application Insights Snapshot Debugger or viewing snapshots](/azure/azure-monitor/app/snapshot-debugger-troubleshoot).
178+
179+
|Property | Default | Description |
180+
| --------- | --------- | --------- |
181+
| agentEndpoint | null | The endpoint used to connect to the Application Insights Snapshot Debugger service. If null, a default endpoint is used. |
182+
| captureSnapshotMemoryWeight | 0.5 | The weight given to the current process memory size when checking if there's enough memory to take a snapshot. The expected value is a greater than 0 proper fraction (0 < CaptureSnapshotMemoryWeight < 1). |
183+
| failedRequestLimit | 3 | The limit on the number of failed requests to request snapshots before the telemetry processor is disabled.|
184+
| handleUntrackedExceptions | true | Enables or disables tracking of exceptions that aren't tracked by Application Insights telemetry. |
185+
| isEnabled | true | Enables or disables snapshot collection |
186+
| isEnabledInDeveloperMode | false | Enables or disables snapshot collection is enabled in developer mode. |
187+
| isEnabledWhenProfiling | true | Enables or disables snapshot creation even if the Application Insights Profiler is collecting a detailed profiling session. |
188+
| isExceptionSnappointsEnabled | false | Enables or disables filtering of exceptions. |
189+
| isLowPrioritySnapshotUploader | true | Determines whether to run the SnapshotUploader process at below normal priority. |
190+
| maximumCollectionPlanSize | 50 | The maximum number of problems that we can track at any time in a range from one to 9999. |
191+
| maximumSnapshotsRequired | 3 | The maximum number of snapshots collected for a single problem, in a range from one to 999. A problem may be thought of as an individual throw statement in your application. Once the number of snapshots collected for a problem reaches this value, no more snapshots will be collected for that problem until problem counters are reset (see `problemCounterResetInterval`) and the `thresholdForSnapshotting` limit is reached again. |
192+
| problemCounterResetInterval | 24:00:00 | How often to reset the problem counters in a range from one minute to seven days. When this interval is reached, all problem counts are reset to zero. Existing problems that have already reached the threshold for doing snapshots, but haven't yet generated the number of snapshots in `maximumSnapshotsRequired`, remain active. |
193+
| provideAnonymousTelemetry | true | Determines whether to send anonymous usage and error telemetry to Microsoft. This telemetry may be used if you contact Microsoft to help troubleshoot problems with the Snapshot Debugger. It is also used to monitor usage patterns. |
194+
| reconnectInterval | 00:15:00 | How often we reconnect to the Snapshot Debugger endpoint. Allowable range is one minute to one day. |
195+
| shadowCopyFolder | null | Specifies the folder to use for shadow copying binaries. If not set, the folders specified by the following environment variables are tried in order: Fabric_Folder_App_Temp, LOCALAPPDATA, APPDATA, TEMP. |
196+
| shareUploaderProcess | true | If true, only one instance of SnapshotUploader will collect and upload snapshots for multiple apps that share the InstrumentationKey. If set to false, the SnapshotUploader will be unique for each (ProcessName, InstrumentationKey) tuple. |
197+
| snapshotInLowPriorityThread | true | Determines whether or not to process snapshots in a low IO priority thread. Creating a snapshot is a fast operation but, in order to upload a snapshot to the Snapshot Debugger service, it must first be written to disk as a minidump. That happens in the SnapshotUploader process. Setting this value to true uses low-priority IO to write the minidump, which won't compete with your application for resources. Setting this value to false speeds up minidump creation at the expense of slowing down your application. |
198+
| snapshotsPerDayLimit | 30 | The maximum number of snapshots allowed in one day (24 hours). This limit is also enforced on the Application Insights service side. Uploads are rate limited to 50 per day per application (that is, per instrumentation key). This value helps prevent creating additional snapshots that will eventually be rejected during upload. A value of zero removes the limit entirely, which isn't recommended. |
199+
| snapshotsPerTenMinutesLimit | 1 | The maximum number of snapshots allowed in 10 minutes. Although there is no upper bound on this value, exercise caution increasing it on production workloads because it could impact the performance of your application. Creating a snapshot is fast, but creating a minidump of the snapshot and uploading it to the Snapshot Debugger service is a much slower operation that will compete with your application for resources (both CPU and I/O). |
200+
| tempFolder | null | Specifies the folder to write minidumps and uploader log files. If not set, then *%TEMP%\Dumps* is used. |
201+
| thresholdForSnapshotting | 1 | How many times Application Insights needs to see an exception before it asks for snapshots. |
202+
| uploaderProxy | null | Overrides the proxy server used in the Snapshot Uploader process. You may need to use this setting if your application connects to the internet via a proxy server. The Snapshot Collector runs within your application's process and will use the same proxy settings. However, the Snapshot Uploader runs as a separate process and you may need to configure the proxy server manually. If this value is null, then Snapshot Collector will attempt to autodetect the proxy's address by examining System.Net.WebRequest.DefaultWebProxy and passing on the value to the Snapshot Uploader. If this value isn't null, then autodetection isn't used and the proxy server specified here will be used in the Snapshot Uploader. |
121203

122204
## cosmosDb
123205

@@ -137,7 +219,7 @@ Property that returns an object that contains all of the binding-specific settin
137219

138220
## extensionBundle
139221

140-
Extension bundles lets you add a compatible set of Functions binding extensions to your function app. To learn more, see [Extension bundles for local development](functions-bindings-register.md#extension-bundles).
222+
Extension bundles let you add a compatible set of Functions binding extensions to your function app. To learn more, see [Extension bundles for local development](functions-bindings-register.md#extension-bundles).
141223

142224
[!INCLUDE [functions-extension-bundles-json](../../includes/functions-extension-bundles-json.md)]
143225

@@ -155,7 +237,7 @@ A list of functions that the job host runs. An empty array means run all functio
155237

156238
Indicates the timeout duration for all functions. It follows the timespan string format. In a serverless Consumption plan, the valid range is from 1 second to 10 minutes, and the default value is 5 minutes.
157239

158-
In the Premium plan the valid range is from 1 second to 60 minutes, and the default value is 30 minutes.
240+
In the Premium plan, the valid range is from 1 second to 60 minutes, and the default value is 30 minutes.
159241

160242
In a Dedicated (App Service) plan, there is no overall limit, and the default value is 30 minutes. A value of `-1` indicates unbounded execution, but keeping a fixed upper bound is recommended.
161243

@@ -216,7 +298,7 @@ Controls the logging behaviors of the function app, including Application Insigh
216298
|Property |Default | Description |
217299
|---------|---------|---------|
218300
|fileLoggingMode|debugOnly|Defines what level of file logging is enabled. Options are `never`, `always`, `debugOnly`. |
219-
|logLevel|n/a|Object that defines the log category filtering for functions in the app. Versions 2.x and later follow the ASP.NET Core layout for log category filtering. This lets you filter logging for specific functions. For more information, see [Log filtering](https://docs.microsoft.com/aspnet/core/fundamentals/logging/?view=aspnetcore-2.1#log-filtering) in the ASP.NET Core documentation. |
301+
|logLevel|n/a|Object that defines the log category filtering for functions in the app. Versions 2.x and later follow the ASP.NET Core layout for log category filtering. This setting lets you filter logging for specific functions. For more information, see [Log filtering](https://docs.microsoft.com/aspnet/core/fundamentals/logging/?view=aspnetcore-2.1#log-filtering) in the ASP.NET Core documentation. |
220302
|console|n/a| The [console](#console) logging setting. |
221303
|applicationInsights|n/a| The [applicationInsights](#applicationinsights) setting. |
222304

0 commit comments

Comments
 (0)