Application Insights Duplicate Telemetry

Thomas Adams 36 Reputation points
2022-06-09T13:40:26.317+00:00

I have application insights setup and configured in workspace mode and for a web app on the linux app service plan, I am seeing all telemetry duplicated.
I believe I have narrowed down the problem, but I'm not sure why its happening. Here is some more information

  • Creating a new application insights instance through the Azure portal and updating the connection string in the web app does not result in duplicate telemetry.
  • Creating a new application insights instance through the bicep template and updating the connection string in the web app does still result in duplicate telemetry.
  • Duplicate telemetry is generated whether the app is running locally or on the app service.

This to me would suggest its something related to the bicep template or the Azure portal is doing something extra which isn't reflected in the template. My problem is that if I compare what I currently have in the bicep file with what is generated via the Azure portal using the export template option, they are exactly the same.
Here is the bicep file for reference.

resource analyticWorkspace 'Microsoft.OperationalInsights/workspaces@2021-06-01' existing = {  
  name: analyticWorkspaceName  
  scope: resourceGroup()  
}  
  
resource insights 'microsoft.insights/components@2020-02-02' = {  
  name: insightsName  
  location: location  
  kind: 'web'  
  properties: {  
    Application_Type: 'web'  
    Flow_Type: 'Redfield'  
    Request_Source: 'IbizaAIExtension'  
    WorkspaceResourceId: analyticWorkspace.id  
    IngestionMode: 'LogAnalytics'  
    DisableIpMasking: true  
    publicNetworkAccessForIngestion: 'Disabled'  
    publicNetworkAccessForQuery: 'Enabled'  
  }  
}  

The web app in question is running .NET 6 and has a single call to

services.AddApplicationInsightsTelemetry(configuration);  

The connection string is stored in the appsettings.json file locally and in the app settings for the app service. We do not use the instrumentation key.
Here is a sample of the telemetry

209906-image.png

We can also find duplicates by running the following log analytics query

union (requests), (dependencies), (traces)  
| summarize count () by itemType, sdkVersion, id, operation_Id  
| where count_ > 1  

Which shows a count of 2 for everything

209777-image.png

Any ideas?

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,843 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Diego Gaston Arrighi 35 Reputation points
    2023-03-27T13:26:15.2266667+00:00

    Hi, I'm have the same problem. Every log entry is duplicated, not only the log.LogInformation called from an azure function, also request, dependencies are duplicated in app insigth

    2 people found this answer helpful.
    0 comments No comments

  2. Thomas Adams 36 Reputation points
    2022-08-08T08:20:53.11+00:00

    Just to provide an update on this issue @SwathiDhanwada-MSFT
    It was the diagnostic workspace settings that was causing the duplicate requests. When its enabled/disabled it can take quite a while before the ingested telemetry reflects the changes.

    Thanks for your time and help on this matter.

    1 person found this answer helpful.