|
@@ -52,7 +52,7 @@ CONTAINS_PARAMETER_REGEX = re.compile(
|
|
|
|
|
|
|
|
|
class DetectorType(Enum):
|
|
|
- SLOW_SPAN = "slow_span"
|
|
|
+ SLOW_DB_QUERY = "slow_db_query"
|
|
|
RENDER_BLOCKING_ASSET_SPAN = "render_blocking_assets"
|
|
|
N_PLUS_ONE_DB_QUERIES = "n_plus_one_db"
|
|
|
N_PLUS_ONE_DB_QUERIES_EXTENDED = "n_plus_one_db_ext"
|
|
@@ -64,7 +64,7 @@ class DetectorType(Enum):
|
|
|
|
|
|
|
|
|
DETECTOR_TYPE_TO_GROUP_TYPE = {
|
|
|
- DetectorType.SLOW_SPAN: GroupType.PERFORMANCE_SLOW_SPAN,
|
|
|
+ DetectorType.SLOW_DB_QUERY: GroupType.PERFORMANCE_SLOW_DB_QUERY,
|
|
|
DetectorType.RENDER_BLOCKING_ASSET_SPAN: GroupType.PERFORMANCE_RENDER_BLOCKING_ASSET_SPAN,
|
|
|
DetectorType.N_PLUS_ONE_DB_QUERIES: GroupType.PERFORMANCE_N_PLUS_ONE_DB_QUERIES,
|
|
|
DetectorType.N_PLUS_ONE_DB_QUERIES_EXTENDED: GroupType.PERFORMANCE_N_PLUS_ONE_DB_QUERIES,
|
|
@@ -83,7 +83,7 @@ DETECTOR_TYPE_ISSUE_CREATION_TO_SYSTEM_OPTION = {
|
|
|
DetectorType.N_PLUS_ONE_API_CALLS: "performance.issues.n_plus_one_api_calls.problem-creation",
|
|
|
DetectorType.FILE_IO_MAIN_THREAD: "performance.issues.file_io_main_thread.problem-creation",
|
|
|
DetectorType.UNCOMPRESSED_ASSETS: "performance.issues.compressed_assets.problem-creation",
|
|
|
- DetectorType.SLOW_SPAN: "performance.issues.slow_span.problem-creation",
|
|
|
+ DetectorType.SLOW_DB_QUERY: "performance.issues.slow_db_query.problem-creation",
|
|
|
}
|
|
|
|
|
|
|
|
@@ -213,7 +213,7 @@ def get_detection_settings(project_id: Optional[int] = None) -> Dict[DetectorTyp
|
|
|
)
|
|
|
|
|
|
return {
|
|
|
- DetectorType.SLOW_SPAN: [
|
|
|
+ DetectorType.SLOW_DB_QUERY: [
|
|
|
{
|
|
|
"duration_threshold": 1000.0, # ms
|
|
|
"allowed_span_ops": ["db"],
|
|
@@ -274,7 +274,7 @@ def _detect_performance_problems(
|
|
|
detection_settings = get_detection_settings(project_id)
|
|
|
detectors: List[PerformanceDetector] = [
|
|
|
ConsecutiveDBSpanDetector(detection_settings, data),
|
|
|
- SlowSpanDetector(detection_settings, data),
|
|
|
+ SlowDBQueryDetector(detection_settings, data),
|
|
|
RenderBlockingAssetSpanDetector(detection_settings, data),
|
|
|
NPlusOneDBSpanDetector(detection_settings, data),
|
|
|
NPlusOneDBSpanDetectorExtended(detection_settings, data),
|
|
@@ -493,15 +493,15 @@ class PerformanceDetector(ABC):
|
|
|
return True
|
|
|
|
|
|
|
|
|
-class SlowSpanDetector(PerformanceDetector):
|
|
|
+class SlowDBQueryDetector(PerformanceDetector):
|
|
|
"""
|
|
|
Check for slow spans in a certain type of span.op (eg. slow db spans)
|
|
|
"""
|
|
|
|
|
|
__slots__ = "stored_problems"
|
|
|
|
|
|
- type: DetectorType = DetectorType.SLOW_SPAN
|
|
|
- settings_key = DetectorType.SLOW_SPAN
|
|
|
+ type: DetectorType = DetectorType.SLOW_DB_QUERY
|
|
|
+ settings_key = DetectorType.SLOW_DB_QUERY
|
|
|
|
|
|
def init(self):
|
|
|
self.stored_problems = {}
|
|
@@ -518,7 +518,7 @@ class SlowSpanDetector(PerformanceDetector):
|
|
|
if not fingerprint:
|
|
|
return
|
|
|
|
|
|
- if not SlowSpanDetector.is_span_eligible(span):
|
|
|
+ if not SlowDBQueryDetector.is_span_eligible(span):
|
|
|
return
|
|
|
|
|
|
description = span.get("description", None)
|
|
@@ -566,7 +566,7 @@ class SlowSpanDetector(PerformanceDetector):
|
|
|
def _fingerprint(self, hash):
|
|
|
signature = (str(hash)).encode("utf-8")
|
|
|
full_fingerprint = hashlib.sha1(signature).hexdigest()
|
|
|
- return f"1-{GroupType.PERFORMANCE_SLOW_SPAN.value}-{full_fingerprint}"
|
|
|
+ return f"1-{GroupType.PERFORMANCE_SLOW_DB_QUERY.value}-{full_fingerprint}"
|
|
|
|
|
|
|
|
|
class RenderBlockingAssetSpanDetector(PerformanceDetector):
|