From 2476fe8075fd83e1a06c3d489b049aa588be20de Mon Sep 17 00:00:00 2001 From: Casper Verhaar Date: Fri, 6 Jun 2025 14:34:28 +0200 Subject: [PATCH 1/3] Add total allocated bytes to MemoryInfoContext --- .../events/contexts/knownContext/memoryInfo.spec.tsx | 2 ++ .../components/events/contexts/knownContext/memoryInfo.tsx | 6 ++++++ static/app/types/event.tsx | 2 ++ 3 files changed, 10 insertions(+) diff --git a/static/app/components/events/contexts/knownContext/memoryInfo.spec.tsx b/static/app/components/events/contexts/knownContext/memoryInfo.spec.tsx index 1da288fe0fb2..3695bd1266d3 100644 --- a/static/app/components/events/contexts/knownContext/memoryInfo.spec.tsx +++ b/static/app/components/events/contexts/knownContext/memoryInfo.spec.tsx @@ -8,6 +8,7 @@ import {getMemoryInfoContext} from 'sentry/components/events/contexts/knownConte const MOCK_MEMORY_INFO_CONTEXT = { type: 'memory_info' as const, allocated_bytes: 1048576 * 1, + total_allocated_bytes: 1048576 * 1, fragmented_bytes: 1048576 * 2, heap_size_bytes: 1048576 * 3, high_memory_load_threshold_bytes: 1048576 * 4, @@ -40,6 +41,7 @@ describe('MemoryInfoContext', function () { it('returns values and according to the parameters', function () { expect(getMemoryInfoContext({data: MOCK_MEMORY_INFO_CONTEXT})).toEqual([ {key: 'allocated_bytes', subject: 'Allocated Bytes', value: '1.0 MiB'}, + {key: 'total_allocated_bytes', subject: 'Total Allocated Bytes', value: '1.0 MiB'}, {key: 'fragmented_bytes', subject: 'Fragmented Bytes', value: '2.0 MiB'}, {key: 'heap_size_bytes', subject: 'Heap Size Bytes', value: '3.0 MiB'}, { diff --git a/static/app/components/events/contexts/knownContext/memoryInfo.tsx b/static/app/components/events/contexts/knownContext/memoryInfo.tsx index 2c5fe3e5ef07..edb4b7fd476e 100644 --- a/static/app/components/events/contexts/knownContext/memoryInfo.tsx +++ b/static/app/components/events/contexts/knownContext/memoryInfo.tsx @@ -26,6 +26,12 @@ export function getMemoryInfoContext({ subject: t('Allocated Bytes'), value: data.allocated_bytes ? formatMemory(data.allocated_bytes) : undefined, }; + case MemoryInfoContextKey.TOTAL_ALLOCATED_BYTES: + return { + key: ctxKey, + subject: t('Total Allocated Bytes'), + value: data.total_allocated_bytes ? formatMemory(data.total_allocated_bytes) : undefined, + }; case MemoryInfoContextKey.FRAGMENTED_BYTES: return { key: ctxKey, diff --git a/static/app/types/event.tsx b/static/app/types/event.tsx index 894e1d75e3da..c22c87d1bf37 100644 --- a/static/app/types/event.tsx +++ b/static/app/types/event.tsx @@ -548,6 +548,7 @@ export interface UnityContext { export enum MemoryInfoContextKey { ALLOCATED_BYTES = 'allocated_bytes', + TOTAL_ALLOCATED_BYTES = 'total_allocated_bytes', FRAGMENTED_BYTES = 'fragmented_bytes', HEAP_SIZE_BYTES = 'heap_size_bytes', HIGH_MEMORY_LOAD_THRESHOLD_BYTES = 'high_memory_load_threshold_bytes', @@ -580,6 +581,7 @@ export interface MemoryInfoContext { [MemoryInfoContextKey.PAUSE_TIME_PERCENTAGE]?: number; [MemoryInfoContextKey.INDEX]?: number; [MemoryInfoContextKey.ALLOCATED_BYTES]?: number; + [MemoryInfoContextKey.TOTAL_ALLOCATED_BYTES]?: number; [MemoryInfoContextKey.FRAGMENTED_BYTES]?: number; [MemoryInfoContextKey.HEAP_SIZE_BYTES]?: number; [MemoryInfoContextKey.HIGH_MEMORY_LOAD_THRESHOLD_BYTES]?: number; From 2b68f293acd09cc296853db8a0bc85241ba47ce4 Mon Sep 17 00:00:00 2001 From: Casper Verhaar Date: Wed, 11 Jun 2025 11:00:30 +0200 Subject: [PATCH 2/3] Fix test --- .../events/contexts/knownContext/memoryInfo.spec.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/app/components/events/contexts/knownContext/memoryInfo.spec.tsx b/static/app/components/events/contexts/knownContext/memoryInfo.spec.tsx index 3695bd1266d3..872e15487a85 100644 --- a/static/app/components/events/contexts/knownContext/memoryInfo.spec.tsx +++ b/static/app/components/events/contexts/knownContext/memoryInfo.spec.tsx @@ -8,7 +8,6 @@ import {getMemoryInfoContext} from 'sentry/components/events/contexts/knownConte const MOCK_MEMORY_INFO_CONTEXT = { type: 'memory_info' as const, allocated_bytes: 1048576 * 1, - total_allocated_bytes: 1048576 * 1, fragmented_bytes: 1048576 * 2, heap_size_bytes: 1048576 * 3, high_memory_load_threshold_bytes: 1048576 * 4, @@ -16,6 +15,7 @@ const MOCK_MEMORY_INFO_CONTEXT = { memory_load_bytes: 1048576 * 6, total_committed_bytes: 1048576 * 7, promoted_bytes: 1048576 * 8, + total_allocated_bytes: 1048576 * 9, pinned_objects_count: 150, pause_time_percentage: 25.5, index: 12, @@ -41,7 +41,6 @@ describe('MemoryInfoContext', function () { it('returns values and according to the parameters', function () { expect(getMemoryInfoContext({data: MOCK_MEMORY_INFO_CONTEXT})).toEqual([ {key: 'allocated_bytes', subject: 'Allocated Bytes', value: '1.0 MiB'}, - {key: 'total_allocated_bytes', subject: 'Total Allocated Bytes', value: '1.0 MiB'}, {key: 'fragmented_bytes', subject: 'Fragmented Bytes', value: '2.0 MiB'}, {key: 'heap_size_bytes', subject: 'Heap Size Bytes', value: '3.0 MiB'}, { @@ -57,6 +56,7 @@ describe('MemoryInfoContext', function () { {key: 'memory_load_bytes', subject: 'Memory Load Bytes', value: '6.0 MiB'}, {key: 'total_committed_bytes', subject: 'Total Committed Bytes', value: '7.0 MiB'}, {key: 'promoted_bytes', subject: 'Promoted Bytes', value: '8.0 MiB'}, + {key: 'total_allocated_bytes', subject: 'Total Allocated Bytes', value: '9.0 MiB'}, {key: 'pinned_objects_count', subject: 'Pinned Objects Count', value: 150}, {key: 'pause_time_percentage', subject: 'Pause Time Percentage', value: 25.5}, {key: 'index', subject: 'Index', value: 12}, From 3d04c8bf82648fcb5d96224dab1473cb0b218a48 Mon Sep 17 00:00:00 2001 From: Casper Verhaar Date: Wed, 11 Jun 2025 18:55:22 +0200 Subject: [PATCH 3/3] Fix formatting --- .../components/events/contexts/knownContext/memoryInfo.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/static/app/components/events/contexts/knownContext/memoryInfo.tsx b/static/app/components/events/contexts/knownContext/memoryInfo.tsx index edb4b7fd476e..a3550efcb801 100644 --- a/static/app/components/events/contexts/knownContext/memoryInfo.tsx +++ b/static/app/components/events/contexts/knownContext/memoryInfo.tsx @@ -30,7 +30,9 @@ export function getMemoryInfoContext({ return { key: ctxKey, subject: t('Total Allocated Bytes'), - value: data.total_allocated_bytes ? formatMemory(data.total_allocated_bytes) : undefined, + value: data.total_allocated_bytes + ? formatMemory(data.total_allocated_bytes) + : undefined, }; case MemoryInfoContextKey.FRAGMENTED_BYTES: return {