Trace table of application Insights is empty while using ActivitySource type for .net

NK, SatishKumar 76 Reputation points
2024-07-06T10:54:03.98+00:00

Trace table of application Insights is empty while using ActivitySource type for .net. I am using otel collector to export traces here. below is the configuration in .net and otel config.

who does trace table gets filled?

builder.Services.AddOpenTelemetry().WithTracing(trace =>
{
    trace.AddAspNetCoreInstrumentation()
        .AddHttpClientInstrumentation()
        .AddSource(nameof(ClaimController))
        .AddSource(nameof(PublishMessage))
        .SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("App1"))
        .AddOtlpExporter(options =>
        {
            options.Endpoint = new Uri("http://xxx.eastus.cloudapp.azure.com:4318/v1/traces");
            options.Protocol = OtlpExportProtocol.HttpProtobuf;
        });
});

---
apiVersion: v1
kind: ConfigMap
metadata:
 name: otel-collector-config
 namespace: otelcollector
 labels:
   app: otelcollector
   component: otel-collector-config
data:
  config.yaml: |
   receivers:
     otlp:
       protocols:
        #  grpc:
         http:
   exporters:
     zipkin:
       endpoint: http://xxx.eastus.cloudapp.azure.com:9411/api/v2/spans
       tls:
         insecure: true 
     azuremonitor:
       connection_string: "InstrumentationKey=xxxxx-dff2-xxxx-80a8-0aa86150a0ca;IngestionEndpoint=https://eastus-8.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/;ApplicationId=xxxxx-dff2-xxxx-80a8-0aa86150a0ca"
     logging:
   processors:
     batch: {}
     resource:
       attributes:
         - key: test.key
           value: "test-value"
           action: insert
   extensions:
     health_check:
     zpages:
       endpoint: :55679
   service:
     telemetry:
       logs:
         level: "debug"
     extensions: [zpages, health_check]
     pipelines:
       traces:
         receivers: [otlp]
         processors: [batch]
         exporters: [logging, zipkin, azuremonitor]
Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,323 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vinodh247 23,346 Reputation points MVP
    2024-07-07T07:08:06.01+00:00

    Hi NK, SatishKumar,

    Thanks for reaching out to Microsoft Q&A.

    You are experiencing an issue with the trace table in Application Insights when using the ActivitySource type in .NET. Can you chck the options below?

    Application Insights and Custom ActivitySource:

    Steps to Enable OpenTelemetry with Azure Monitor:

    This link can help you

    Please 'Upvote'(Thumbs-up) and 'Accept' as an answer if the reply was helpful. This will benefit other community members who face the same issue.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.