Skip to content

Commit e3f43f3

Browse files
author
Glenn Gailey
committed
1 parent 00533ba commit e3f43f3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

articles/azure-functions/functions-monitoring.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,24 +402,28 @@ This code is an alternative to calling `trackMetric` by using the Node.js SDK fo
402402

403403
## Log custom telemetry in C# functions
404404

405-
You can use the [Microsoft.ApplicationInsights](https://www.nuget.org/packages/Microsoft.ApplicationInsights/) NuGet package to send custom telemetry data to Application Insights. The following C# example uses the [custom telemetry API](../azure-monitor/app/api-custom-events-metrics.md). The example is for a .NET class library, but the Application Insights code is the same for C# script.
405+
There is a Functions-specific version of the Application Insights SDK that you can use to send custom telemetry data from your functions to Application Insights: [Microsoft.Azure.WebJobs.Logging.ApplicationInsights](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Logging.ApplicationInsights). Use a version of this package that supports your installed version of [Microsoft.Azure.WebJobs](https://www.nuget.org/packages/Microsoft.Azure.WebJobs/).
406+
407+
The following C# examples uses the [custom telemetry API](../azure-monitor/app/api-custom-events-metrics.md). The example is for a .NET class library, but the Application Insights code is the same for C# script.
406408

407409
### Version 2.x and later
408410

409411
Version 2.x and later versions of the runtime use newer features in Application Insights to automatically correlate telemetry with the current operation. There's no need to manually set the operation `Id`, `ParentId`, or `Name` fields.
410412

411413
```cs
412414
using System;
413-
using System.Linq;
414415
using System.Threading.Tasks;
415-
using Microsoft.ApplicationInsights;
416-
using Microsoft.ApplicationInsights.DataContracts;
417-
using Microsoft.AspNetCore.Http;
418416
using Microsoft.AspNetCore.Mvc;
419417
using Microsoft.Azure.WebJobs;
420418
using Microsoft.Azure.WebJobs.Extensions.Http;
419+
using Microsoft.AspNetCore.Http;
421420
using Microsoft.Extensions.Logging;
422421

422+
using Microsoft.ApplicationInsights;
423+
using Microsoft.ApplicationInsights.DataContracts;
424+
using Microsoft.ApplicationInsights.Extensibility;
425+
using System.Linq;
426+
423427
namespace functionapp0915
424428
{
425429
public class HttpTrigger2

0 commit comments

Comments
 (0)