File tree Expand file tree Collapse file tree 4 files changed +22
-21
lines changed
ddtrace/profiling/exporter Expand file tree Collapse file tree 4 files changed +22
-21
lines changed Original file line number Diff line number Diff line change @@ -181,14 +181,10 @@ class _PprofConverter(object):
181181 ),
182182 )
183183
184- nevents = len (events)
185- sampling_ratio_avg = sum (event.capture_pct for event in events) / nevents / 100.0
186- total_alloc = sum (event.nevents for event in events)
187- number_of_alloc = total_alloc * sampling_ratio_avg
188- average_alloc_size = sum (event.size for event in events) / float (nevents)
189-
190- self ._location_values[location_key][" alloc-samples" ] = nevents
191- self ._location_values[location_key][" alloc-space" ] = round (number_of_alloc * average_alloc_size)
184+ self ._location_values[location_key][" alloc-samples" ] = sum (event.nevents for event in events)
185+ self ._location_values[location_key][" alloc-space" ] = round (
186+ sum (event.size / event.capture_pct * 100.0 for event in events)
187+ )
192188
193189 def convert_memalloc_heap_event (self , event ):
194190 location_key = (
Original file line number Diff line number Diff line change 1+ ---
2+ fixes :
3+ - |
4+ Fix the reporting of the allocated memory and the number of allocations in
5+ the profiler.
Original file line number Diff line number Diff line change @@ -152,8 +152,8 @@ sample {
152152 value: 0
153153 value: 0
154154 value: 0
155- value: 2
156- value: 59689
155+ value: 3072
156+ value: 104
157157 value: 58
158158 label {
159159 key: 22
@@ -402,8 +402,8 @@ sample {
402402 value: 0
403403 value: 0
404404 value: 0
405- value: 1
406- value: 174080
405+ value: 1024
406+ value: 680
407407 value: 340
408408 label {
409409 key: 22
@@ -564,8 +564,8 @@ sample {
564564 value: 0
565565 value: 0
566566 value: 0
567- value: 1
568- value: 69632
567+ value: 2048
568+ value: 136
569569 value: 68
570570 label {
571571 key: 22
@@ -726,8 +726,8 @@ sample {
726726 value: 0
727727 value: 0
728728 value: 0
729- value: 1
730- value: 14868
729+ value: 1024
730+ value: 133
731731 value: 44
732732 label {
733733 key: 22
@@ -933,8 +933,8 @@ sample {
933933 value: 0
934934 value: 0
935935 value: 0
936- value: 1
937- value: 101376
936+ value: 1024
937+ value: 99
938938 value: 99
939939 label {
940940 key: 22
@@ -1094,8 +1094,8 @@ sample {
10941094 value: 0
10951095 value: 0
10961096 value: 0
1097- value: 1
1098- value: 24576
1097+ value: 2048
1098+ value: 12
10991099 value: 12
11001100 label {
11011101 key: 22
Original file line number Diff line number Diff line change @@ -687,7 +687,7 @@ def test_to_str_none():
687687
688688
689689@mock .patch ("ddtrace.utils.config.get_application_name" )
690- def test_ppprof_exporter (gan ):
690+ def test_pprof_exporter (gan ):
691691 gan .return_value = "bonjour"
692692 exp = pprof .PprofExporter ()
693693 exports = exp .export (TEST_EVENTS , 1 , 7 )
You can’t perform that action at this time.
0 commit comments