|
@@ -1,4 +1,3 @@
|
|
|
-import csv
|
|
|
from dataclasses import dataclass
|
|
|
from typing import Any, List, Literal, Sequence, Tuple, TypedDict, Union
|
|
|
|
|
@@ -152,7 +151,8 @@ def _threshold_to_rules(
|
|
|
return [frustrated, tolerated, satisfied]
|
|
|
|
|
|
|
|
|
-# Generated from a one-off query:
|
|
|
+# These JSON results are generated by S&S using internal data-tooling. The
|
|
|
+# roughly equivalent ClickHouse query that we used to use instead is:
|
|
|
#
|
|
|
# SELECT
|
|
|
# platform,
|
|
@@ -169,68 +169,451 @@ def _threshold_to_rules(
|
|
|
# ORDER BY c DESC
|
|
|
# LIMIT 50
|
|
|
# FORMAT CSVWithNames
|
|
|
-_HISTOGRAM_OUTLIERS_QUERY_RESULTS = """
|
|
|
-"javascript","pageload",35018,"[1440,4137.25]","[0,0]","[0,1321.250081062317]"
|
|
|
-"javascript","navigation",28523,"[405,1036]","[0,0]","[0,0]"
|
|
|
-"python","http.server",12234,"[3,111]","[0,0]","[0,0]"
|
|
|
-"node","http.server",8774,"[2,91]","[0,0]","[0,0]"
|
|
|
-"php","http.server",7260,"[33,212]","[0,0]","[0,0]"
|
|
|
-"python","celery.task",2947,"[19,304]","[0,0]","[0,0]"
|
|
|
-"ruby","rails.request",2923,"[7,105]","[0,0]","[0,0]"
|
|
|
-"javascript","ui.load",2714,"[1708,4302296.25]","[0,0]","[0,0]"
|
|
|
-"cocoa","ui.load",1539,"[94,625]","[0,0]","[0,0]"
|
|
|
-"node","awslambda.handler",1503,"[15,300]","[0,0]","[0,0]"
|
|
|
-"csharp","http.server",1188,"[0,59]","[0,0]","[0,0]"
|
|
|
-"java","http.server",1052,"[3,68.25]","[0,0]","[0,0]"
|
|
|
-"python","serverless.function",1038,"[21,384]","[0,0]","[0,0]"
|
|
|
-"java","ui.load",993,"[70,580]","[0,0]","[0,0]"
|
|
|
-"ruby","active_job",688,"[13,217]","[0,0]","[0,0]"
|
|
|
-"ruby","sidekiq",626,"[12,210]","[0,0]","[0,0]"
|
|
|
-"javascript","default",532,"[182.75,1074.5]","[0,0]","[0,0]"
|
|
|
-"python","asgi.server",370,"[152,840.25]","[0,0]","[0,0]"
|
|
|
-"other","navigation",362,"[1001,3002]","[0,0]","[0,0]"
|
|
|
-"php","console.command",237,"[48,1577]","[0,0]","[0,0]"
|
|
|
-"node","default",215,"[42,302]","[0,0]","[0,0]"
|
|
|
-"node","transaction",211,"[1,50]","[0,0]","[0,0]"
|
|
|
-"go","http.server",192,"[0,41]","[0,0]","[0,0]"
|
|
|
-"ruby","rails.action_cable",186,"[0,6]","[0,0]","[0,0]"
|
|
|
-"python","rq.task",172,"[99,654]","[0,0]","[0,0]"
|
|
|
-"other","pageload",156,"[3000,3000]","[4589.822045672948,4589.822045672948]","[3384.3555060724457,3384.3555060724457]"
|
|
|
-"node","gql",123,"[14,220]","[0,0]","[0,0]"
|
|
|
-"ruby","rack.request",121,"[2,76]","[0,0]","[0,0]"
|
|
|
-"node","test",107,"[14.75,1997]","[0,0]","[0,0]"
|
|
|
-"node","gcp.function.http",103,"[5,426.25]","[0,0]","[0,0]"
|
|
|
-"python","default",91,"[4,462.25]","[0,0]","[0,0]"
|
|
|
-"php","queue.process",88,"[20,319]","[0,0]","[0,0]"
|
|
|
-"python","task",86,"[3,299]","[0,0]","[0,0]"
|
|
|
-"other","http.server",81,"[4,20]","[0,0]","[0,0]"
|
|
|
-"python","websocket.server",74,"[1,124]","[0,0]","[0,0]"
|
|
|
-"php","sentry.test",66,"[0,175.5]","[0,0]","[0,0]"
|
|
|
-"ruby","delayed_job",63,"[6,54]","[0,0]","[0,0]"
|
|
|
-"node","request",60,"[4,239]","[0,0]","[0,0]"
|
|
|
-"python","query",57,"[40,286]","[0,0]","[0,0]"
|
|
|
-"java","navigation",50,"[107,2035]","[0,0]","[0,0]"
|
|
|
-"python","mutation",49,"[8,60]","[0,0]","[0,0]"
|
|
|
-"java","task",49,"[150,727]","[0,0]","[0,0]"
|
|
|
-"other","task",42,"[137,804]","[0,0]","[0,0]"
|
|
|
-"php","http.request",38,"[44,328]","[0,0]","[0,0]"
|
|
|
-"node","execute",38,"[23,215]","[0,0]","[0,0]"
|
|
|
-"node","gcp.function.event",37,"[0,394]","[0,0]","[0,0]"
|
|
|
-"cocoa","ui.action",32,"[716,2668.25]","[0,0]","[0,0]"
|
|
|
-"php","default",31,"[14,74]","[0,0]","[0,0]"
|
|
|
-"cocoa","ui.action.click",29,"[541.75,2988]","[0,0]","[0,0]"
|
|
|
-"node","functions.https.onCall",28,"[12,309]","[0,0]","[0,0]"
|
|
|
-"""
|
|
|
-
|
|
|
-
|
|
|
-def _parse_percentiles(value: str) -> Tuple[float, float]:
|
|
|
- p25, p75 = map(float, value.strip("[]").split(","))
|
|
|
+_HISTOGRAM_OUTLIERS_QUERY_RESULTS = [
|
|
|
+ {
|
|
|
+ "platform": "javascript",
|
|
|
+ "op": "pageload",
|
|
|
+ "c": "55927",
|
|
|
+ "duration": ["0", "1539", "2813", "5185", "1678818846004"],
|
|
|
+ "lcp": [
|
|
|
+ "-58.39991569519043",
|
|
|
+ "730.3001880645752",
|
|
|
+ "1364.1000000238421",
|
|
|
+ "2533.2000255584717",
|
|
|
+ "7160348981.6997051",
|
|
|
+ ],
|
|
|
+ "fcp": [
|
|
|
+ "-30.0",
|
|
|
+ "578.29999923706055",
|
|
|
+ "1051.0001182556152",
|
|
|
+ "1908.10000000149",
|
|
|
+ "4295032969.0001011",
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "javascript",
|
|
|
+ "op": "navigation",
|
|
|
+ "c": "46130",
|
|
|
+ "duration": ["0", "372", "964", "1287", "1678819998036"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "python",
|
|
|
+ "op": "http.server",
|
|
|
+ "c": "20286",
|
|
|
+ "duration": ["0", "3", "23", "98", "7169297964"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "node",
|
|
|
+ "op": "http.server",
|
|
|
+ "c": "16548",
|
|
|
+ "duration": ["0", "2", "20", "128", "40043925665"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "php",
|
|
|
+ "op": "http.server",
|
|
|
+ "c": "11844",
|
|
|
+ "duration": ["0", "35", "90", "249", "194551915"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "javascript",
|
|
|
+ "op": "ui.load",
|
|
|
+ "c": "5586",
|
|
|
+ "duration": ["0", "1419", "3849", "50909", "1678715114066"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "python",
|
|
|
+ "op": "celery.task",
|
|
|
+ "c": "2936",
|
|
|
+ "duration": ["0", "32", "94", "403", "462304451"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "ruby",
|
|
|
+ "op": "rails.request",
|
|
|
+ "c": "2719",
|
|
|
+ "duration": ["0", "7", "27", "107", "411239453"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "python",
|
|
|
+ "op": "queue.task.celery",
|
|
|
+ "c": "2122",
|
|
|
+ "duration": ["0", "29", "122", "681", "281861579"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "node",
|
|
|
+ "op": "function.nextjs",
|
|
|
+ "c": "2048",
|
|
|
+ "duration": ["0", "1", "26", "127", "1047980"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "cocoa",
|
|
|
+ "op": "ui.load",
|
|
|
+ "c": "2025",
|
|
|
+ "duration": ["0", "135", "554", "698", "1678189573840"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "csharp",
|
|
|
+ "op": "http.server",
|
|
|
+ "c": "1951",
|
|
|
+ "duration": ["0", "1", "15", "82", "683064520"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "ruby",
|
|
|
+ "op": "http.server",
|
|
|
+ "c": "1944",
|
|
|
+ "duration": ["0", "7", "20", "92", "230606309"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "java",
|
|
|
+ "op": "ui.load",
|
|
|
+ "c": "1867",
|
|
|
+ "duration": ["0", "145", "291", "831", "1678830256706"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "java",
|
|
|
+ "op": "http.server",
|
|
|
+ "c": "1772",
|
|
|
+ "duration": ["0", "2", "9", "63", "335196060"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "node",
|
|
|
+ "op": "awslambda.handler",
|
|
|
+ "c": "1522",
|
|
|
+ "duration": ["0", "19", "103", "451", "2274015"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "python",
|
|
|
+ "op": "serverless.function",
|
|
|
+ "c": "1046",
|
|
|
+ "duration": ["0", "29", "52", "120", "32730840"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "node",
|
|
|
+ "op": "function.aws.lambda",
|
|
|
+ "c": "915",
|
|
|
+ "duration": ["0", "61", "206", "454", "8143646"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "javascript",
|
|
|
+ "op": "default",
|
|
|
+ "c": "850",
|
|
|
+ "duration": ["0", "0", "237", "804", "1678679274843"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "python",
|
|
|
+ "op": "function.aws",
|
|
|
+ "c": "821",
|
|
|
+ "duration": ["0", "0", "75", "366", "899160"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "ruby",
|
|
|
+ "op": "active_job",
|
|
|
+ "c": "729",
|
|
|
+ "duration": ["0", "31", "153", "288", "14992111"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "other",
|
|
|
+ "op": "navigation",
|
|
|
+ "c": "689",
|
|
|
+ "duration": ["0", "1102", "2629", "3003", "448059236223"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "ruby",
|
|
|
+ "op": "queue.active_job",
|
|
|
+ "c": "629",
|
|
|
+ "duration": ["0", "25", "112", "1216", "202727763"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "ruby",
|
|
|
+ "op": "sidekiq",
|
|
|
+ "c": "569",
|
|
|
+ "duration": ["0", "14", "69", "246", "34998169"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "other",
|
|
|
+ "op": "pageload",
|
|
|
+ "c": "551",
|
|
|
+ "duration": ["988", "3000", "3000", "3000", "3700"],
|
|
|
+ "lcp": [
|
|
|
+ "4589.8220456729478",
|
|
|
+ "4589.8220456729478",
|
|
|
+ "4589.8220456729478",
|
|
|
+ "4589.8220456729478",
|
|
|
+ "4589.8220456729478",
|
|
|
+ ],
|
|
|
+ "fcp": [
|
|
|
+ "2057.7001571655273",
|
|
|
+ "3384.3555060724457",
|
|
|
+ "3384.3555060724457",
|
|
|
+ "3384.3555060724457",
|
|
|
+ "3384.3555060724457",
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "php",
|
|
|
+ "op": "console.command",
|
|
|
+ "c": "462",
|
|
|
+ "duration": ["0", "61", "150", "417", "3607425204"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "other",
|
|
|
+ "op": "middleware.nextjs",
|
|
|
+ "c": "447",
|
|
|
+ "duration": ["0", "0", "0", "0", "185123"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "ruby",
|
|
|
+ "op": "queue.sidekiq",
|
|
|
+ "c": "447",
|
|
|
+ "duration": ["0", "18", "145", "579", "24701323"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "node",
|
|
|
+ "op": "transaction",
|
|
|
+ "c": "446",
|
|
|
+ "duration": ["0", "5", "20", "87", "602756293"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "cocoa",
|
|
|
+ "op": "ui.action",
|
|
|
+ "c": "444",
|
|
|
+ "duration": ["0", "244", "1057", "2783", "498994"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "node",
|
|
|
+ "op": "default",
|
|
|
+ "c": "418",
|
|
|
+ "duration": ["0", "2", "69", "423", "24534033"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "cocoa",
|
|
|
+ "op": "ui.action.click",
|
|
|
+ "c": "400",
|
|
|
+ "duration": ["0", "223", "1127", "3797", "84802486"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "python",
|
|
|
+ "op": "asgi.server",
|
|
|
+ "c": "346",
|
|
|
+ "duration": ["0", "158", "298", "1291", "33673793505"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "go",
|
|
|
+ "op": "http.server",
|
|
|
+ "c": "302",
|
|
|
+ "duration": ["0", "0", "0", "4", "167496305"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "php",
|
|
|
+ "op": "sentry.test",
|
|
|
+ "c": "280",
|
|
|
+ "duration": ["0", "0", "0", "1", "223"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "ruby",
|
|
|
+ "op": "websocket.server",
|
|
|
+ "c": "255",
|
|
|
+ "duration": ["0", "0", "1", "4", "1065382"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "java",
|
|
|
+ "op": "ui.action.click",
|
|
|
+ "c": "207",
|
|
|
+ "duration": ["0", "343", "1271", "3560", "228385283"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "other",
|
|
|
+ "op": "http.server",
|
|
|
+ "c": "200",
|
|
|
+ "duration": ["0", "0", "7", "57", "7954687"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "node",
|
|
|
+ "op": "test",
|
|
|
+ "c": "188",
|
|
|
+ "duration": ["0", "12", "409", "1080", "263783678"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "node",
|
|
|
+ "op": "gql",
|
|
|
+ "c": "181",
|
|
|
+ "duration": ["0", "16", "39", "135", "1503274"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "python",
|
|
|
+ "op": "default",
|
|
|
+ "c": "181",
|
|
|
+ "duration": ["0", "5", "11", "67", "108818494"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "ruby",
|
|
|
+ "op": "rails.action_cable",
|
|
|
+ "c": "177",
|
|
|
+ "duration": ["0", "0", "0", "5", "291392"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "php",
|
|
|
+ "op": "queue.process",
|
|
|
+ "c": "167",
|
|
|
+ "duration": ["0", "26", "68", "232", "1641192"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "python",
|
|
|
+ "op": "websocket.server",
|
|
|
+ "c": "160",
|
|
|
+ "duration": ["0", "1", "2", "6226", "518009460"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "python",
|
|
|
+ "op": "rq.task",
|
|
|
+ "c": "151",
|
|
|
+ "duration": ["2", "175", "388", "490", "73547039"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "python",
|
|
|
+ "op": "task",
|
|
|
+ "c": "147",
|
|
|
+ "duration": ["0", "9", "54", "336", "12559622"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "java",
|
|
|
+ "op": "ui.action.swipe",
|
|
|
+ "c": "139",
|
|
|
+ "duration": ["0", "966", "2343", "5429", "56370777"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "python",
|
|
|
+ "op": "queue.task.rq",
|
|
|
+ "c": "136",
|
|
|
+ "duration": ["2", "113", "277", "913", "14400609"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "java",
|
|
|
+ "op": "navigation",
|
|
|
+ "c": "125",
|
|
|
+ "duration": ["0", "327", "1091", "2657", "123162256"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "platform": "java",
|
|
|
+ "op": "ui.action.scroll",
|
|
|
+ "c": "107",
|
|
|
+ "duration": ["1", "400", "951", "2158", "45034933"],
|
|
|
+ "lcp": [],
|
|
|
+ "fcp": [],
|
|
|
+ },
|
|
|
+]
|
|
|
+
|
|
|
+
|
|
|
+def _parse_percentiles(
|
|
|
+ value: Union[Tuple[()], Tuple[str, str, str, str, str]]
|
|
|
+) -> Tuple[float, float]:
|
|
|
+ if not value:
|
|
|
+ return 0, 0
|
|
|
+ _min, p25, _p50, p75, _max = map(float, value)
|
|
|
return p25, p75
|
|
|
|
|
|
|
|
|
-def _produce_histogram_outliers(query_csv: str) -> Sequence[MetricConditionalTaggingRule]:
|
|
|
+def _produce_histogram_outliers(query_results: Any) -> Sequence[MetricConditionalTaggingRule]:
|
|
|
rules: List[MetricConditionalTaggingRule] = []
|
|
|
- for platform, op, _, duration, lcp, fcp in csv.reader(query_csv.strip().splitlines()):
|
|
|
+ for row in query_results:
|
|
|
+ platform = row["platform"]
|
|
|
+ op = row["op"]
|
|
|
+ duration = row["duration"]
|
|
|
+ lcp = row["lcp"]
|
|
|
+ fcp = row["fcp"]
|
|
|
duration_p25, duration_p75 = _parse_percentiles(duration)
|
|
|
lcp_p25, lcp_p75 = _parse_percentiles(lcp)
|
|
|
fcp_p25, fcp_p75 = _parse_percentiles(fcp)
|