'Application Insights duplicated logs

I have a .net core API running under Azure Kubernetes service, with Application Insights provisioned with Terraform. When viewing Application Insights in the Azure portal, I see doubled requests/exceptions/traces. Each telemetry has the exact same timestamp, response time, and telemetry data. I decided to manually deploy another Application Insights instance to verify my logging implementation. It turned out that in the second instance my telemetry data are not duplicated. So my question is: what option in the definition of terraform made this happen? There are some options in the Applications Insights responsible for that (maybe sampling or something)?

Here's my terraform definition for the Application Insights

resource "azurerm_application_insights" "application_insights" {
  name                                  = data.instance_name
  resource_group_name                   = data.resource_group.rg.name
  location                              = data.resource_group.rg.location
  application_type                      = var.application_type
  daily_data_cap_in_gb                  = var.daily_data_cap_in_gb
  daily_data_cap_notifications_disabled = var.daily_data_cap_notifications_disabled
  retention_in_days                     = var.retention_in_days
  sampling_percentage                   = var.sampling_percentage
  disable_ip_masking                    = var.disable_ip_masking
  workspace_id                          = local.workspace_Id

  tags = local.tags
}

My AppInsights query and results for 2 different instances

requests
| summarize count() by timestamp
| order by count_ asc  

enter image description here

enter image description here

Here's a resource configuration downloaded from the azure portal:

Provisioned with terraform:

"kind": "other",
"properties": {
    "Application_Type": "other",
    "SamplingPercentage": 50,
    "RetentionInDays": 30,
    "DisableIpMasking": true,
    "IngestionMode": "LogAnalytics",
    "publicNetworkAccessForIngestion": "Enabled",
    "publicNetworkAccessForQuery": "Enabled",
    "DisableLocalAuth": false,
    "ForceCustomerStorageForProfiler": false
}

Provisioned manually:

"kind": "web",
"properties": {
    "Application_Type": "web",
    "Flow_Type": "Redfield",
    "Request_Source": "IbizaAIExtension",
    "RetentionInDays": 90,
    "publicNetworkAccessForIngestion": "Enabled",
    "publicNetworkAccessForQuery": "Enabled"
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source