diff --git a/src/Elastic.OpenTelemetry/Processors/ElasticCompatibilityProcessor.cs b/src/Elastic.OpenTelemetry/Processors/ElasticCompatibilityProcessor.cs index d48e53c..fd7f7b6 100644 --- a/src/Elastic.OpenTelemetry/Processors/ElasticCompatibilityProcessor.cs +++ b/src/Elastic.OpenTelemetry/Processors/ElasticCompatibilityProcessor.cs @@ -88,7 +88,7 @@ public override void OnEnd(Activity activity) var target = urlPath; if (urlQuery is not null) - target += $"?{urlQuery}"; + target += urlQuery; SetStringAttribute(HttpTarget, target); } diff --git a/tests/Elastic.OpenTelemetry.Tests/Processors/ElasticCompatibilityProcessorTests.cs b/tests/Elastic.OpenTelemetry.Tests/Processors/ElasticCompatibilityProcessorTests.cs index 0b7ba49..e4ac163 100644 --- a/tests/Elastic.OpenTelemetry.Tests/Processors/ElasticCompatibilityProcessorTests.cs +++ b/tests/Elastic.OpenTelemetry.Tests/Processors/ElasticCompatibilityProcessorTests.cs @@ -74,7 +74,7 @@ public void AddsExpectedHttpAttributes_WhenUrlQuery_IsPresent() { const string scheme = "https"; const string path = "/my/path"; - const string query = "q=OpenTelemetry"; + const string query = "?q=OpenTelemetry"; var activity = _activitySource.CreateActivity("test", ActivityKind.Server)!; @@ -87,7 +87,7 @@ public void AddsExpectedHttpAttributes_WhenUrlQuery_IsPresent() // We can test with Tags (rather than TagObjects) here as we know these are string values activity.Tags.Single(t => t.Key == TraceSemanticConventions.HttpScheme).Value.Should().Be(scheme); - activity.Tags.Single(t => t.Key == TraceSemanticConventions.HttpTarget).Value.Should().Be($"{path}?{query}"); + activity.Tags.Single(t => t.Key == TraceSemanticConventions.HttpTarget).Value.Should().Be($"{path}{query}"); } public void Dispose()