OpenTelemetry worker generating duplicated rows
eddynaka opened this issue · 5 comments
Description
Hello,
I'm trying to use the new package to leverage AzFunction V4 .NET8 isolated with OpenTelemetry:
#2395
I was able to quickly integrate with the new package and emit telemetry:
And, with the environment variable set, I started testing.
Observed that duplicated rows are being logged:
As you can see in the image, I have two rows regarding a file upload, some of the columns are filled in one row, some not. The customDimensions has only a guid in the customDimensions, for the other, seems complete (bunch of other properties).
How can I properly de-duplicate this?
Am I doing something wrong?
Thanks!
Steps to reproduce
Create an AzFunction .NET 8, V4, isolated.
Use the following packages:
<PackageReference Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.1.1" />
<PackageReference Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.2.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.OpenTelemetry" Version="1.0.0-preview1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.2" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.7.3" />
<PackageReference Include="OpenTelemetry" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Exporter.Geneva" Version="1.8.0" />
Use the following snippets:
private static void Main(string[] args)
{
ResourceBuilder openTelemetryResourceBuilder = ResourceBuilder.CreateDefault().AddService("Test");
#pragma warning disable AZFW0014 // Missing expected registration of ASP.NET Core Integration services
var host = new HostBuilder()
//.ConfigureLogging(loggingBuilder =>
//{
// loggingBuilder.AddOpenTelemetry(o =>
// {
// o.SetResourceBuilder(openTelemetryResourceBuilder);
// o.IncludeScopes = true;
// o.IncludeFormattedMessage = true;
// o.AddAzureMonitorLogExporter();
// o.AddGenevaLogExporter(options =>
// {
// options.ConnectionString = "EtwSession=OpenTelemetry";
// });
// });
// loggingBuilder.AddFilter<OpenTelemetryLoggerProvider>("*", LogLevel.Information);
//})
.ConfigureFunctionsWorkerDefaults()
.ConfigureServices((context, services) =>
{
services.AddOpenTelemetry()
.UseFunctionsWorkerDefaults()
.UseAzureMonitor()
.WithTracing(t =>
{
t.SetResourceBuilder(openTelemetryResourceBuilder);
t.AddAzureMonitorTraceExporter();
t.AddGenevaTraceExporter(g =>
{
g.ConnectionString = "EtwSession=OpenTelemetry";
});
});
})
.Build();
#pragma warning restore AZFW0014 // Missing expected registration of ASP.NET Core Integration services
host.Run();
}
Call the default function and see in application insights how many rows are written
Hi @eddynaka can you confirm if you have "telemetryMode": "openTelemetry" in host.json?
Hello @RohitRanjanMS ,
Can you share an example of this new host.json file?
I'm not aware of the format you are talking about.
{
"version": "2.0",
"telemetryMode": "OpenTelemetry"
}