Skip to content

Commit 6216ab1

Browse files
Merge pull request #218535 from ggailey777/freshness
[Functions] Freshness updates and bug fixes
2 parents 7cf5cdd + a5255de commit 6216ab1

File tree

5 files changed

+58
-10
lines changed

5 files changed

+58
-10
lines changed

articles/azure-functions/configure-monitoring.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,23 @@ You can exclude certain types of telemetry from sampling. In this example, data
197197

198198
For more information, see [Sampling in Application Insights](../azure-monitor/app/sampling.md).
199199

200+
## Enable SQL query collection
201+
202+
Application Insights automatically collects data on dependencies for HTTP requests, database calls, and for several bindings. For more information, see [Dependencies](./functions-monitoring.md#dependencies). For SQL calls, the name of the server and database is always collected and stored, but SQL query text isn't collected by default. You can use `dependencyTrackingOptions.enableSqlCommandTextInstrumentation` to enable SQL query text logging by setting (at minimum) the following in your [host.json file](./functions-host-json.md#applicationinsightsdependencytrackingoptions):
203+
204+
```json
205+
"logging": {
206+
"applicationInsights": {
207+
"enableDependencyTracking": true,
208+
"dependencyTrackingOptions": {
209+
"enableSqlCommandTextInstrumentation": true
210+
}
211+
}
212+
}
213+
```
214+
215+
For more information, see [Advanced SQL tracking to get full SQL query](../azure-monitor/app/asp-net-dependencies.md#advanced-sql-tracking-to-get-full-sql-query).
216+
200217
## Configure scale controller logs
201218

202219
_This feature is in preview._

articles/azure-functions/functions-app-settings.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,11 @@ There are other function app configuration options in the [host.json](functions-
1515
Example connection string values are truncated for readability.
1616

1717
> [!NOTE]
18-
> You can use application settings to override host.json setting values without having to change the host.json file itself. This is helpful for scenarios where you need to configure or modify specific host.json settings for a specific environment. This also lets you change host.json settings without having to republish your project. To learn more, see the [host.json reference article](functions-host-json.md#override-hostjson-values). Changes to function app settings require your function app to be restarted.
19-
20-
> [!IMPORTANT]
21-
> Do not use an [instrumentation key](../azure-monitor/app/separate-resources.md#about-resources-and-instrumentation-keys) and a [connection string](../azure-monitor/app/sdk-connection-string.md#overview) simultaneously. Whichever was set last will take precedence.
18+
> You can use application settings to override host.json setting values without having to change the host.json file itself. This is helpful for scenarios where you need to configure or modify specific host.json settings for a specific environment. This also lets you change host.json settings without having to republish your project. To learn more, see the [host.json reference article](functions-host-json.md#override-hostjson-values). Changes to function app settings require your function app to be restarted.
2219
2320
## APPINSIGHTS_INSTRUMENTATIONKEY
2421

25-
The instrumentation key for Application Insights. Only use one of `APPINSIGHTS_INSTRUMENTATIONKEY` or `APPLICATIONINSIGHTS_CONNECTION_STRING`. When Application Insights runs in a sovereign cloud, use `APPLICATIONINSIGHTS_CONNECTION_STRING`. For more information, see [How to configure monitoring for Azure Functions](configure-monitoring.md).
22+
The instrumentation key for Application Insights. Don't use both `APPINSIGHTS_INSTRUMENTATIONKEY` and `APPLICATIONINSIGHTS_CONNECTION_STRING`. When possible, use `APPLICATIONINSIGHTS_CONNECTION_STRING`. When Application Insights runs in a sovereign cloud, you must use `APPLICATIONINSIGHTS_CONNECTION_STRING`. For more information, see [How to configure monitoring for Azure Functions](configure-monitoring.md).
2623

2724
|Key|Sample value|
2825
|---|------------|
@@ -32,7 +29,7 @@ The instrumentation key for Application Insights. Only use one of `APPINSIGHTS_I
3229

3330
## APPLICATIONINSIGHTS_CONNECTION_STRING
3431

35-
The connection string for Application Insights. Use `APPLICATIONINSIGHTS_CONNECTION_STRING` instead of `APPINSIGHTS_INSTRUMENTATIONKEY` in the following cases:
32+
The connection string for Application Insights. When possible, use `APPLICATIONINSIGHTS_CONNECTION_STRING` instead of `APPINSIGHTS_INSTRUMENTATIONKEY`. Using `APPLICATIONINSIGHTS_CONNECTION_STRING` is required in the following cases:
3633

3734
+ When your function app requires the added customizations supported by using the connection string.
3835
+ When your Application Insights instance runs in a sovereign cloud, which requires a custom endpoint.

articles/azure-functions/functions-concurrency.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Using dynamic concurrency provides the following benefits:
4343

4444
### Dynamic concurrency configuration
4545

46-
Dynamic concurrency can be enabled at the host level in the host.json file. When, enabled any binding extensions used by your function app that support dynamic concurrency will adjust concurrency dynamically as needed. Dynamic concurrency settings override any manually configured concurrency settings for triggers that support dynamic concurrency.
46+
Dynamic concurrency can be enabled at the host level in the host.json file. When, enabled any binding extensions used by your function app that support dynamic concurrency adjust concurrency dynamically as needed. Dynamic concurrency settings override any manually configured concurrency settings for triggers that support dynamic concurrency.
4747

4848
By default, dynamic concurrency is disabled. With dynamic concurrency enabled, concurrency starts at 1 for each function, and is adjusted up to an optimal value, which is determined by the host.
4949

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

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ 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
55
ms.custom: ignite-2022
6-
ms.date: 04/28/2020
6+
ms.date: 11/16/2022
77
---
88

99
# host.json reference for Azure Functions 2.x and later
@@ -37,6 +37,10 @@ The following sample *host.json* file for version 2.x+ has all possible options
3737
"batchSize": 1000,
3838
"flushTimeout": "00:00:30"
3939
},
40+
"concurrency": {
41+
"dynamicConcurrencyEnabled": true,
42+
"snapshotPersistenceEnabled": true
43+
},
4044
"extensions": {
4145
"blobs": {},
4246
"cosmosDb": {},
@@ -80,6 +84,9 @@ The following sample *host.json* file for version 2.x+ has all possible options
8084
"excludedTypes" : "Dependency;Event",
8185
"includedTypes" : "PageView;Trace"
8286
},
87+
"dependencyTrackingOptions": {
88+
"enableSqlCommandTextInstrumentation": true
89+
},
8390
"enableLiveMetrics": true,
8491
"enableDependencyTracking": true,
8592
"enablePerformanceCountersCollection": true,
@@ -149,6 +156,7 @@ For the complete JSON structure, see the earlier [example host.json file](#sampl
149156
| Property | Default | Description |
150157
| --------- | --------- | --------- |
151158
| samplingSettings | n/a | See [applicationInsights.samplingSettings](#applicationinsightssamplingsettings). |
159+
| dependencyTrackingOptions | n/a | See [applicationInsights.dependencyTrackingOptions](#applicationinsightsdependencytrackingoptions). |
152160
| enableLiveMetrics | true | Enables live metrics collection. |
153161
| enableDependencyTracking | true | Enables dependency tracking. |
154162
| enablePerformanceCountersCollection | true | Enables Kudu performance counters collection. |
@@ -182,6 +190,12 @@ For more information about these settings, see [Sampling in Application Insights
182190
| 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. |
183191
| 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. |
184192

193+
### applicationInsights.dependencyTrackingOptions
194+
195+
|Property | Default | Description |
196+
| --------- | --------- | --------- |
197+
| enableSqlCommandTextInstrumentation | false | Enables collection of the full text of SQL queries, which is disabled by default. For more information on collecting SQL query text, see [Advanced SQL tracking to get full SQL query](../azure-monitor/app/asp-net-dependencies.md#advanced-sql-tracking-to-get-full-sql-query). |
198+
185199
### applicationInsights.snapshotConfiguration
186200

187201
For more information on snapshots, see [Debug snapshots on exceptions in .NET apps](../azure-monitor/app/snapshot-debugger.md) and [Troubleshoot problems enabling Application Insights Snapshot Debugger or viewing snapshots](../azure-monitor/app/snapshot-debugger-troubleshoot.md).
@@ -267,6 +281,24 @@ Configuration settings for a custom handler. For more information, see [Azure Fu
267281

268282
Configuration setting can be found in [bindings for Durable Functions](durable/durable-functions-bindings.md#host-json).
269283

284+
## concurrency
285+
286+
Enables dynamic concurrency for specific bindings in your function app. For more information, see [Dynamic concurrency](./functions-concurrency.md#dynamic-concurrency).
287+
288+
```json
289+
{
290+
"concurrency": {
291+
"dynamicConcurrencyEnabled": true,
292+
"snapshotPersistenceEnabled": true
293+
}
294+
}
295+
```
296+
297+
|Property | Default | Description |
298+
| --------- | --------- | --------- |
299+
| dynamicConcurrencyEnabled | false | Enables dynamic concurrency behaviors for all triggers supported by this feature, which is off by default. |
300+
| snapshotPersistenceEnabled | true | Learned concurrency values are periodically persisted to storage so new instances start from those values instead of starting from 1 and having to redo the learning. |
301+
270302
## eventHub
271303

272304
Configuration settings can be found in [Event Hub triggers and bindings](functions-bindings-event-hubs.md#host-json).
@@ -439,7 +471,7 @@ An array of one or more names of files that are monitored for changes that requi
439471

440472
## Override host.json values
441473

442-
There may be instances where you wish to configure or modify specific settings in a host.json file for a specific environment, without changing the host.json file itself. You can override specific host.json values by creating an equivalent value as an application setting. When the runtime finds an application setting in the format `AzureFunctionsJobHost__path__to__setting`, it overrides the equivalent host.json setting located at `path.to.setting` in the JSON. When expressed as an application setting, the dot (`.`) used to indicate JSON hierarchy is replaced by a double underscore (`__`).
474+
There may be instances where you wish to configure or modify specific settings in a host.json file for a specific environment, without changing the host.json file itself. You can override specific host.json values by creating an equivalent value as an application setting. When the runtime finds an application setting in the format `AzureFunctionsJobHost__path__to__setting`, it overrides the equivalent host.json setting located at `path.to.setting` in the JSON. When expressed as an application setting, the dot (`.`) used to indicate JSON hierarchy is replaced by a double underscore (`__`).
443475

444476
For example, say that you wanted to disable Application Insight sampling when running locally. If you changed the local host.json file to disable Application Insights, this change might get pushed to your production app during deployment. The safer way to do this is to instead create an application setting as `"AzureFunctionsJobHost__logging__applicationInsights__samplingSettings__isEnabled":"false"` in the `local.settings.json` file. You can see this in the following `local.settings.json` file, which doesn't get published:
445477

@@ -454,6 +486,8 @@ For example, say that you wanted to disable Application Insight sampling when ru
454486
}
455487
```
456488

489+
Overriding host.json settings using environment variables follows the ASP.NET Core naming conventions. When the element structure includes an array, the numeric array index should be treated as an additional element name in this path. For more information, see [Naming of environment variables](/aspnet/core/fundamentals/configuration/#naming-of-environment-variables).
490+
457491
## Next steps
458492

459493
> [!div class="nextstepaction"]

articles/azure-monitor/app/asp-net-dependencies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ For webpages, the Application Insights JavaScript SDK automatically collects AJA
9191
## Advanced SQL tracking to get full SQL query
9292

9393
> [!NOTE]
94-
> Azure Functions requires separate settings to enable SQL text collection. Within [host.json](../../azure-functions/functions-host-json.md#applicationinsights), set `"EnableDependencyTracking": true,` and `"DependencyTrackingOptions": { "enableSqlCommandTextInstrumentation": true }` in `applicationInsights`.
94+
> Azure Functions requires separate settings to enable SQL text collection. For more information, see [Enable SQL query collection](../../azure-functions/configure-monitoring.md#enable-sql-query-collection).
9595
9696
For SQL calls, the name of the server and database is always collected and stored as the name of the collected `DependencyTelemetry`. Another field, called data, can contain the full SQL query text.
9797

0 commit comments

Comments
 (0)