'C# OpenTelemetry against Jaeger works in Simple but not Batch

Have a pretty much working environment to use for tracing, OpenTelemetry against Jaeger Tracing. I sort of read that Batch for process is the preferred way then Simple. How ever with in .Net Framework 4.8 Batch dose not seem to give any results being logged. I did a capture of packet data with Wireshark. Nothing happens when running in Batch.

Is there something with this configuration that is missing to have this as ExportProcessorType.Batch instead of ExportProcessorType.Simple?

    public TracerProvider GetTracerProvider(string host, int port)
    {           
        BackendServiceResource = ResourceBuilder.CreateDefault()
             .AddService(Process.GetCurrentProcess().ProcessName)               
             .AddAttributes(new[]
             {
                new KeyValuePair<string, object>("MachineName", Environment.MachineName),
                new KeyValuePair<string, object>("UserName", Environment.UserName),
             });

        return Sdk.CreateTracerProviderBuilder()
        .SetResourceBuilder(BackendServiceResource)
        .SetSampler(new AlwaysOnSampler())
        .SetErrorStatusOnException(true)
        .AddSource(ActivitySource.Name)
        .AddConsoleExporter()
        .AddJaegerExporter(jeager =>
        {
            jeager.AgentHost = host;
            jeager.AgentPort = port;

            jeager.MaxPayloadSizeInBytes = 4096;

            jeager.ExportProcessorType = ExportProcessorType.Simple;
            jeager.BatchExportProcessorOptions = new BatchExportProcessorOptions<Activity>()
            {
                MaxQueueSize = 2048,
                ScheduledDelayMilliseconds = 5000,
                ExporterTimeoutMilliseconds = 30000,
                MaxExportBatchSize = 512,
            };
        })
        .Build();
    }


Solution 1:[1]

Thought I post a solution for this sort of issue.

The reason for these problems is because in some cases as application can close down before the process is fully completed. A solution for this is using and making sure that all gets completed before all is valid for closure.

You can read more about it more here https://github.com/open-telemetry/opentelemetry-dotnet/issues/2758

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Jonas Lindahl