Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP][Profiling] Prevent panic from crossing FFI boundaries #815

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gleocadie
Copy link
Contributor

What does this PR do?

This PR is a communication channel to discuss about preventing panic from crossing FFI boundaries.
The code change here is to discuss, and find the best way to achieve this.

Motivation

Playing around with the new crashtracker api, we got a crash (#756) because there were missing information. The example was not modified nor ran which left with an unusable version of libdatadog (crashtracking)
This may be a misusage and the client's code must be changed, but in no case, this should panic. (at the minimum, there should be tests.

Additional Notes

Anything else we should know when reviewing?

How to test the change?

Describe here in detail how the change can be validated.

@github-actions github-actions bot added the profiling Relates to the profiling* modules. label Jan 6, 2025
@pr-commenter
Copy link

pr-commenter bot commented Jan 6, 2025

Benchmarks

Comparison

Benchmark execution time: 2025-01-06 14:04:28

Comparing candidate commit d8e4924 in PR branch gleocadie/avoid-leaking-panic-in-ffi with baseline commit 8331f61 in branch main.

Found 0 performance improvements and 3 performance regressions! Performance is the same for 48 metrics, 2 unstable metrics.

scenario:normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて

  • 🟥 execution_time [+20.740µs; +20.871µs] or [+4.359%; +4.386%]
  • 🟥 throughput [-88324.817op/s; -87771.509op/s] or [-4.203%; -4.176%]

scenario:tags/replace_trace_tags

  • 🟥 execution_time [+514.249ns; +521.951ns] or [+18.776%; +19.057%]

Candidate

Candidate benchmark details

Group 1

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz d8e4924 1736171623 gleocadie/avoid-leaking-panic-in-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... execution_time 544.108µs 545.626µs ± 1.018µs 545.287µs ± 0.349µs 545.850µs 547.883µs 549.070µs 549.445µs 0.76% 1.726 2.856 0.19% 0.072µs 1 200
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... throughput 1820017.968op/s 1832762.705op/s ± 3407.066op/s 1833897.171op/s ± 1174.121op/s 1834739.614op/s 1836260.491op/s 1837291.902op/s 1837870.423op/s 0.22% -1.715 2.817 0.19% 240.916op/s 1 200
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて execution_time 495.922µs 496.618µs ± 0.331µs 496.565µs ± 0.204µs 496.811µs 497.218µs 497.705µs 497.913µs 0.27% 0.811 1.340 0.07% 0.023µs 1 200
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて throughput 2008380.974op/s 2013621.327op/s ± 1342.056op/s 2013834.596op/s ± 825.525op/s 2014531.600op/s 2015466.229op/s 2016128.545op/s 2016446.586op/s 0.13% -0.806 1.324 0.07% 94.898op/s 1 200
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters execution_time 194.755µs 195.312µs ± 0.240µs 195.297µs ± 0.127µs 195.438µs 195.644µs 195.840µs 197.313µs 1.03% 2.862 22.862 0.12% 0.017µs 1 200
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters throughput 5068078.971op/s 5120025.213op/s ± 6264.366op/s 5120414.290op/s ± 3334.698op/s 5123519.286op/s 5128160.423op/s 5133096.646op/s 5134657.057op/s 0.28% -2.802 22.244 0.12% 442.958op/s 1 200
normalization/normalize_service/normalize_service/[empty string] execution_time 46.841µs 47.481µs ± 0.214µs 47.520µs ± 0.113µs 47.627µs 47.762µs 47.804µs 47.926µs 0.85% -0.946 0.545 0.45% 0.015µs 1 200
normalization/normalize_service/normalize_service/[empty string] throughput 20865529.170op/s 21061351.673op/s ± 95453.086op/s 21043772.659op/s ± 49896.416op/s 21097947.943op/s 21252449.882op/s 21330462.996op/s 21349008.523op/s 1.45% 0.968 0.589 0.45% 6749.552op/s 1 200
normalization/normalize_service/normalize_service/test_ASCII execution_time 49.881µs 50.180µs ± 0.168µs 50.172µs ± 0.064µs 50.237µs 50.297µs 50.582µs 51.776µs 3.20% 5.747 48.511 0.33% 0.012µs 1 200
normalization/normalize_service/normalize_service/test_ASCII throughput 19314029.302op/s 19928621.491op/s ± 65619.288op/s 19931433.530op/s ± 25399.377op/s 19954791.862op/s 19999528.292op/s 20026921.242op/s 20047609.535op/s 0.58% -5.573 46.480 0.33% 4639.984op/s 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... execution_time [545.485µs; 545.767µs] or [-0.026%; +0.026%] None None None
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... throughput [1832290.519op/s; 1833234.892op/s] or [-0.026%; +0.026%] None None None
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて execution_time [496.572µs; 496.664µs] or [-0.009%; +0.009%] None None None
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて throughput [2013435.331op/s; 2013807.323op/s] or [-0.009%; +0.009%] None None None
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters execution_time [195.279µs; 195.345µs] or [-0.017%; +0.017%] None None None
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters throughput [5119157.032op/s; 5120893.394op/s] or [-0.017%; +0.017%] None None None
normalization/normalize_service/normalize_service/[empty string] execution_time [47.452µs; 47.511µs] or [-0.063%; +0.063%] None None None
normalization/normalize_service/normalize_service/[empty string] throughput [21048122.794op/s; 21074580.553op/s] or [-0.063%; +0.063%] None None None
normalization/normalize_service/normalize_service/test_ASCII execution_time [50.156µs; 50.203µs] or [-0.046%; +0.046%] None None None
normalization/normalize_service/normalize_service/test_ASCII throughput [19919527.289op/s; 19937715.693op/s] or [-0.046%; +0.046%] None None None

Group 2

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz d8e4924 1736171623 gleocadie/avoid-leaking-panic-in-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
benching string interning on wordpress profile execution_time 137.643µs 138.502µs ± 0.227µs 138.481µs ± 0.116µs 138.617µs 138.883µs 139.075µs 139.225µs 0.54% -0.133 1.781 0.16% 0.016µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
benching string interning on wordpress profile execution_time [138.470µs; 138.533µs] or [-0.023%; +0.023%] None None None

Group 3

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz d8e4924 1736171623 gleocadie/avoid-leaking-panic-in-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
credit_card/is_card_number/ execution_time 4.274µs 4.292µs ± 0.005µs 4.292µs ± 0.001µs 4.293µs 4.296µs 4.300µs 4.347µs 1.28% 7.140 83.286 0.11% 0.000µs 1 200
credit_card/is_card_number/ throughput 230052244.855op/s 232985211.832op/s ± 258815.076op/s 232991146.540op/s ± 75896.561op/s 233068628.966op/s 233243276.705op/s 233334085.923op/s 233995336.355op/s 0.43% -7.025 81.772 0.11% 18300.990op/s 1 200
credit_card/is_card_number/ 3782-8224-6310-005 execution_time 92.561µs 93.587µs ± 0.465µs 93.563µs ± 0.205µs 93.769µs 94.104µs 94.513µs 98.164µs 4.92% 4.721 45.511 0.50% 0.033µs 1 200
credit_card/is_card_number/ 3782-8224-6310-005 throughput 10187031.034op/s 10685542.096op/s ± 51891.409op/s 10687994.711op/s ± 23441.340op/s 10710920.060op/s 10751357.388op/s 10785157.447op/s 10803693.854op/s 1.08% -4.358 41.073 0.48% 3669.277op/s 1 200
credit_card/is_card_number/ 378282246310005 execution_time 87.385µs 87.973µs ± 0.407µs 87.945µs ± 0.127µs 88.062µs 88.304µs 88.405µs 92.984µs 5.73% 9.355 112.946 0.46% 0.029µs 1 200
credit_card/is_card_number/ 378282246310005 throughput 10754484.644op/s 11367371.030op/s ± 50488.890op/s 11370697.714op/s ± 16386.783op/s 11387956.951op/s 11411337.108op/s 11421087.342op/s 11443616.199op/s 0.64% -8.977 106.849 0.44% 3570.104op/s 1 200
credit_card/is_card_number/37828224631 execution_time 4.276µs 4.291µs ± 0.005µs 4.291µs ± 0.002µs 4.292µs 4.295µs 4.297µs 4.348µs 1.35% 7.597 87.088 0.12% 0.000µs 1 200
credit_card/is_card_number/37828224631 throughput 229965115.545op/s 233046091.766op/s ± 268283.636op/s 233063117.763op/s ± 87477.215op/s 233150412.959op/s 233314846.860op/s 233408213.690op/s 233844912.970op/s 0.34% -7.488 85.516 0.11% 18970.518op/s 1 200
credit_card/is_card_number/378282246310005 execution_time 84.970µs 85.492µs ± 0.215µs 85.483µs ± 0.148µs 85.630µs 85.874µs 86.004µs 86.063µs 0.68% 0.284 -0.372 0.25% 0.015µs 1 200
credit_card/is_card_number/378282246310005 throughput 11619454.591op/s 11697034.510op/s ± 29409.173op/s 11698235.301op/s ± 20237.677op/s 11718891.210op/s 11743433.351op/s 11750713.390op/s 11768921.808op/s 0.60% -0.272 -0.382 0.25% 2079.543op/s 1 200
credit_card/is_card_number/37828224631000521389798 execution_time 58.956µs 59.065µs ± 0.034µs 59.067µs ± 0.017µs 59.084µs 59.116µs 59.135µs 59.171µs 0.18% -0.497 1.431 0.06% 0.002µs 1 200
credit_card/is_card_number/37828224631000521389798 throughput 16900254.697op/s 16930421.425op/s ± 9640.453op/s 16929932.933op/s ± 4943.998op/s 16934996.287op/s 16949949.602op/s 16957171.318op/s 16961798.637op/s 0.19% 0.503 1.436 0.06% 681.683op/s 1 200
credit_card/is_card_number/x371413321323331 execution_time 6.830µs 6.842µs ± 0.004µs 6.843µs ± 0.003µs 6.845µs 6.849µs 6.854µs 6.857µs 0.22% -0.096 0.652 0.06% 0.000µs 1 200
credit_card/is_card_number/x371413321323331 throughput 145826901.872op/s 146147878.801op/s ± 95075.134op/s 146142901.999op/s ± 56345.515op/s 146198432.022op/s 146326779.015op/s 146376615.976op/s 146403574.170op/s 0.18% 0.101 0.649 0.06% 6722.827op/s 1 200
credit_card/is_card_number_no_luhn/ execution_time 4.271µs 4.292µs ± 0.004µs 4.292µs ± 0.001µs 4.293µs 4.295µs 4.299µs 4.338µs 1.08% 5.644 66.882 0.10% 0.000µs 1 200
credit_card/is_card_number_no_luhn/ throughput 230515301.084op/s 233007718.972op/s ± 233500.706op/s 233003245.412op/s ± 65360.247op/s 233074227.835op/s 233237962.639op/s 233404523.518op/s 234119355.675op/s 0.48% -5.532 65.656 0.10% 16510.993op/s 1 200
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 execution_time 70.055µs 71.500µs ± 0.426µs 71.529µs ± 0.282µs 71.783µs 72.255µs 72.505µs 72.595µs 1.49% -0.223 0.420 0.59% 0.030µs 1 200
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 throughput 13775129.280op/s 13986508.083op/s ± 83410.795op/s 13980414.146op/s ± 55047.029op/s 14040372.067op/s 14134477.968op/s 14199050.677op/s 14274501.519op/s 2.10% 0.265 0.454 0.59% 5898.034op/s 1 200
credit_card/is_card_number_no_luhn/ 378282246310005 execution_time 64.715µs 65.596µs ± 0.495µs 65.569µs ± 0.381µs 65.960µs 66.353µs 66.877µs 67.095µs 2.33% 0.306 -0.332 0.75% 0.035µs 1 200
credit_card/is_card_number_no_luhn/ 378282246310005 throughput 14904228.565op/s 15245719.411op/s ± 114889.854op/s 15251023.095op/s ± 88529.839op/s 15337771.153op/s 15419174.010op/s 15447716.432op/s 15452399.493op/s 1.32% -0.270 -0.388 0.75% 8123.940op/s 1 200
credit_card/is_card_number_no_luhn/37828224631 execution_time 4.277µs 4.292µs ± 0.003µs 4.292µs ± 0.001µs 4.293µs 4.295µs 4.299µs 4.305µs 0.30% -0.033 7.988 0.06% 0.000µs 1 200
credit_card/is_card_number_no_luhn/37828224631 throughput 232313606.219op/s 233010357.346op/s ± 140774.832op/s 233012652.590op/s ± 68296.424op/s 233076355.815op/s 233227544.968op/s 233331261.811op/s 233791923.382op/s 0.33% 0.051 8.001 0.06% 9954.284op/s 1 200
credit_card/is_card_number_no_luhn/378282246310005 execution_time 62.726µs 63.523µs ± 0.274µs 63.504µs ± 0.191µs 63.711µs 63.960µs 64.184µs 64.312µs 1.27% 0.062 -0.196 0.43% 0.019µs 1 200
credit_card/is_card_number_no_luhn/378282246310005 throughput 15549238.978op/s 15742701.875op/s ± 68002.172op/s 15747160.426op/s ± 47196.670op/s 15787471.458op/s 15853093.677op/s 15868588.011op/s 15942350.845op/s 1.24% -0.039 -0.203 0.43% 4808.480op/s 1 200
credit_card/is_card_number_no_luhn/37828224631000521389798 execution_time 58.959µs 59.069µs ± 0.032µs 59.070µs ± 0.018µs 59.094µs 59.113µs 59.130µs 59.156µs 0.14% -0.753 1.266 0.05% 0.002µs 1 200
credit_card/is_card_number_no_luhn/37828224631000521389798 throughput 16904580.405op/s 16929217.545op/s ± 9200.583op/s 16929048.664op/s ± 5265.710op/s 16933830.633op/s 16947428.317op/s 16955091.905op/s 16960884.807op/s 0.19% 0.757 1.275 0.05% 650.579op/s 1 200
credit_card/is_card_number_no_luhn/x371413321323331 execution_time 6.830µs 6.843µs ± 0.005µs 6.842µs ± 0.002µs 6.845µs 6.849µs 6.855µs 6.866µs 0.35% 0.627 3.417 0.07% 0.000µs 1 200
credit_card/is_card_number_no_luhn/x371413321323331 throughput 145641189.321op/s 146139905.146op/s ± 96250.311op/s 146147803.325op/s ± 51864.145op/s 146194503.087op/s 146304670.019op/s 146377411.180op/s 146402225.394op/s 0.17% -0.617 3.379 0.07% 6805.925op/s 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
credit_card/is_card_number/ execution_time [4.291µs; 4.293µs] or [-0.016%; +0.016%] None None None
credit_card/is_card_number/ throughput [232949342.551op/s; 233021081.112op/s] or [-0.015%; +0.015%] None None None
credit_card/is_card_number/ 3782-8224-6310-005 execution_time [93.522µs; 93.651µs] or [-0.069%; +0.069%] None None None
credit_card/is_card_number/ 3782-8224-6310-005 throughput [10678350.446op/s; 10692733.746op/s] or [-0.067%; +0.067%] None None None
credit_card/is_card_number/ 378282246310005 execution_time [87.916µs; 88.029µs] or [-0.064%; +0.064%] None None None
credit_card/is_card_number/ 378282246310005 throughput [11360373.755op/s; 11374368.304op/s] or [-0.062%; +0.062%] None None None
credit_card/is_card_number/37828224631 execution_time [4.290µs; 4.292µs] or [-0.016%; +0.016%] None None None
credit_card/is_card_number/37828224631 throughput [233008910.234op/s; 233083273.297op/s] or [-0.016%; +0.016%] None None None
credit_card/is_card_number/378282246310005 execution_time [85.462µs; 85.522µs] or [-0.035%; +0.035%] None None None
credit_card/is_card_number/378282246310005 throughput [11692958.681op/s; 11701110.338op/s] or [-0.035%; +0.035%] None None None
credit_card/is_card_number/37828224631000521389798 execution_time [59.061µs; 59.070µs] or [-0.008%; +0.008%] None None None
credit_card/is_card_number/37828224631000521389798 throughput [16929085.351op/s; 16931757.500op/s] or [-0.008%; +0.008%] None None None
credit_card/is_card_number/x371413321323331 execution_time [6.842µs; 6.843µs] or [-0.009%; +0.009%] None None None
credit_card/is_card_number/x371413321323331 throughput [146134702.302op/s; 146161055.300op/s] or [-0.009%; +0.009%] None None None
credit_card/is_card_number_no_luhn/ execution_time [4.291µs; 4.292µs] or [-0.014%; +0.014%] None None None
credit_card/is_card_number_no_luhn/ throughput [232975358.020op/s; 233040079.925op/s] or [-0.014%; +0.014%] None None None
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 execution_time [71.441µs; 71.559µs] or [-0.083%; +0.083%] None None None
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 throughput [13974948.150op/s; 13998068.017op/s] or [-0.083%; +0.083%] None None None
credit_card/is_card_number_no_luhn/ 378282246310005 execution_time [65.527µs; 65.665µs] or [-0.105%; +0.105%] None None None
credit_card/is_card_number_no_luhn/ 378282246310005 throughput [15229796.783op/s; 15261642.040op/s] or [-0.104%; +0.104%] None None None
credit_card/is_card_number_no_luhn/37828224631 execution_time [4.291µs; 4.292µs] or [-0.008%; +0.008%] None None None
credit_card/is_card_number_no_luhn/37828224631 throughput [232990847.309op/s; 233029867.384op/s] or [-0.008%; +0.008%] None None None
credit_card/is_card_number_no_luhn/378282246310005 execution_time [63.485µs; 63.561µs] or [-0.060%; +0.060%] None None None
credit_card/is_card_number_no_luhn/378282246310005 throughput [15733277.428op/s; 15752126.322op/s] or [-0.060%; +0.060%] None None None
credit_card/is_card_number_no_luhn/37828224631000521389798 execution_time [59.065µs; 59.074µs] or [-0.008%; +0.008%] None None None
credit_card/is_card_number_no_luhn/37828224631000521389798 throughput [16927942.432op/s; 16930492.657op/s] or [-0.008%; +0.008%] None None None
credit_card/is_card_number_no_luhn/x371413321323331 execution_time [6.842µs; 6.843µs] or [-0.009%; +0.009%] None None None
credit_card/is_card_number_no_luhn/x371413321323331 throughput [146126565.779op/s; 146153244.514op/s] or [-0.009%; +0.009%] None None None

Group 4

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz d8e4924 1736171623 gleocadie/avoid-leaking-panic-in-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... execution_time 301.084µs 305.603µs ± 1.316µs 305.680µs ± 0.878µs 306.554µs 307.451µs 308.125µs 309.212µs 1.16% -0.445 0.675 0.43% 0.093µs 1 200
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... throughput 3234022.879op/s 3272284.853op/s ± 14119.162op/s 3271392.346op/s ± 9364.129op/s 3280789.089op/s 3296066.990op/s 3315346.545op/s 3321329.801op/s 1.53% 0.477 0.732 0.43% 998.376op/s 1 200
normalization/normalize_name/normalize_name/bad-name execution_time 27.238µs 27.517µs ± 0.170µs 27.456µs ± 0.117µs 27.695µs 27.755µs 27.778µs 28.260µs 2.93% 0.584 0.115 0.62% 0.012µs 1 200
normalization/normalize_name/normalize_name/bad-name throughput 35385167.549op/s 36343049.027op/s ± 223557.591op/s 36421608.215op/s ± 156518.501op/s 36529362.671op/s 36635299.004op/s 36702810.246op/s 36713992.752op/s 0.80% -0.553 -0.026 0.61% 15807.909op/s 1 200
normalization/normalize_name/normalize_name/good execution_time 15.882µs 16.234µs ± 0.127µs 16.280µs ± 0.027µs 16.302µs 16.341µs 16.371µs 16.486µs 1.27% -1.649 1.509 0.78% 0.009µs 1 200
normalization/normalize_name/normalize_name/good throughput 60657839.409op/s 61602926.080op/s ± 488743.563op/s 61426260.523op/s ± 101659.535op/s 61558341.609op/s 62776978.507op/s 62907231.373op/s 62964126.989op/s 2.50% 1.667 1.543 0.79% 34559.389op/s 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... execution_time [305.420µs; 305.785µs] or [-0.060%; +0.060%] None None None
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... throughput [3270328.073op/s; 3274241.633op/s] or [-0.060%; +0.060%] None None None
normalization/normalize_name/normalize_name/bad-name execution_time [27.493µs; 27.540µs] or [-0.086%; +0.086%] None None None
normalization/normalize_name/normalize_name/bad-name throughput [36312066.095op/s; 36374031.959op/s] or [-0.085%; +0.085%] None None None
normalization/normalize_name/normalize_name/good execution_time [16.216µs; 16.252µs] or [-0.109%; +0.109%] None None None
normalization/normalize_name/normalize_name/good throughput [61535190.922op/s; 61670661.237op/s] or [-0.110%; +0.110%] None None None

Group 5

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz d8e4924 1736171623 gleocadie/avoid-leaking-panic-in-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
normalization/normalize_trace/test_trace execution_time 295.915ns 306.303ns ± 13.037ns 301.365ns ± 3.311ns 308.057ns 339.807ns 347.716ns 350.693ns 16.37% 2.015 3.002 4.25% 0.922ns 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
normalization/normalize_trace/test_trace execution_time [304.496ns; 308.110ns] or [-0.590%; +0.590%] None None None

Group 6

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz d8e4924 1736171623 gleocadie/avoid-leaking-panic-in-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
benching deserializing traces from msgpack to their internal representation execution_time 57.548ms 57.693ms ± 0.120ms 57.667ms ± 0.033ms 57.703ms 57.853ms 58.302ms 58.440ms 1.34% 3.772 17.575 0.21% 0.008ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
benching deserializing traces from msgpack to their internal representation execution_time [57.677ms; 57.710ms] or [-0.029%; +0.029%] None None None

Group 7

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz d8e4924 1736171623 gleocadie/avoid-leaking-panic-in-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
tags/replace_trace_tags execution_time 3.210µs 3.257µs ± 0.020µs 3.257µs ± 0.009µs 3.265µs 3.302µs 3.308µs 3.310µs 1.64% 0.337 0.892 0.63% 0.001µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
tags/replace_trace_tags execution_time [3.254µs; 3.260µs] or [-0.087%; +0.087%] None None None

Group 8

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz d8e4924 1736171623 gleocadie/avoid-leaking-panic-in-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
write only interface execution_time 1.408µs 3.351µs ± 1.491µs 3.144µs ± 0.025µs 3.172µs 3.811µs 14.513µs 15.590µs 395.86% 7.442 56.129 44.39% 0.105µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
write only interface execution_time [3.144µs; 3.558µs] or [-6.167%; +6.167%] None None None

Group 9

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz d8e4924 1736171623 gleocadie/avoid-leaking-panic-in-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
two way interface execution_time 18.999µs 28.887µs ± 14.501µs 19.272µs ± 0.237µs 38.702µs 48.274µs 50.882µs 150.540µs 681.15% 3.616 24.923 50.07% 1.025µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
two way interface execution_time [26.877µs; 30.896µs] or [-6.957%; +6.957%] None None None

Group 10

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz d8e4924 1736171623 gleocadie/avoid-leaking-panic-in-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
concentrator/add_spans_to_concentrator execution_time 6.323ms 6.338ms ± 0.007ms 6.338ms ± 0.004ms 6.341ms 6.347ms 6.354ms 6.396ms 0.91% 3.243 22.230 0.11% 0.001ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
concentrator/add_spans_to_concentrator execution_time [6.337ms; 6.339ms] or [-0.016%; +0.016%] None None None

Group 11

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz d8e4924 1736171623 gleocadie/avoid-leaking-panic-in-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
sql/obfuscate_sql_string execution_time 76.369µs 76.611µs ± 0.134µs 76.597µs ± 0.041µs 76.639µs 76.736µs 76.863µs 77.873µs 1.67% 6.258 52.217 0.17% 0.009µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
sql/obfuscate_sql_string execution_time [76.593µs; 76.630µs] or [-0.024%; +0.024%] None None None

Group 12

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz d8e4924 1736171623 gleocadie/avoid-leaking-panic-in-ffi
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
redis/obfuscate_redis_string execution_time 36.258µs 36.749µs ± 0.763µs 36.404µs ± 0.082µs 36.524µs 38.359µs 38.432µs 39.577µs 8.72% 1.695 1.206 2.07% 0.054µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
redis/obfuscate_redis_string execution_time [36.643µs; 36.854µs] or [-0.288%; +0.288%] None None None

Baseline

Omitted due to size.

@gleocadie gleocadie force-pushed the gleocadie/avoid-leaking-panic-in-ffi branch from 579730c to 6730452 Compare January 6, 2025 13:39
@codecov-commenter
Copy link

codecov-commenter commented Jan 6, 2025

Codecov Report

Attention: Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 71.03%. Comparing base (8331f61) to head (d8e4924).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #815      +/-   ##
==========================================
- Coverage   71.03%   71.03%   -0.01%     
==========================================
  Files         313      313              
  Lines       45908    45912       +4     
==========================================
+ Hits        32612    32614       +2     
- Misses      13296    13298       +2     
Components Coverage Δ
crashtracker 38.25% <ø> (-0.03%) ⬇️
crashtracker-ffi 5.71% <ø> (ø)
datadog-alloc 98.73% <ø> (ø)
data-pipeline 91.87% <ø> (ø)
data-pipeline-ffi 90.54% <ø> (ø)
ddcommon 82.08% <ø> (ø)
ddcommon-ffi 65.84% <ø> (ø)
ddtelemetry 59.51% <ø> (ø)
ddtelemetry-ffi 22.46% <ø> (ø)
dogstatsd 89.59% <ø> (ø)
dogstatsd-client 79.77% <ø> (ø)
ipc 82.69% <ø> (ø)
profiling 84.29% <75.00%> (-0.01%) ⬇️
profiling-ffi 77.54% <75.00%> (-0.01%) ⬇️
serverless 0.00% <ø> (ø)
sidecar 40.91% <ø> (ø)
sidecar-ffi 3.98% <ø> (ø)
spawn-worker 54.37% <ø> (ø)
tinybytes 93.60% <ø> (ø)
trace-mini-agent 72.48% <ø> (ø)
trace-normalization 98.23% <ø> (ø)
trace-obfuscation 95.77% <ø> (ø)
trace-protobuf 77.67% <ø> (ø)
trace-utils 93.79% <ø> (ø)

@gleocadie gleocadie force-pushed the gleocadie/avoid-leaking-panic-in-ffi branch from 6730452 to d8e4924 Compare January 6, 2025 13:53
@ivoanjo
Copy link
Member

ivoanjo commented Jan 6, 2025

This is a complex subject, but I think we've been avoiding addressing it for a bit too long.

The ideal mode of operation would be to have no aborts, but in the real world sometimes one slips by...

I think having a "last line of defense" on FFI functions that returns a clean error makes sense. Of course in some cases returning an error means the rust state can be in an inconsistent state, but it seems reasonable to put the burden on the API client to properly handle errors by backing off and stopping e.g. profiling, rather than tearing the whole app down. E.g. an abort is an extreme event, so I think stopping datadog stuff and logging an error (possibly via crashtracking...) is a reasonable outcome to such an extreme event (and is a much better alternative than killing off the host app).

We could look into enabling lints to make it easier for us to catch things that may cause abort, but I suspect that will hinder and make really awkward a lot of the code we want to write. The Linux kernel folks have faced similar challenges, so perhaps there's some learnings there (I found this link on a quick googling).

TL;DR: If we could write a nice macro to add this feature to most of our FFI, I think it's a reasonable and worth improvement.

@gleocadie
Copy link
Contributor Author

This is a complex subject, but I think we've been avoiding addressing it for a bit too long.

The ideal mode of operation would be to have no aborts, but in the real world sometimes one slips by...

I think having a "last line of defense" on FFI functions that returns a clean error makes sense. Of course in some cases returning an error means the rust state can be in an inconsistent state, but it seems reasonable to put the burden on the API client to properly handle errors by backing off and stopping e.g. profiling, rather than tearing the whole app down. E.g. an abort is an extreme event, so I think stopping datadog stuff and logging an error (possibly via crashtracking...) is a reasonable outcome to such an extreme event (and is a much better alternative than killing off the host app).

We could look into enabling lints to make it easier for us to catch things that may cause abort, but I suspect that will hinder and make really awkward a lot of the code we want to write. The Linux kernel folks have faced similar challenges, so perhaps there's some learnings there (I found this link on a quick googling).

TL;DR: If we could write a nice macro to add this feature to most of our FFI, I think it's a reasonable and worth improvement.

That's why this draft is here :) to talk about that subject.
Thanks for your comment :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
profiling Relates to the profiling* modules.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants