Skip to content

Commit

Permalink
feat(perf): Add frames delay to mobile vitals
Browse files Browse the repository at this point in the history
Add frames delay as a known mobile measurement.
  • Loading branch information
philipphofmann committed Dec 7, 2023
1 parent e4741fc commit 3137fed
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"measurements.frames_total",
"measurements.frames_slow",
"measurements.frames_frozen",
"measurements.frames_delay",
"measurements.stall_count",
"measurements.stall_stall_total_time",
"measurements.stall_stall_longest_time",
Expand Down
4 changes: 4 additions & 0 deletions src/sentry/data/samples/android-transaction.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@
"value": 1,
"unit": "none"
},
"frames_delay": {
"value": 1234.42,
"unit": "millisecond"
},
"screen_load_count": {
"value": 1,
"unit": "test"
Expand Down
1 change: 1 addition & 0 deletions src/sentry/relay/config/measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class BuiltinMeasurementKey(TypedDict):
{"name": "frames_slow_rate", "unit": "ratio"},
{"name": "frames_slow", "unit": "none"},
{"name": "frames_total", "unit": "none"},
{"name": "frames_delay", "unit": "millisecond"},
{"name": "inp", "unit": "millisecond"},
{"name": "lcp", "unit": "millisecond"},
{"name": "stall_count", "unit": "none"},
Expand Down
1 change: 1 addition & 0 deletions src/sentry/search/events/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ class ThresholdDict(TypedDict):
"measurements.frames_frozen": "d:transactions/measurements.frames_frozen@none",
"measurements.frames_slow": "d:transactions/measurements.frames_slow@none",
"measurements.frames_total": "d:transactions/measurements.frames_total@none",
"measurements.frames_delay": "d:transactions/measurements.frames_delay@millisecond",
"measurements.lcp": "d:transactions/measurements.lcp@millisecond",
"measurements.time_to_initial_display": "d:transactions/measurements.time_to_initial_display@millisecond",
"measurements.time_to_full_display": "d:transactions/measurements.time_to_full_display@millisecond",
Expand Down
1 change: 1 addition & 0 deletions src/sentry/sentry_metrics/indexer/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"d:transactions/measurements.score.weight.fid@ratio": PREFIX + 146,
"d:transactions/measurements.score.weight.lcp@ratio": PREFIX + 147,
"d:transactions/measurements.score.weight.ttfb@ratio": PREFIX + 148,
"d:transactions/measurements.frames_delay@millisecond": PREFIX + 149,
# Last possible index: 199
}

Expand Down
1 change: 1 addition & 0 deletions src/sentry/snuba/metrics/naming_layer/mri.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class TransactionMRI(Enum):
MEASUREMENTS_FRAMES_SLOW = "d:transactions/measurements.frames_slow@none"
MEASUREMENTS_FRAMES_SLOW_RATE = "d:transactions/measurements.frames_slow_rate@ratio"
MEASUREMENTS_FRAMES_TOTAL = "d:transactions/measurements.frames_total@none"
MEASUREMENTS_FRAMES_DELAY = "d:transactions/measurements.frames_delay@millisecond"
MEASUREMENTS_TIME_TO_INITIAL_DISPLAY = (
"d:transactions/measurements.time_to_initial_display@millisecond"
)
Expand Down
1 change: 1 addition & 0 deletions src/sentry/snuba/metrics/naming_layer/public.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class TransactionMetricKey(Enum):
MEASUREMENTS_FRAMES_SLOW = "transaction.measurements.frames_slow"
MEASUREMENTS_FRAMES_SLOW_RATE = "transaction.measurements.frames_slow_rate"
MEASUREMENTS_FRAMES_TOTAL = "transaction.measurements.frames_total"
MEASUREMENTS_FRAMES_DELAY = "transaction.measurements.frames_delay"
MEASUREMENTS_TIME_TO_INITIAL_DISPLAY = "transaction.measurements.time_to_initial_display"
MEASUREMENTS_TIME_TO_FULL_DISPLAY = "transaction.measurements.time_to_full_display"
MEASUREMENTS_STALL_COUNT = "transaction.measurements.stall_count"
Expand Down
1 change: 1 addition & 0 deletions src/sentry/utils/snuba.py
Original file line number Diff line number Diff line change
Expand Up @@ -1581,6 +1581,7 @@ def is_duration_measurement(key):
"measurements.app_start_warm",
"measurements.time_to_full_display",
"measurements.time_to_initial_display",
"measurements.frames_delay",
]


Expand Down
6 changes: 6 additions & 0 deletions static/app/utils/fields/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export enum MobileVital {
FRAMES_FROZEN = 'measurements.frames_frozen',
FRAMES_SLOW_RATE = 'measurements.frames_slow_rate',
FRAMES_FROZEN_RATE = 'measurements.frames_frozen_rate',
FRAMES_DELAY = 'measurements.frames_delay',
STALL_COUNT = 'measurements.stall_count',
STALL_TOTAL_TIME = 'measurements.stall_total_time',
STALL_LONGEST_TIME = 'measurements.stall_longest_time',
Expand Down Expand Up @@ -432,6 +433,11 @@ export const MEASUREMENT_FIELDS: Record<WebVital | MobileVital, FieldDefinition>
kind: FieldKind.METRICS,
valueType: FieldValueType.PERCENTAGE,
},
[MobileVital.FRAMES_DELAY]: {
desc: t('Duration of all delayed frames.'),
kind: FieldKind.METRICS,
valueType: FieldValueType.DURATION,
},
[MobileVital.STALL_COUNT]: {
desc: t('Count of slow Javascript event loops (React Native)'),
kind: FieldKind.METRICS,
Expand Down
8 changes: 8 additions & 0 deletions static/app/utils/performance/vitals/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ export const MOBILE_VITAL_DETAILS: Record<MobileVital, Vital> = {
),
type: measurementType(MobileVital.FRAMES_FROZEN_RATE),
},
[MobileVital.FRAMES_DELAY]: {
slug: 'frames_delay',
name: t('Frames Delay'),
description: t(
'Frames delay is the duration of all delayed frames recorded within a transaction.'
),
type: measurementType(MobileVital.FRAMES_DELAY),
},
[MobileVital.STALL_COUNT]: {
slug: 'stall_count',
name: t('Stalls'),
Expand Down
1 change: 1 addition & 0 deletions tests/relay_integration/test_metrics_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def test_all_transaction_metrics_emitted(self):
"frames_total": {"value": 100},
"frames_slow": {"value": 10},
"frames_frozen": {"value": 5},
"frames_delay": {"value": 0.0145},
"stall_count": {"value": 2},
"stall_total_time": {"value": 12},
"stall_longest_time": {"value": 7},
Expand Down
4 changes: 4 additions & 0 deletions tests/snuba/api/endpoints/test_organization_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -4961,6 +4961,7 @@ def test_mobile_measurements(self):
self.transaction_data["measurements"]["frames_total"] = {"value": 100}
self.transaction_data["measurements"]["frames_slow"] = {"value": 10}
self.transaction_data["measurements"]["frames_frozen"] = {"value": 5}
self.transaction_data["measurements"]["frames_delay"] = {"value": 0.16}
self.transaction_data["measurements"]["stall_count"] = {"value": 2}
self.transaction_data["measurements"]["stall_total_time"] = {"value": 12}
self.transaction_data["measurements"]["stall_longest_time"] = {"value": 7}
Expand All @@ -4973,6 +4974,7 @@ def test_mobile_measurements(self):
"measurements.frames_frozen",
"measurements.frames_slow_rate",
"measurements.frames_frozen_rate",
"measurements.frames_delay",
"measurements.stall_count",
"measurements.stall_total_time",
"measurements.stall_longest_time",
Expand All @@ -4990,6 +4992,7 @@ def test_mobile_measurements(self):
assert data[0]["measurements.frames_frozen"] == 5
assert data[0]["measurements.frames_slow_rate"] == 0.1
assert data[0]["measurements.frames_frozen_rate"] == 0.05
assert data[0]["measurements.frames_delay"] == 0.16
assert data[0]["measurements.stall_count"] == 2
assert data[0]["measurements.stall_total_time"] == 12
assert data[0]["measurements.stall_longest_time"] == 7
Expand All @@ -5000,6 +5003,7 @@ def test_mobile_measurements(self):
assert meta["measurements.frames_frozen"] == "number"
assert meta["measurements.frames_slow_rate"] == "percentage"
assert meta["measurements.frames_frozen_rate"] == "percentage"
assert meta["measurements.frames_delay"] == "duration"
assert meta["measurements.stall_count"] == "number"
assert meta["measurements.stall_total_time"] == "number"
assert meta["measurements.stall_longest_time"] == "number"
Expand Down

0 comments on commit 3137fed

Please sign in to comment.