diff --git a/articles/azure-monitor/app/api-custom-events-metrics.md b/articles/azure-monitor/app/api-custom-events-metrics.md index c37106f9ed..d89caf3335 100644 --- a/articles/azure-monitor/app/api-custom-events-metrics.md +++ b/articles/azure-monitor/app/api-custom-events-metrics.md @@ -11,6 +11,8 @@ ms.reviewer: mmcc # Application Insights API for custom events and metrics +[!INCLUDE [azure-monitor-app-insights-otel-available-notification](../includes/azure-monitor-app-insights-otel-available-notification.md)] + Insert a few lines of code in your application to find out what users are doing with it, or to help diagnose issues. You can send telemetry from device and desktop apps, web clients, and web servers. Use the [Application Insights](./app-insights-overview.md) core telemetry API to send custom events and metrics and your own versions of standard telemetry. This API is the same API that the standard Application Insights data collectors use. [!INCLUDE [azure-monitor-log-analytics-rebrand](~/reusable-content/ce-skilling/azure/includes/azure-monitor-instrumentation-key-deprecation.md)] diff --git a/articles/azure-monitor/app/api-filtering-sampling.md b/articles/azure-monitor/app/api-filtering-sampling.md index 65ae1f63d8..f8fe5c4182 100644 --- a/articles/azure-monitor/app/api-filtering-sampling.md +++ b/articles/azure-monitor/app/api-filtering-sampling.md @@ -11,6 +11,8 @@ ms.reviewer: cithomas # Filter and preprocess telemetry in the Application Insights SDK +[!INCLUDE [azure-monitor-app-insights-otel-available-notification](../includes/azure-monitor-app-insights-otel-available-notification.md)] + You can write code to filter, modify, or enrich your telemetry before it's sent from the SDK. The processing includes data that's sent from the standard telemetry modules, such as HTTP request collection and dependency collection. * [Filtering](./api-filtering-sampling.md#filtering) can modify or discard telemetry before it's sent from the SDK by implementing `ITelemetryProcessor`. For example, you could reduce the volume of telemetry by excluding requests from robots. Unlike sampling, You have full control over what is sent or discarded, but it affects any metrics based on aggregated logs. Depending on how you discard items, you might also lose the ability to navigate between related items. @@ -96,10 +98,12 @@ To filter telemetry, you write a telemetry processor and register it with `Telem > [!WARNING] > Take care to match the type name and any property names in the .config file to the class and property names in the code. If the .config file references a nonexistent type or property, the SDK may silently fail to send any telemetry. - > Alternatively, you can initialize the filter in code. In a suitable initialization class, for example, AppStart in `Global.asax.cs`, insert your processor into the chain: + > [!NOTE] + > The following code sample is obsolete, but is made available here for posterity. Consider [getting started with OpenTelemetry](opentelemetry-enable.md) or [migrating to OpenTelemetry](opentelemetry-dotnet-migrate.md). + ```csharp var builder = TelemetryConfiguration.Active.DefaultTelemetrySink.TelemetryProcessorChainBuilder; builder.Use((next) => new SuccessfulDependencyFilter(next)); diff --git a/articles/azure-monitor/app/codeless-app-service.md b/articles/azure-monitor/app/codeless-app-service.md index fa7d523e11..b5e9c14e44 100644 --- a/articles/azure-monitor/app/codeless-app-service.md +++ b/articles/azure-monitor/app/codeless-app-service.md @@ -772,182 +772,6 @@ If you're missing telemetry, follow these steps to confirm that autoinstrumentat If your app uses Django and is either failing to start or using incorrect settings, make sure to set the `DJANGO_SETTINGS_MODULE` environment variable. See the [Django Instrumentation](#django-instrumentation) section for details. For the latest updates and bug fixes, [consult the release notes](web-app-extension-release-notes.md). - ---- - -## Release notes - -This section contains the release notes for Azure App Service based on ANT release for runtime instrumentation with Application Insights. - -To find which version of the extension you're currently using, go to `https://.scm.azurewebsites.net/ApplicationInsights`. - -## [ASP.NET Core](#tab/aspnetcore) - -#### 2.8.44 - -* Upgraded to [ApplicationInsights .NET SDK to 2.20.1](https://github.com/microsoft/ApplicationInsights-dotnet/tree/autoinstrumentation/2.20.1). - -#### 2.8.43 - -* Separate .NET/.NET Core, Java, and Node.js package into different App Service Windows Site Extension. - -#### 2.8.42 - -* Added self-contained deployments and .NET 6.0 support using [.NET Startup Hook](https://github.com/dotnet/runtime/blob/main/docs/design/features/host-startup-hook.md). - -#### 2.8.41 - -* Removed out-of-support version (2.1). Supported versions are 3.1 and 5.0. - -#### 2.8.39 - -* Added .NET Core 5.0 support. - -#### 2.8.38 - -* Removed out-of-support versions (2.0, 2.2, 3.0). Supported versions are 2.1 and 3.1. - -#### 2.8.37 - -* AppSvc Windows extension: Made .NET Core work with any version of System.Diagnostics.DiagnosticSource.dll. - -#### 2.8.36 - -* AppSvc Windows extension: Enabled Inter-op with AI SDK in .NET Core. - -#### 2.8.35 - -* AppSvc Windows extension: Added .NET Core 3.1 support. - -#### 2.8.33 - -* .NET, .NET core, Java, and Node.js agents and the Windows Extension: Support for sovereign clouds. Connections strings can be used to send data to sovereign clouds. - -#### 2.8.31 - -* The ASP.NET Core agent fixed an issue with the Application Insights SDK. If the runtime loaded the incorrect version of `System.Diagnostics.DiagnosticSource.dll`, the codeless extension doesn't crash the application and backs off. To fix the issue, customers should remove `System.Diagnostics.DiagnosticSource.dll` from the bin folder or use the older version of the extension by setting `ApplicationInsightsAgent_EXTENSIONVERSION=2.8.24`. If they don't, application monitoring isn't enabled. - -#### 2.8.26 - -* Fixed issue related to updated Application Insights SDK. The agent doesn't try to load `AiHostingStartup` if the ApplicationInsights.dll is already present in the bin folder. It resolves issues related to reflection via Assembly\.GetTypes(). - -* Known issues: Exception `System.IO.FileLoadException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'` could be thrown if another version of `DiagnosticSource` dll is loaded. It could happen, for example, if `System.Diagnostics.DiagnosticSource.dll` is present in the publish folder. As mitigation, use the previous version of extension by setting app settings in app services: ApplicationInsightsAgent_EXTENSIONVERSION=2.8.24. - -#### 2.8.24 - -* Repackaged version of 2.8.21. - -#### 2.8.23 - -* Added ASP.NET Core 3.0 codeless monitoring support. - -* Updated ASP.NET Core SDK to [2.8.0](https://github.com/microsoft/ApplicationInsights-aspnetcore/releases/tag/2.8.0) for runtime versions 2.1, 2.2 and 3.0. Apps targeting .NET Core 2.0 continue to use 2.1.1 of the SDK. - -#### 2.8.14 - -* Updated ASP.NET Core SDK version from 2.3.0 to the latest (2.6.1) for apps targeting .NET Core 2.1, 2.2. Apps targeting .NET Core 2.0 continue to use 2.1.1 of the SDK. - -#### 2.8.12 - -* Support for ASP.NET Core 2.2 apps. - -* Fixed a bug in ASP.NET Core extension causing injection of SDK even when the application is already instrumented with the SDK. For 2.1 and 2.2 apps, the presence of ApplicationInsights.dll in the application folder now causes the extension to back off. For 2.0 apps, the extension backs off only if ApplicationInsights is enabled with a `UseApplicationInsights()` call. - -* Permanent fix for incomplete HTML response for ASP.NET Core apps. This fix is now extended to work for .NET Core 2.2 apps. - -* Added support to turn off JavaScript injection for ASP.NET Core apps (`APPINSIGHTS_JAVASCRIPT_ENABLED=false appsetting`). For ASP.NET core, the JavaScript injection is in "Opt-Out" mode by default, unless explicitly turned off. (The default setting is done to retain current behavior.) - -* Fixed ASP.NET Core extension bug that caused injection even if ikey wasn't present. - -* Fixed a bug in the SDK version prefix logic that caused an incorrect SDK version in telemetry. - -* Added SDK version prefix for ASP.NET Core apps to identify how telemetry was collected. - -* Fixed SCM- ApplicationInsights page to correctly show the version of the preinstalled extension. - -#### 2.8.10 - -* Fix for incomplete HTML response for ASP.NET Core apps. - -## [.NET](#tab/net) - -#### 2.8.44 - -* Upgraded to [ApplicationInsights .NET SDK to 2.20.1](https://github.com/microsoft/ApplicationInsights-dotnet/tree/autoinstrumentation/2.20.1). - -#### 2.8.43 - -* Separate .NET/.NET Core, Java, and Node.js package into different App Service Windows Site Extension. - -#### 2.8.33 - -* .NET, .NET core, Java, and Node.js agents and the Windows Extension: Support for sovereign clouds. Connections strings can be used to send data to sovereign clouds. - -#### 2.8.24 - -* Repackaged version of 2.8.21. - -## [Java](#tab/java) - -#### 2.8.43 - -* Separate .NET/.NET Core, Java, and Node.js package into different App Service Windows Site Extension. - -#### 2.8.42 - -* Upgraded to [Java Agent 3.2.0](https://github.com/microsoft/ApplicationInsights-Java/releases/tag/3.2.0) from 2.5.1. - -#### 2.8.40 - -* Upgraded to [Java Agent 3.1.1 (GA)](https://github.com/microsoft/ApplicationInsights-Java/releases/tag/3.1.1) from 3.0.2. - -#### 2.8.38 - -* Upgraded to [Java Agent 3.0.2 (GA)](https://github.com/microsoft/ApplicationInsights-Java/releases/tag/3.0.2) from 2.5.1. - -#### 2.8.33 - -* .NET, .NET core, Java, and Node.js agents and the Windows Extension: Support for sovereign clouds. Connections strings can be used to send data to sovereign clouds. - -#### 2.8.24 - -* Repackaged version of 2.8.21. - -## [Node.js](#tab/nodejs) - -#### 2.8.43 - -* Separate .NET/.NET Core, Java, and Node.js package into different App Service Windows Site Extension. - -#### 2.8.42 - -* Updated AI SDK to [2.1.8](https://github.com/microsoft/ApplicationInsights-node.js/releases/tag/2.1.8) from 2.1.7. Added support for User and System assigned Microsoft Entra managed identities. - -#### 2.8.41 - -* Updated AI SDK to [2.1.7](https://github.com/microsoft/ApplicationInsights-node.js/releases/tag/2.1.7) from 2.1.3. - -#### 2.8.40 - -* Updated AI SDK to [2.1.3](https://github.com/microsoft/ApplicationInsights-node.js/releases/tag/2.1.3) from 1.8.8. - -#### 2.8.38 - -* Updated AI SDK to [1.8.8](https://github.com/microsoft/ApplicationInsights-node.js/releases/tag/1.8.8) from 1.8.7. - -#### 2.8.33 - -* .NET, .NET core, Java, and Node.js agents and the Windows Extension: Support for sovereign clouds. Connections strings can be used to send data to sovereign clouds. - -#### 2.8.24 - -* Repackaged version of 2.8.21. - -## [Python (Preview)](#tab/python) - -Release notes for Python will show here. - ---- ## Next steps diff --git a/articles/azure-monitor/app/java-standalone-config.md b/articles/azure-monitor/app/java-standalone-config.md index 0f7213e2ea..0d6f8996ff 100644 --- a/articles/azure-monitor/app/java-standalone-config.md +++ b/articles/azure-monitor/app/java-standalone-config.md @@ -12,6 +12,8 @@ ms.reviewer: mmcc This article shows you how to configure Azure Monitor Application Insights for Java. +For more information, see [Get started with OpenTelemetry](opentelemetry-enable.md) which includes [sample applications](opentelemetry-enable.md#sample-applications). + ## Connection string and role name Connection string and role name are the most common settings you need to get started: diff --git a/articles/azure-monitor/app/opentelemetry-add-modify.md b/articles/azure-monitor/app/opentelemetry-add-modify.md index c5e3f3135c..69269b9029 100644 --- a/articles/azure-monitor/app/opentelemetry-add-modify.md +++ b/articles/azure-monitor/app/opentelemetry-add-modify.md @@ -1272,6 +1272,9 @@ span.recordException(e); #### [Node.js](#tab/nodejs) +The Node.js SDK will only export these manually recorded span-based exceptions to Application Insights as exceptions if they are recorded on the children of +remote, internal spans, or if the exception is recorded on a top level span. + ```javascript // Import the Azure Monitor OpenTelemetry plugin and OpenTelemetry API const { useAzureMonitor } = require("@azure/monitor-opentelemetry"); @@ -1287,7 +1290,7 @@ const tracer = trace.getTracer("testTracer"); let span = tracer.startSpan("hello"); // Try to throw an error -try{ +try { throw new Error("Test Error"); } diff --git a/articles/azure-monitor/app/opentelemetry-configuration.md b/articles/azure-monitor/app/opentelemetry-configuration.md index c171a06485..6c04587419 100644 --- a/articles/azure-monitor/app/opentelemetry-configuration.md +++ b/articles/azure-monitor/app/opentelemetry-configuration.md @@ -68,10 +68,11 @@ Use one of the following two ways to configure the connection string: // Create a new OpenTelemetry tracer provider. // It is important to keep the TracerProvider instance active throughout the process lifetime. var tracerProvider = Sdk.CreateTracerProviderBuilder() - .AddAzureMonitorTraceExporter(options => - { - options.ConnectionString = ""; - }); + .AddAzureMonitorTraceExporter(options => + { + options.ConnectionString = ""; + }) + .Build(); // Create a new OpenTelemetry meter provider. // It is important to keep the MetricsProvider instance active throughout the process lifetime. @@ -79,7 +80,8 @@ Use one of the following two ways to configure the connection string: .AddAzureMonitorMetricExporter(options => { options.ConnectionString = ""; - }); + }) + .Build(); // Create a new logger factory. // It is important to keep the LoggerFactory instance active throughout the process lifetime. @@ -232,14 +234,16 @@ var resourceBuilder = ResourceBuilder.CreateDefault().AddAttributes(resourceAttr var tracerProvider = Sdk.CreateTracerProviderBuilder() // Set ResourceBuilder on the TracerProvider. .SetResourceBuilder(resourceBuilder) - .AddAzureMonitorTraceExporter(); + .AddAzureMonitorTraceExporter() + .Build(); // Create a new OpenTelemetry meter provider and set the resource builder. // It is important to keep the MetricsProvider instance active throughout the process lifetime. var metricsProvider = Sdk.CreateMeterProviderBuilder() // Set ResourceBuilder on the MeterProvider. .SetResourceBuilder(resourceBuilder) - .AddAzureMonitorMetricExporter(); + .AddAzureMonitorMetricExporter() + .Build(); // Create a new logger factory and add the OpenTelemetry logger provider with the resource builder. // It is important to keep the LoggerFactory instance active throughout the process lifetime. @@ -358,7 +362,8 @@ var tracerProvider = Sdk.CreateTracerProviderBuilder() { // Set the sampling ratio to 10%. This means that 10% of all traces will be sampled and sent to Azure Monitor. options.SamplingRatio = 0.1F; - }); + }) + .Build(); ``` ### [Java](#tab/java) @@ -567,7 +572,8 @@ We support the credential classes provided by [Azure Identity](https://github.co .AddAzureMonitorTraceExporter(options => { options.Credential = credential; - }); + }) + .Build(); // Create a new OpenTelemetry meter provider and set the credential. // It is important to keep the MetricsProvider instance active throughout the process lifetime. @@ -575,7 +581,8 @@ We support the credential classes provided by [Azure Identity](https://github.co .AddAzureMonitorMetricExporter(options => { options.Credential = credential; - }); + }) + .Build(); // Create a new logger factory and add the OpenTelemetry logger provider with the credential. // It is important to keep the LoggerFactory instance active throughout the process lifetime. @@ -745,7 +752,8 @@ var tracerProvider = Sdk.CreateTracerProviderBuilder() // Set the Azure Monitor storage directory to "C:\\SomeDirectory". // This is the directory where the OpenTelemetry SDK will store any trace data that cannot be sent to Azure Monitor immediately. options.StorageDirectory = "C:\\SomeDirectory"; - }); + }) + .Build(); // Create a new OpenTelemetry meter provider and set the storage directory. // It is important to keep the MetricsProvider instance active throughout the process lifetime. @@ -755,7 +763,8 @@ var metricsProvider = Sdk.CreateMeterProviderBuilder() // Set the Azure Monitor storage directory to "C:\\SomeDirectory". // This is the directory where the OpenTelemetry SDK will store any metric data that cannot be sent to Azure Monitor immediately. options.StorageDirectory = "C:\\SomeDirectory"; - }); + }) + .Build(); // Create a new logger factory and add the OpenTelemetry logger provider with the storage directory. // It is important to keep the LoggerFactory instance active throughout the process lifetime. @@ -914,13 +923,15 @@ You might want to enable the OpenTelemetry Protocol (OTLP) Exporter alongside th // It is important to keep the TracerProvider instance active throughout the process lifetime. var tracerProvider = Sdk.CreateTracerProviderBuilder() .AddAzureMonitorTraceExporter() - .AddOtlpExporter(); + .AddOtlpExporter() + .Build(); // Create a new OpenTelemetry meter provider and add the Azure Monitor metric exporter and the OTLP metric exporter. // It is important to keep the MetricsProvider instance active throughout the process lifetime. var metricsProvider = Sdk.CreateMeterProviderBuilder() .AddAzureMonitorMetricExporter() - .AddOtlpExporter(); + .AddOtlpExporter() + .Build(); ``` ### [Java](#tab/java) diff --git a/articles/azure-monitor/app/opentelemetry-dotnet-migrate.md b/articles/azure-monitor/app/opentelemetry-dotnet-migrate.md index de2170a683..567624dc69 100644 --- a/articles/azure-monitor/app/opentelemetry-dotnet-migrate.md +++ b/articles/azure-monitor/app/opentelemetry-dotnet-migrate.md @@ -536,7 +536,7 @@ builder.Services.Configure(options => ##### Customizing SqlClientInstrumentationOptions -We vendor the [SQLClient](https://www.nuget.org/packages/OpenTelemetry.Instrumentation.SqlClient) instrumentation within our package while it's still in beta. When it reaches a stable release, we include it as a standard package reference. Until then, to customize the SQLClient instrumentation, add the `OpenTelemetry.Instrumentation.SqlClient` package reference to your project and use its public API. +We provide the [SQLClient](https://www.nuget.org/packages/OpenTelemetry.Instrumentation.SqlClient) instrumentation within our package while it's still in beta. When it reaches a stable release, we'll include it as a standard package reference. Until then, to customize the SQLClient instrumentation, add the `OpenTelemetry.Instrumentation.SqlClient` package reference to your project and use its public API. ``` dotnet add package --prerelease OpenTelemetry.Instrumentation.SqlClient