diff --git a/bin/load-mocks b/bin/load-mocks index 8834aaa85b036f..30d11534e4b5c3 100755 --- a/bin/load-mocks +++ b/bin/load-mocks @@ -1054,9 +1054,9 @@ def create_mock_transactions( "span_id": uuid4().hex[:16], "hash": "858fea692d4d93e9", "data": { - "Transfer Size": 1_000_000, - "Encoded Body Size": 1_000_000, - "Decoded Body Size": 1_000_000, + "http.transfer_size": 1_000_000, + "http.response_content_length": 1_000_000, + "http.decoded_response_content_length": 1_000_000, }, }, ] @@ -1147,7 +1147,7 @@ def create_mock_transactions( "parent_span_id": parent_span_id, "span_id": uuid4().hex[:16], "hash": "858fea692d4d93e8", - "data": {"Encoded Body Size": 1000001}, + "data": {"http.response_content_length": 1000001}, } ] diff --git a/fixtures/events/performance_problems/consecutive-http/consecutive-http-basic.json b/fixtures/events/performance_problems/consecutive-http/consecutive-http-basic.json index b1726f2fa6e589..2565a05028795c 100644 --- a/fixtures/events/performance_problems/consecutive-http/consecutive-http-basic.json +++ b/fixtures/events/performance_problems/consecutive-http/consecutive-http-basic.json @@ -1381,9 +1381,9 @@ "parent_span_id": "90747d4310a2a358", "trace_id": "dfbb4f07016a450791bf09d308d66af4", "data": { - "Decoded Body Size": 2573190, - "Encoded Body Size": 527961, - "Transfer Size": 528261, + "http.decoded_response_content_length": 2573190, + "http.response_content_length": 527961, + "http.transfer_size": 528261, "resource.render_blocking_status": "non-blocking" }, "hash": "032ded07ff89c3b4" @@ -1431,9 +1431,9 @@ "parent_span_id": "90747d4310a2a358", "trace_id": "dfbb4f07016a450791bf09d308d66af4", "data": { - "Decoded Body Size": 3870, - "Encoded Body Size": 3461, - "Transfer Size": 3761, + "http.decoded_response_content_length": 3870, + "http.response_content_length": 3461, + "http.transfer_size": 3761, "resource.render_blocking_status": "non-blocking" }, "hash": "35a63c8a85b1279a" @@ -1448,9 +1448,9 @@ "parent_span_id": "90747d4310a2a358", "trace_id": "dfbb4f07016a450791bf09d308d66af4", "data": { - "Decoded Body Size": 492, - "Encoded Body Size": 492, - "Transfer Size": 792, + "http.decoded_response_content_length": 492, + "http.response_content_length": 492, + "http.transfer_size": 792, "resource.render_blocking_status": "non-blocking" }, "hash": "a2a63063e1bd6ed2" @@ -1465,9 +1465,9 @@ "parent_span_id": "90747d4310a2a358", "trace_id": "dfbb4f07016a450791bf09d308d66af4", "data": { - "Decoded Body Size": 5347, - "Encoded Body Size": 5347, - "Transfer Size": 5647, + "http.decoded_response_content_length": 5347, + "http.response_content_length": 5347, + "http.transfer_size": 5647, "resource.render_blocking_status": "non-blocking" }, "hash": "03cf160ff9190e10" diff --git a/fixtures/events/performance_problems/uncompressed-assets/uncompressed-script-asset.json b/fixtures/events/performance_problems/uncompressed-assets/uncompressed-script-asset.json index 199b9d01abcf33..84cca3668476f1 100644 --- a/fixtures/events/performance_problems/uncompressed-assets/uncompressed-script-asset.json +++ b/fixtures/events/performance_problems/uncompressed-assets/uncompressed-script-asset.json @@ -54,9 +54,9 @@ "parent_span_id": "a0c39078d1570b00", "trace_id": "0102834d0bf74d388ce0b1e15329f731", "data": { - "Decoded Body Size": 3, - "Encoded Body Size": 2, - "Transfer Size": 3 + "http.decoded_response_content_length": 3, + "http.response_content_length": 2, + "http.transfer_size": 3 }, "hash": "b2978b51d54d9078" }, @@ -70,9 +70,9 @@ "parent_span_id": "a0c39078d1570b00", "trace_id": "0102834d0bf74d388ce0b1e15329f731", "data": { - "Decoded Body Size": 571733, - "Encoded Body Size": 571733, - "Transfer Size": 571833 + "http.decoded_response_content_length": 571733, + "http.response_content_length": 571733, + "http.transfer_size": 571833 }, "hash": "a2978b51d54d9079" } diff --git a/src/sentry/data/samples/react-transaction.json b/src/sentry/data/samples/react-transaction.json index 1a19a44cf39f07..be75295c46a3e8 100644 --- a/src/sentry/data/samples/react-transaction.json +++ b/src/sentry/data/samples/react-transaction.json @@ -1912,9 +1912,9 @@ "parent_span_id": "a7afa33e288a45c4", "trace_id": "7eaab1c04557466d8588ddcb6bdd511d", "data": { - "Decoded Body Size": 1434, - "Encoded Body Size": 377, - "Transfer Size": 873, + "http.decoded_response_content_length": 1434, + "http.response_content_length": 377, + "http.transfer_size": 873, "duration": 0.19784391574400753, "offset": 1.987476914226067 } @@ -1928,9 +1928,9 @@ "parent_span_id": "a7afa33e288a45c4", "trace_id": "7eaab1c04557466d8588ddcb6bdd511d", "data": { - "Decoded Body Size": 2834, - "Encoded Body Size": 1031, - "Transfer Size": 1181, + "http.decoded_response_content_length": 2834, + "http.response_content_length": 1031, + "http.transfer_size": 1181, "duration": 0.03448497280930315, "offset": 2.185320829970075 } @@ -1944,9 +1944,9 @@ "parent_span_id": "a7afa33e288a45c4", "trace_id": "7eaab1c04557466d8588ddcb6bdd511d", "data": { - "Decoded Body Size": 393615, - "Encoded Body Size": 104822, - "Transfer Size": 105241, + "http.decoded_response_content_length": 393615, + "http.response_content_length": 104822, + "http.transfer_size": 105241, "duration": 0.06483037331022606, "offset": 2.219805802779378 } @@ -1973,9 +1973,9 @@ "parent_span_id": "a7afa33e288a45c4", "trace_id": "7eaab1c04557466d8588ddcb6bdd511d", "data": { - "Decoded Body Size": 14900, - "Encoded Body Size": 14900, - "Transfer Size": 15249, + "http.decoded_response_content_length": 14900, + "http.response_content_length": 14900, + "http.transfer_size": 15249, "duration": 0.07117168916452873, "offset": 2.3922796225243945 } @@ -1989,9 +1989,9 @@ "parent_span_id": "a7afa33e288a45c4", "trace_id": "7eaab1c04557466d8588ddcb6bdd511d", "data": { - "Decoded Body Size": 14904, - "Encoded Body Size": 14904, - "Transfer Size": 15018, + "http.decoded_response_content_length": 14904, + "http.response_content_length": 14904, + "http.transfer_size": 15018, "duration": 0.01938506940816541, "offset": 2.463451311688923 } @@ -2031,9 +2031,9 @@ "parent_span_id": "a7afa33e288a45c4", "trace_id": "7eaab1c04557466d8588ddcb6bdd511d", "data": { - "Decoded Body Size": 24838, - "Encoded Body Size": 3719, - "Transfer Size": 4007, + "http.decoded_response_content_length": 24838, + "http.response_content_length": 3719, + "http.transfer_size": 4007, "duration": 0.13824814691353782, "offset": 2.7785280575866445 } @@ -2047,9 +2047,9 @@ "parent_span_id": "a7afa33e288a45c4", "trace_id": "7eaab1c04557466d8588ddcb6bdd511d", "data": { - "Decoded Body Size": 0, - "Encoded Body Size": 0, - "Transfer Size": 0, + "http.decoded_response_content_length": 0, + "http.response_content_length": 0, + "http.transfer_size": 0, "duration": 0.029537339013289896, "offset": 2.916776204500182 } @@ -2063,9 +2063,9 @@ "parent_span_id": "a7afa33e288a45c4", "trace_id": "7eaab1c04557466d8588ddcb6bdd511d", "data": { - "Decoded Body Size": 0, - "Encoded Body Size": 0, - "Transfer Size": 0, + "http.decoded_response_content_length": 0, + "http.response_content_length": 0, + "http.transfer_size": 0, "duration": 0.19305941897035148, "offset": 2.946313543513472 } @@ -2079,9 +2079,9 @@ "parent_span_id": "a7afa33e288a45c4", "trace_id": "7eaab1c04557466d8588ddcb6bdd511d", "data": { - "Decoded Body Size": 0, - "Encoded Body Size": 0, - "Transfer Size": 0, + "http.decoded_response_content_length": 0, + "http.response_content_length": 0, + "http.transfer_size": 0, "duration": 0.8028300824075338, "offset": 3.1393729624838236 } diff --git a/src/sentry/data/samples/transaction-n-plus-one-api-call.json b/src/sentry/data/samples/transaction-n-plus-one-api-call.json index 806cb20aab3d83..952f0ac90e04d2 100644 --- a/src/sentry/data/samples/transaction-n-plus-one-api-call.json +++ b/src/sentry/data/samples/transaction-n-plus-one-api-call.json @@ -691,9 +691,9 @@ "parent_span_id": "829d17842d952371", "trace_id": "80972418b74940bda6977932055f7fcd", "data": { - "Decoded Body Size": 48521, - "Encoded Body Size": 9251, - "Transfer Size": 9551 + "http.decoded_response_content_length": 48521, + "http.response_content_length": 9251, + "http.transfer_size": 9551 }, "hash": "1f1dd0897c16565b" }, @@ -707,9 +707,9 @@ "parent_span_id": "829d17842d952371", "trace_id": "80972418b74940bda6977932055f7fcd", "data": { - "Decoded Body Size": 4529244, - "Encoded Body Size": 1103151, - "Transfer Size": 1103451 + "http.decoded_response_content_length": 4529244, + "http.response_content_length": 1103151, + "http.transfer_size": 1103451 }, "hash": "1f058070477778b8" }, @@ -723,9 +723,9 @@ "parent_span_id": "829d17842d952371", "trace_id": "80972418b74940bda6977932055f7fcd", "data": { - "Decoded Body Size": 166604, - "Encoded Body Size": 49443, - "Transfer Size": 49743 + "http.decoded_response_content_length": 166604, + "http.response_content_length": 49443, + "http.transfer_size": 49743 }, "hash": "254c644cff8b3e09" }, @@ -739,9 +739,9 @@ "parent_span_id": "829d17842d952371", "trace_id": "80972418b74940bda6977932055f7fcd", "data": { - "Decoded Body Size": 1980965, - "Encoded Body Size": 507607, - "Transfer Size": 507907 + "http.decoded_response_content_length": 1980965, + "http.response_content_length": 507607, + "http.transfer_size": 507907 }, "hash": "779ec19f50f1ea39" }, @@ -754,7 +754,7 @@ "span_id": "9d5b3c332aec7802", "parent_span_id": "829d17842d952371", "trace_id": "80972418b74940bda6977932055f7fcd", - "data": {"Decoded Body Size": 296, "Encoded Body Size": 296, "Transfer Size": 596}, + "data": {"http.decoded_response_content_length": 296, "http.response_content_length": 296, "http.transfer_size": 596}, "hash": "4f2043f50fc2f515" }, { @@ -766,7 +766,7 @@ "span_id": "a92f3520fc053460", "parent_span_id": "829d17842d952371", "trace_id": "80972418b74940bda6977932055f7fcd", - "data": {"Decoded Body Size": 76, "Encoded Body Size": 76, "Transfer Size": 376}, + "data": {"http.decoded_response_content_length": 76, "http.response_content_length": 76, "http.transfer_size": 376}, "hash": "26d97630b7867f3e" }, { @@ -779,9 +779,9 @@ "parent_span_id": "829d17842d952371", "trace_id": "80972418b74940bda6977932055f7fcd", "data": { - "Decoded Body Size": 78104, - "Encoded Body Size": 24604, - "Transfer Size": 24904 + "http.decoded_response_content_length": 78104, + "http.response_content_length": 24604, + "http.transfer_size": 24904 }, "hash": "b7d184affa2b21b2" }, @@ -806,9 +806,9 @@ "parent_span_id": "829d17842d952371", "trace_id": "80972418b74940bda6977932055f7fcd", "data": { - "Decoded Body Size": 25931, - "Encoded Body Size": 9296, - "Transfer Size": 300 + "http.decoded_response_content_length": 25931, + "http.response_content_length": 9296, + "http.transfer_size": 300 }, "hash": "35a63c8a85b1279a" }, diff --git a/src/sentry/data/samples/transaction-render-blocking-asset.json b/src/sentry/data/samples/transaction-render-blocking-asset.json index 28ec2b655a05d5..71c0e73fb81e2c 100644 --- a/src/sentry/data/samples/transaction-render-blocking-asset.json +++ b/src/sentry/data/samples/transaction-render-blocking-asset.json @@ -123,7 +123,7 @@ "parent_span_id": "d333ac34048040f7", "trace_id": "af6cd4ed98d1459a9d496071342ab3e7", "data": { - "Encoded Body Size": 1000001, + "http.response_content_length": 1000001, "duration": 1 }, "hash": "a8b09954a220aea9" diff --git a/src/sentry/utils/performance_issues/detectors/large_payload_detector.py b/src/sentry/utils/performance_issues/detectors/large_payload_detector.py index a6e7a2b5a1179f..338a8ae73457da 100644 --- a/src/sentry/utils/performance_issues/detectors/large_payload_detector.py +++ b/src/sentry/utils/performance_issues/detectors/large_payload_detector.py @@ -24,7 +24,9 @@ def visit_span(self, span: Span) -> None: return data = span.get("data", None) - encoded_body_size = data and data.get("Encoded Body Size", None) + encoded_body_size = data and ( + data.get("http.response_content_length", None) or data.get("Encoded Body Size") + ) if not (encoded_body_size): return diff --git a/src/sentry/utils/performance_issues/detectors/render_blocking_asset_span_detector.py b/src/sentry/utils/performance_issues/detectors/render_blocking_asset_span_detector.py index 4d3c2fe6b7f582..a53bedea5161d0 100644 --- a/src/sentry/utils/performance_issues/detectors/render_blocking_asset_span_detector.py +++ b/src/sentry/utils/performance_issues/detectors/render_blocking_asset_span_detector.py @@ -100,7 +100,11 @@ def _is_blocking_render(self, span): return False minimum_size_bytes = self.settings.get("minimum_size_bytes") - encoded_body_size = data and data.get("Encoded Body Size", 0) or 0 + encoded_body_size = ( + data + and (data.get("http.response_content_length", 0) or data.get("Encoded Body Size", 0)) + or 0 + ) if encoded_body_size < minimum_size_bytes or encoded_body_size > self.MAX_SIZE_BYTES: return False diff --git a/src/sentry/utils/performance_issues/detectors/uncompressed_asset_detector.py b/src/sentry/utils/performance_issues/detectors/uncompressed_asset_detector.py index 9cfdb93a12fbb4..d58c3aff84ad75 100644 --- a/src/sentry/utils/performance_issues/detectors/uncompressed_asset_detector.py +++ b/src/sentry/utils/performance_issues/detectors/uncompressed_asset_detector.py @@ -36,9 +36,16 @@ def visit_span(self, span: Span) -> None: return data = span.get("data", None) - transfer_size = data and data.get("Transfer Size", None) - encoded_body_size = data and data.get("Encoded Body Size", None) - decoded_body_size = data and data.get("Decoded Body Size", None) + transfer_size = data and ( + data.get("http.transfer_size", None) or data.get("Transfer Size", None) + ) + encoded_body_size = data and ( + data.get("http.response_content_length", None) or data.get("Encoded Body Size", None) + ) + decoded_body_size = data and ( + data.get("http.decoded_response_content_length", None) + or data.get("Decoded Body Size", None) + ) if not (encoded_body_size and decoded_body_size and transfer_size): return diff --git a/tests/sentry/utils/performance_issues/test_large_http_payload_detector.py b/tests/sentry/utils/performance_issues/test_large_http_payload_detector.py index e722f6071f3c2f..55c6c3fc4cb7d1 100644 --- a/tests/sentry/utils/performance_issues/test_large_http_payload_detector.py +++ b/tests/sentry/utils/performance_issues/test_large_http_payload_detector.py @@ -36,9 +36,9 @@ def test_detects_large_http_payload_issue(self): "GET /api/0/organizations/endpoint1", "hash1", data={ - "Transfer Size": 50_000_000, - "Encoded Body Size": 50_000_000, - "Decoded Body Size": 50_000_000, + "http.transfer_size": 50_000_000, + "http.response_content_length": 50_000_000, + "http.decoded_response_content_length": 50_000_000, }, ) ] @@ -70,9 +70,9 @@ def test_does_not_issue_if_url_is_an_asset(self): desc="https://s1.sentry-cdn.com/_static/dist/sentry/entrypoints/app.js", duration=1000.0, data={ - "Transfer Size": 50_000_000, - "Encoded Body Size": 50_000_000, - "Decoded Body Size": 50_000_000, + "http.transfer_size": 50_000_000, + "http.response_content_length": 50_000_000, + "http.decoded_response_content_length": 50_000_000, }, ) ] diff --git a/tests/sentry/utils/performance_issues/test_render_blocking_asset_detector.py b/tests/sentry/utils/performance_issues/test_render_blocking_asset_detector.py index a265877505c0c2..3debe664da8a44 100644 --- a/tests/sentry/utils/performance_issues/test_render_blocking_asset_detector.py +++ b/tests/sentry/utils/performance_issues/test_render_blocking_asset_detector.py @@ -35,9 +35,9 @@ def _valid_render_blocking_asset_event(url: str) -> Event: desc=url, duration=1000.0, data={ - "Transfer Size": 1200000, - "Encoded Body Size": 1200000, - "Decoded Body Size": 2000000, + "http.transfer_size": 1200000, + "http.response_content_length": 1200000, + "http.decoded_response_content_length": 2000000, "resource.render_blocking_status": "blocking", }, ), @@ -119,7 +119,7 @@ def test_does_not_detect_if_too_small(self): event = _valid_render_blocking_asset_event("https://example.com/a.js") for span in event["spans"]: if span["op"] == "resource.script": - span["data"]["Encoded Body Size"] = 900000 + span["data"]["http.response_content_length"] = 900000 assert self.find_problems(event) == [] def test_does_not_detect_if_missing_size(self): @@ -134,7 +134,7 @@ def test_does_not_detect_if_too_large(self): for span in event["spans"]: if span["op"] == "resource.script": # This is a real value we saw in production. - span["data"]["Encoded Body Size"] = 18446744073709552000 + span["data"]["http.response_content_length"] = 18446744073709552000 assert self.find_problems(event) == [] def test_detects_if_render_blocking_status_is_missing(self): diff --git a/tests/sentry/utils/performance_issues/test_uncompressed_assets_detector.py b/tests/sentry/utils/performance_issues/test_uncompressed_assets_detector.py index 8177d383e93969..92fd4ae2519e41 100644 --- a/tests/sentry/utils/performance_issues/test_uncompressed_assets_detector.py +++ b/tests/sentry/utils/performance_issues/test_uncompressed_assets_detector.py @@ -31,9 +31,9 @@ def create_compressed_asset_span(): desc="https://someothersite.example.com/app.js", duration=1.0, data={ - "Transfer Size": 5, - "Encoded Body Size": 4, - "Decoded Body Size": 5, + "http.transfer_size": 5, + "http.response_content_length": 4, + "http.decoded_response_content_length": 5, }, ) @@ -59,9 +59,9 @@ def test_detects_uncompressed_asset_with_none_tag(self): create_asset_span( duration=1000.0, data={ - "Transfer Size": 1_000_000, - "Encoded Body Size": 1_000_000, - "Decoded Body Size": 1_000_000, + "http.transfer_size": 1_000_000, + "http.response_content_length": 1_000_000, + "http.decoded_response_content_length": 1_000_000, }, ), create_compressed_asset_span(), @@ -96,9 +96,9 @@ def test_detects_uncompressed_asset(self): create_asset_span( duration=1000.0, data={ - "Transfer Size": 1_000_000, - "Encoded Body Size": 1_000_000, - "Decoded Body Size": 1_000_000, + "http.transfer_size": 1_000_000, + "http.response_content_length": 1_000_000, + "http.decoded_response_content_length": 1_000_000, }, ), create_compressed_asset_span(), @@ -135,9 +135,9 @@ def test_detects_uncompressed_asset_stylesheet(self): desc="https://s1.sentry-cdn.com/_static/dist/sentry/entrypoints/app.css", duration=1000.0, data={ - "Transfer Size": 1_000_000, - "Encoded Body Size": 1_000_000, - "Decoded Body Size": 1_000_000, + "http.transfer_size": 1_000_000, + "http.response_content_length": 1_000_000, + "http.decoded_response_content_length": 1_000_000, }, ), create_compressed_asset_span(), @@ -174,9 +174,9 @@ def test_does_not_detect_woff_asset(self): desc="https://s1.sentry-cdn.com/_static/dist/sentry/entrypoints/app.css", duration=1000.0, data={ - "Transfer Size": 1_000_000, - "Encoded Body Size": 1_000_000, - "Decoded Body Size": 1_000_000, + "http.transfer_size": 1_000_000, + "http.response_content_length": 1_000_000, + "http.decoded_response_content_length": 1_000_000, }, ), create_compressed_asset_span(), @@ -208,9 +208,9 @@ def test_does_not_detect_woff_asset(self): desc="https://s1.sentry-cdn.com/_static/dist/sentry/entrypoints/app.woff2", duration=1000.0, data={ - "Transfer Size": 1_000_000, - "Encoded Body Size": 1_000_000, - "Decoded Body Size": 1_000_000, + "http.transfer_size": 1_000_000, + "http.response_content_length": 1_000_000, + "http.decoded_response_content_length": 1_000_000, }, ), create_compressed_asset_span(), @@ -227,9 +227,9 @@ def test_does_not_detect_mobile_uncompressed_asset(self): create_asset_span( duration=1000.0, data={ - "Transfer Size": 1_000_000, - "Encoded Body Size": 1_000_000, - "Decoded Body Size": 1_000_000, + "http.transfer_size": 1_000_000, + "http.response_content_length": 1_000_000, + "http.decoded_response_content_length": 1_000_000, }, ), create_compressed_asset_span(), @@ -246,9 +246,9 @@ def test_ignores_assets_under_size(self): create_asset_span( duration=1000.0, data={ - "Transfer Size": 1_000_000, - "Encoded Body Size": 99_999, - "Decoded Body Size": 99_999, + "http.transfer_size": 1_000_000, + "http.response_content_length": 99_999, + "http.decoded_response_content_length": 99_999, }, ), create_compressed_asset_span(), @@ -265,9 +265,9 @@ def test_ignores_compressed_assets(self): create_asset_span( duration=1000.0, data={ - "Transfer Size": 1_000_000, - "Encoded Body Size": 101_000, - "Decoded Body Size": 100_999, + "http.transfer_size": 1_000_000, + "http.response_content_length": 101_000, + "http.decoded_response_content_length": 100_999, }, ), create_compressed_asset_span(), @@ -284,9 +284,9 @@ def test_ignores_assets_under_duration(self): create_asset_span( duration=50.0, data={ - "Transfer Size": 1_000_000, - "Encoded Body Size": 101_000, - "Decoded Body Size": 101_000, + "http.transfer_size": 1_000_000, + "http.response_content_length": 101_000, + "http.decoded_response_content_length": 101_000, }, ), create_compressed_asset_span(),