Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix double question mark in http.target #157

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)!;

Expand All @@ -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()
Expand Down
Loading