amccool
(Alex Mc Cool)
July 17, 2024, 10:11pm
1
Using Otel Collector 0.103 with dotnet core 8x I can see the log records in my Elastic 8 setup (sending logs to the APM server). However, I'm missing a critical attribute:
the dotnet ILogger category name
e.g.
ILogger<aspnetcoreLogging.Boooo>
I see the data in the Otel collector debug/detailed output
InstrumentationScope aspnetcoreLogging.Boooo
2024-07-17T17:05:48.029-0500 info ResourceLog #0
Resource SchemaURL:
Resource attributes:
-> service.name: Str(alex-goes-to-hollywood)
-> service.instance.id: Str(b1633a2a-4151-4e94-9a40-5eaa30327961)
-> telemetry.sdk.name: Str(opentelemetry)
-> telemetry.sdk.language: Str(dotnet)
-> telemetry.sdk.version: Str(1.9.0)
ScopeLogs #0
ScopeLogs SchemaURL:
***InstrumentationScope aspnetcoreLogging.Boooo***
LogRecord #0
ObservedTimestamp: 2024-07-17 22:05:47.7724086 +0000 UTC
Timestamp: 2024-07-17 22:05:47.7724086 +0000 UTC
SeverityText: Information
SeverityNumber: Info(9)
Body: Str(xxxxxxxxxxxxxxxx)
Trace ID: 4aaa98e82b6317a9ed82bbf2fde75571
Span ID: 8b91441226859acc
Flags: 1
{"kind": "exporter", "data_type": "logs", "name": "debug"}
but this attribute is not available in the Discover or APM log explorer pages.
How can I get this attribute to be present for searching and filtering?
thanks,
BozoJoe
amccool
(Alex Mc Cool)
July 18, 2024, 4:55pm
3
the setup is:
builder.Services.AddOpenTelemetry()
.ConfigureResource(resource => resource
.AddService(serviceName: "alex-goes-to-hollywood"))
.WithTracing(tracing => tracing
.AddAspNetCoreInstrumentation()
.AddOtlpExporter())
.WithMetrics(metrics =>
metrics.AddAspNetCoreInstrumentation()
.AddOtlpExporter())
.WithLogging(logger =>
logger.AddOtlpExporter());
app.MapGet("/weatherforecast", (ILogger<aspnetcoreLogging.Boooo> logger) =>
{
logger.LogInformation("xxxxxxxxxxxxxxxx");
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.6" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.9.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>
Thanks for bringing this to our attention @amcool we currently only map instrumentation scope for traces.
I opened an issue to map it for metrics and logs too: Support Instrumentation Scope on all signals · Issue #325 · elastic/apm-data · GitHub
Will tackle this next week.
1 Like
amccool
(Alex Mc Cool)
August 28, 2024, 2:41pm
5
I heard thru the grapevine that apm 8.16 should contain this fix