fix(telemetry): 0.3.1 OTLP export calls are not traced as client spans (#56)
The Serilog OTLP log sink is not part of the OTel SDK and does not run
inside SuppressInstrumentationScope, so every log batch produced a root
opentelemetry.proto.collector.logs.v1.LogsService/Export gRPC client span.
AddZbTelemetry now drops telemetry's own transport from tracing:
- HttpClient instrumentation: FilterHttpRequestMessage rejects export calls
- gRPC client instrumentation (no Filter option): the start-time
EnrichWithHttpRequestMessage callback clears Recorded/IsAllDataRequested,
which also leaves the child HTTP activity unsampled.
An export call is any /opentelemetry.proto.collector.* path, or an
OTLP/HTTP /v1/{traces,metrics,logs} path on the configured endpoint's
host:port (ZbOtlpExportCallFilter). Every other outgoing call keeps its span.
Tests: predicate theory + an end-to-end run against a loopback OTLP
receiver with positive controls (app gRPC + HttpClient calls traced) and
negatives (the real log-sink export, /v1/logs, gRPC path over HttpClient);
mutation-checked three ways.
Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
This commit is contained in:
@@ -35,7 +35,9 @@ public sealed class ResourceIdentityTests
|
||||
var expected = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()!.InformationalVersion;
|
||||
|
||||
Assert.Equal(expected, ZbResource.VersionOf(assembly));
|
||||
Assert.StartsWith("0.3.0", ZbResource.VersionOf(assembly));
|
||||
// The package version (Directory.Build.props), not a fixed literal that every release must edit.
|
||||
var v = assembly.GetName().Version!;
|
||||
Assert.StartsWith($"{v.Major}.{v.Minor}.{v.Build}+", ZbResource.VersionOf(assembly));
|
||||
Assert.Null(ZbResource.VersionOf(null));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user