Path: redb-route/tests/redb.Route.Tests/Telemetry/TransportSpanSanitizationTests.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/tests/redb.Route.Tests/Telemetry/TransportSpanSanitizationTests.cs ---- using System.Diagnostics; using redb.Route.Telemetry; namespace redb.Route.Tests.Telemetry; /// /// The transport-span helper is the one funnel every connector's Client/Consumer span goes /// through. redb.route.endpoint was already sanitized; messaging.destination.name /// used to carry the raw destination — with the userinfo password when the URL had one. /// [Collection("Telemetry")] public class TransportSpanSanitizationTests { [Fact] public void Destination_IsSanitized() { using var probe = new RouteTelemetryProbe(a => a.DisplayName == "sanitize-probe"); using (var activity = RouteTelemetryExtensions.StartTransportSpan( "sanitize-probe", ActivityKind.Client, "http.method", "POST", endpointUri: "http:partner.example/orders", destination: "http://edi:s3cr3t@partner.example/orders?apiKey=k123")) { activity.Should().NotBeNull(); } var span = probe.Activities.Should().ContainSingle().Subject; var destination = RouteTelemetryProbe.Tag(span, "messaging.destination.name"); destination.Should().NotBeNull(); destination.Should().NotContain("s3cr3t", "the userinfo password must not go into spans"); destination.Should().NotContain("k123", "a sensitive query parameter is masked too"); destination.Should().Contain("partner.example/orders", "masking keeps the format, it does not erase the address"); } [Fact] public void PlainDestination_PassesThroughUnchanged() { using var probe = new RouteTelemetryProbe(a => a.DisplayName == "sanitize-probe-plain"); using (RouteTelemetryExtensions.StartTransportSpan( "sanitize-probe-plain", ActivityKind.Producer, "messaging.system", "kafka", endpointUri: "kafka:orders", destination: "orders")) { } var span = probe.Activities.Should().ContainSingle().Subject; RouteTelemetryProbe.Tag(span, "messaging.destination.name").Should().Be("orders", "non-URI destinations (queue/topic names) must stay byte for byte"); } }