Skip to content

Commit 0870b87

Browse files
committed
default to /
1 parent 41221f2 commit 0870b87

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

ddtrace/_trace/processor/resource_renaming.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def _compute_simplified_endpoint(self, url: Optional[str]) -> str:
4040

4141
match = self._URL_PATH_EXTRACTION_RE.match(url)
4242
if not match:
43-
return ""
43+
return "/"
4444
path = match.group("path")
4545
if not path or path == "/":
4646
return "/"

tests/tracer/test_resource_renaming.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def test_compute_simplified_endpoint_path_element(self, elem, expected):
5252
[
5353
# Basic cases
5454
("", "/"),
55-
("http://example.com", ""),
55+
("http://example.com", "/"),
5656
("http://example.com/", "/"),
5757
("/users", "/users"),
5858
("https://example.com/users", "/users"),
@@ -85,8 +85,7 @@ def test_compute_simplified_endpoint_path_element(self, elem, expected):
8585
),
8686
# Error cases
8787
(None, "/"),
88-
("invalid-url", ""),
89-
("://malformed", ""),
88+
("://malformed", "/"),
9089
],
9190
)
9291
def test_compute_simplified_endpoint(self, url, expected):
@@ -143,7 +142,7 @@ def test_processor_malformed_url(self):
143142
span.set_tag(http.URL, "not-a-valid-url")
144143

145144
processor.on_span_finish(span)
146-
assert span.get_tag(http.ENDPOINT) == ""
145+
assert span.get_tag(http.ENDPOINT) == "/"
147146

148147
def test_regex_patterns(self):
149148
processor = ResourceRenamingProcessor()

0 commit comments

Comments
 (0)