Browse Source

fix(spurl-param): Remove tentative span URL parameterization code (#47725)

Reverts both #46790 and #46875. That project has evolved, and will be
done in Relay instead, as part of Starfish. Removing this code.
George Gritsouk 1 year ago
parent
commit
2fe343700b

+ 0 - 5
src/sentry/spans/grouping/strategy/base.py

@@ -251,11 +251,6 @@ def remove_http_client_query_string_strategy(span: Span) -> Optional[Sequence[st
     return [method, url.scheme, url.netloc, url.path]
 
 
-@span_op("http.client")
-def wildcard_replacement_strategy(span: Span) -> Optional[Sequence[str]]:
-    return None
-
-
 @span_op(["redis", "db.redis"])
 def remove_redis_command_arguments_strategy(span: Span) -> Optional[Sequence[str]]:
     """For a `redis` span, the fingerprint to use is simply the redis command name.

+ 0 - 11
src/sentry/spans/grouping/strategy/config.py

@@ -10,7 +10,6 @@ from sentry.spans.grouping.strategy.base import (
     parametrize_db_span_strategy,
     remove_http_client_query_string_strategy,
     remove_redis_command_arguments_strategy,
-    wildcard_replacement_strategy,
 )
 
 
@@ -70,13 +69,3 @@ register_configuration(
         remove_redis_command_arguments_strategy,
     ],
 )
-
-register_configuration(
-    "clustering:2023-04-03",
-    strategies=[
-        parametrize_db_span_strategy,
-        wildcard_replacement_strategy,
-        remove_http_client_query_string_strategy,
-        remove_redis_command_arguments_strategy,
-    ],
-)

+ 0 - 53
src/sentry/spans/grouping/strategy/glob_replace.py

@@ -1,53 +0,0 @@
-import re
-from typing import Match
-
-GLOB_REGEX = re.compile(r"\*\*|\*")
-
-SINGLE_STAR = "([^/]*?)"
-DOUBLE_STAR = "(?:.*?)"
-
-WILDCARD_CHARACTER = "*"
-
-
-def glob_replace(source: str, glob: str) -> str:
-    """
-    Given a source string and a glob, replaces all globbed chunks of the source
-    string with the replacement character.
-
-    Matches to an asterisk are replaces with an asterisk. Matches to a double
-    asterisk are kept as-is.
-
-    e.g., given the string `"hello there world friends"` and the glob `"hello *
-    world**"` returns the string `"hello * world friends"`
-    """
-
-    regex_pattern_equivalent_to_glob = re.sub(GLOB_REGEX, replace_glob_with_regex_group, glob)
-    regex_equivalent_to_glob = re.compile(f"^{regex_pattern_equivalent_to_glob}$")
-
-    match = re.search(regex_equivalent_to_glob, source)
-    if not match:  # If the glob fails, the rule is not applicable. Return the original string
-        return source
-
-    new_source = ""
-    curr = 0
-
-    for i in range(1, regex_equivalent_to_glob.groups + 1):  # Group 0 is the entire match
-        span = match.span(i)
-
-        new_source += source[curr : span[0]]
-        new_source += WILDCARD_CHARACTER
-        curr = span[1]
-
-    new_source += source[curr:]
-
-    return new_source
-
-
-def replace_glob_with_regex_group(match: Match[str]) -> str:
-    if match.group() == "**":
-        return DOUBLE_STAR
-
-    if match.group() == "*":
-        return SINGLE_STAR
-
-    return match.group()  # Unknown glob type

+ 0 - 33
tests/sentry/spans/grouping/test_glob_replace.py

@@ -1,33 +0,0 @@
-import pytest
-
-from sentry.spans.grouping.strategy.glob_replace import glob_replace
-
-
-@pytest.mark.parametrize(
-    "source,rule,result",
-    [
-        (
-            "/api/0/issues/sentry/details",
-            "/api/0/issues/*/**",
-            "/api/0/issues/*/details",
-        ),
-        (
-            "/api/0/organizations/sentry/issues/",
-            "/api/**/issues",
-            "/api/0/organizations/sentry/issues/",
-        ),
-        (
-            "hello there world friends",
-            "hello * world**",
-            "hello * world friends",
-        ),
-        (
-            "/api/0/organizations/sentry/projects/javascript/info",
-            "/api/0/organizations/*/projects/*/**",
-            "/api/0/organizations/*/projects/*/info",
-        ),
-    ],
-)
-@pytest.mark.django_db
-def test_glob_replace(source: str, rule: str, result) -> None:
-    assert glob_replace(source, rule) == result