Skip to content

Conversation

@sameerank
Copy link

@sameerank sameerank commented Oct 24, 2025

What does this PR do?

Adds a datadog-ffe-ffi crate, which provides a C FFI (Foreign Function Interface) bindings for the datadog-ffe (Feature Flag Evaluation) library. This is to allow dd-trace-rb to interact with the feature flag evaluation engine through a C-compatible API.

The crate exposes the following key components:

  • Configuration: FFI bindings for feature flag configuration management
  • Evaluation Context: FFI bindings for creating and managing evaluation contexts used for flag evaluation
  • Assignment: FFI bindings for handling feature flag assignment results
  • Error handling: FFI-compatible error types and handling

Motivation

The motivation for FFL-1284 is to enable non-Rust languages (PHP, Ruby, Python, etc.) to use the feature flag evaluator in libdatadog, for consistent feature flag evaluation in SDKs across languages.

Additional Notes

  • The crate follows similar patterns to other *-ffi crates in this repository (e.g., datadog-profiling-ffi, datadog-crashtracker-ffi)
  • Uses cbindgen for automatic C generation
  • Configured to build as both static and dynamic libraries (staticlib, cdylib)

How to test the change?

  1. Build verification: cargo build -p datadog-ffe-ffi
  2. Verify C headers are generated: cargo build -p datadog-ffe-ffi --features cbindgen (Check that headers are generated in target/include/)
  3. Integration testing: Verify binding works locally in [FFL-1273] bindings for libdatadog datadog ffe api dd-trace-rb#5001 [FFL-1273] bindings for ffe in openfeature provider dd-trace-rb#5007

@pr-commenter
Copy link

pr-commenter bot commented Oct 24, 2025

Benchmarks

Comparison

Benchmark execution time: 2025-10-29 22:47:58

Comparing candidate commit 2d4e32d in PR branch sameerank/FFL-1284-Create-datadog-ffe-ffi-crate with baseline commit 3ad7d4a in branch main.

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

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 2d4e32d 1761777238 sameerank/FFL-1284-Create-datadog-ffe-ffi-crate
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
ip_address/quantize_peer_ip_address_benchmark execution_time 4.998µs 5.069µs ± 0.038µs 5.085µs ± 0.028µs 5.094µs 5.118µs 5.122µs 5.125µs 0.78% -0.381 -1.201 0.75% 0.003µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
ip_address/quantize_peer_ip_address_benchmark execution_time [5.064µs; 5.075µs] or [-0.104%; +0.104%] None None None

Group 2

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 2d4e32d 1761777238 sameerank/FFL-1284-Create-datadog-ffe-ffi-crate
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.233µs 3.245µs ± 1.429µs 3.021µs ± 0.028µs 3.052µs 3.658µs 14.176µs 14.789µs 389.47% 7.315 54.776 43.93% 0.101µ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.047µs; 3.443µs] or [-6.103%; +6.103%] None None None

Group 3

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 2d4e32d 1761777238 sameerank/FFL-1284-Create-datadog-ffe-ffi-crate
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
benching serializing traces from their internal representation to msgpack execution_time 14.183ms 14.243ms ± 0.030ms 14.239ms ± 0.013ms 14.253ms 14.282ms 14.365ms 14.436ms 1.38% 2.624 11.630 0.21% 0.002ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
benching serializing traces from their internal representation to msgpack execution_time [14.239ms; 14.247ms] or [-0.029%; +0.029%] None None None

Group 4

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 2d4e32d 1761777238 sameerank/FFL-1284-Create-datadog-ffe-ffi-crate
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 185.605µs 186.062µs ± 0.381µs 186.008µs ± 0.123µs 186.112µs 186.458µs 187.862µs 189.385µs 1.82% 4.950 34.003 0.20% 0.027µs 1 200
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... throughput 5280242.258op/s 5374580.473op/s ± 10896.009op/s 5376111.049op/s ± 3568.944op/s 5379688.133op/s 5383476.034op/s 5385793.022op/s 5387790.969op/s 0.22% -4.881 33.174 0.20% 770.464op/s 1 200
normalization/normalize_name/normalize_name/bad-name execution_time 17.801µs 17.855µs ± 0.034µs 17.852µs ± 0.016µs 17.871µs 17.909µs 17.929µs 18.115µs 1.47% 2.482 16.091 0.19% 0.002µs 1 200
normalization/normalize_name/normalize_name/bad-name throughput 55203997.326op/s 56005819.468op/s ± 105803.930op/s 56017411.562op/s ± 49618.221op/s 56063061.050op/s 56157586.121op/s 56174496.757op/s 56177467.926op/s 0.29% -2.415 15.460 0.19% 7481.468op/s 1 200
normalization/normalize_name/normalize_name/good execution_time 10.541µs 10.590µs ± 0.022µs 10.587µs ± 0.015µs 10.608µs 10.625µs 10.639µs 10.644µs 0.54% -0.006 -0.501 0.21% 0.002µs 1 200
normalization/normalize_name/normalize_name/good throughput 93946543.699op/s 94431085.906op/s ± 200434.305op/s 94453761.641op/s ± 136825.046op/s 94555429.788op/s 94794700.032op/s 94840165.796op/s 94868071.825op/s 0.44% 0.016 -0.500 0.21% 14172.846op/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 [186.009µs; 186.115µs] or [-0.028%; +0.028%] None None None
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... throughput [5373070.391op/s; 5376090.555op/s] or [-0.028%; +0.028%] None None None
normalization/normalize_name/normalize_name/bad-name execution_time [17.851µs; 17.860µs] or [-0.026%; +0.026%] None None None
normalization/normalize_name/normalize_name/bad-name throughput [55991156.061op/s; 56020482.876op/s] or [-0.026%; +0.026%] None None None
normalization/normalize_name/normalize_name/good execution_time [10.587µs; 10.593µs] or [-0.029%; +0.029%] None None None
normalization/normalize_name/normalize_name/good throughput [94403307.639op/s; 94458864.173op/s] or [-0.029%; +0.029%] None None None

Group 5

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 2d4e32d 1761777238 sameerank/FFL-1284-Create-datadog-ffe-ffi-crate
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 496.101µs 496.975µs ± 0.777µs 496.870µs ± 0.222µs 497.113µs 497.633µs 500.441µs 505.299µs 1.70% 7.243 68.731 0.16% 0.055µs 1 200
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... throughput 1979027.150op/s 2012180.373op/s ± 3110.674op/s 2012599.319op/s ± 899.235op/s 2013443.201op/s 2014363.362op/s 2015194.621op/s 2015720.605op/s 0.16% -7.158 67.422 0.15% 219.958op/s 1 200
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて execution_time 372.811µs 373.588µs ± 0.336µs 373.566µs ± 0.230µs 373.830µs 374.147µs 374.339µs 374.907µs 0.36% 0.478 0.567 0.09% 0.024µs 1 200
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて throughput 2667324.761op/s 2676748.817op/s ± 2405.982op/s 2676906.416op/s ± 1651.495op/s 2678492.093op/s 2680203.793op/s 2681273.459op/s 2682327.103op/s 0.20% -0.472 0.553 0.09% 170.129op/s 1 200
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters execution_time 168.419µs 168.755µs ± 0.129µs 168.751µs ± 0.090µs 168.843µs 168.950µs 169.092µs 169.177µs 0.25% 0.166 0.150 0.08% 0.009µs 1 200
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters throughput 5910957.609op/s 5925760.166op/s ± 4534.078op/s 5925879.785op/s ± 3177.255op/s 5929040.894op/s 5933420.127op/s 5935064.541op/s 5937588.762op/s 0.20% -0.161 0.147 0.08% 320.608op/s 1 200
normalization/normalize_service/normalize_service/[empty string] execution_time 36.212µs 36.488µs ± 0.202µs 36.414µs ± 0.117µs 36.668µs 36.832µs 37.070µs 37.111µs 1.91% 0.780 -0.327 0.55% 0.014µs 1 200
normalization/normalize_service/normalize_service/[empty string] throughput 26946090.225op/s 27407175.371op/s ± 150760.297op/s 27461659.227op/s ± 88443.093op/s 27526995.547op/s 27578344.441op/s 27608149.259op/s 27614818.762op/s 0.56% -0.763 -0.374 0.55% 10660.363op/s 1 200
normalization/normalize_service/normalize_service/test_ASCII execution_time 46.150µs 46.344µs ± 0.076µs 46.337µs ± 0.049µs 46.393µs 46.459µs 46.536µs 46.589µs 0.54% 0.388 0.131 0.16% 0.005µs 1 200
normalization/normalize_service/normalize_service/test_ASCII throughput 21464495.099op/s 21577685.510op/s ± 35250.410op/s 21581251.403op/s ± 23044.542op/s 21601678.268op/s 21629337.039op/s 21648246.401op/s 21668302.547op/s 0.40% -0.379 0.119 0.16% 2492.580op/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 [496.867µs; 497.082µs] or [-0.022%; +0.022%] None None None
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... throughput [2011749.263op/s; 2012611.482op/s] or [-0.021%; +0.021%] None None None
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて execution_time [373.541µs; 373.634µs] or [-0.012%; +0.012%] None None None
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて throughput [2676415.371op/s; 2677082.263op/s] or [-0.012%; +0.012%] None None None
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters execution_time [168.737µs; 168.773µs] or [-0.011%; +0.011%] None None None
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters throughput [5925131.786op/s; 5926388.546op/s] or [-0.011%; +0.011%] None None None
normalization/normalize_service/normalize_service/[empty string] execution_time [36.460µs; 36.516µs] or [-0.077%; +0.077%] None None None
normalization/normalize_service/normalize_service/[empty string] throughput [27386281.444op/s; 27428069.298op/s] or [-0.076%; +0.076%] None None None
normalization/normalize_service/normalize_service/test_ASCII execution_time [46.334µs; 46.355µs] or [-0.023%; +0.023%] None None None
normalization/normalize_service/normalize_service/test_ASCII throughput [21572800.142op/s; 21582570.878op/s] or [-0.023%; +0.023%] None None None

Group 6

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 2d4e32d 1761777238 sameerank/FFL-1284-Create-datadog-ffe-ffi-crate
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 59.247ms 59.730ms ± 2.465ms 59.398ms ± 0.058ms 59.467ms 59.732ms 78.397ms 81.156ms 36.63% 7.980 62.139 4.12% 0.174ms 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 [59.388ms; 60.072ms] or [-0.572%; +0.572%] None None None

Group 7

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 2d4e32d 1761777238 sameerank/FFL-1284-Create-datadog-ffe-ffi-crate
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 10.680ms 10.715ms ± 0.015ms 10.713ms ± 0.009ms 10.722ms 10.742ms 10.757ms 10.779ms 0.61% 0.714 1.082 0.14% 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 [10.713ms; 10.717ms] or [-0.020%; +0.020%] None None None

Group 8

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 2d4e32d 1761777238 sameerank/FFL-1284-Create-datadog-ffe-ffi-crate
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 3.895µs 3.915µs ± 0.003µs 3.916µs ± 0.002µs 3.917µs 3.920µs 3.921µs 3.923µs 0.19% -1.572 11.011 0.08% 0.000µs 1 200
credit_card/is_card_number/ throughput 254907264.139op/s 255398222.555op/s ± 193398.537op/s 255392735.052op/s ± 111026.440op/s 255508763.954op/s 255685581.709op/s 255751250.796op/s 256763868.791op/s 0.54% 1.596 11.201 0.08% 13675.342op/s 1 200
credit_card/is_card_number/ 3782-8224-6310-005 execution_time 77.950µs 79.649µs ± 0.595µs 79.668µs ± 0.391µs 79.993µs 80.675µs 80.988µs 81.052µs 1.74% 0.018 0.105 0.74% 0.042µs 1 200
credit_card/is_card_number/ 3782-8224-6310-005 throughput 12337690.691op/s 12555825.090op/s ± 93748.172op/s 12552081.348op/s ± 61973.616op/s 12622536.603op/s 12698054.280op/s 12783356.991op/s 12828677.225op/s 2.20% 0.029 0.131 0.74% 6628.997op/s 1 200
credit_card/is_card_number/ 378282246310005 execution_time 71.437µs 71.756µs ± 0.359µs 71.586µs ± 0.097µs 71.856µs 72.522µs 72.787µs 73.814µs 3.11% 2.190 6.358 0.50% 0.025µs 1 200
credit_card/is_card_number/ 378282246310005 throughput 13547490.777op/s 13936538.573op/s ± 68972.067op/s 13969285.732op/s ± 18959.519op/s 13981434.054op/s 13991853.384op/s 13993969.677op/s 13998324.401op/s 0.21% -2.138 5.969 0.49% 4877.062op/s 1 200
credit_card/is_card_number/37828224631 execution_time 3.902µs 3.916µs ± 0.003µs 3.916µs ± 0.002µs 3.917µs 3.920µs 3.922µs 3.924µs 0.20% -0.405 2.199 0.07% 0.000µs 1 200
credit_card/is_card_number/37828224631 throughput 254865410.614op/s 255377178.550op/s ± 178761.157op/s 255375912.845op/s ± 111445.368op/s 255491671.017op/s 255632322.967op/s 255714753.087op/s 256266056.122op/s 0.35% 0.413 2.229 0.07% 12640.323op/s 1 200
credit_card/is_card_number/378282246310005 execution_time 68.220µs 68.635µs ± 0.400µs 68.512µs ± 0.179µs 68.748µs 69.377µs 70.108µs 70.427µs 2.80% 1.996 4.615 0.58% 0.028µs 1 200
credit_card/is_card_number/378282246310005 throughput 14199068.016op/s 14570403.549op/s ± 84028.101op/s 14595985.380op/s ± 38240.216op/s 14630160.808op/s 14647561.217op/s 14651757.024op/s 14658440.270op/s 0.43% -1.951 4.372 0.58% 5941.684op/s 1 200
credit_card/is_card_number/37828224631000521389798 execution_time 45.413µs 45.723µs ± 0.101µs 45.729µs ± 0.069µs 45.794µs 45.881µs 45.957µs 45.969µs 0.53% -0.228 0.085 0.22% 0.007µs 1 200
credit_card/is_card_number/37828224631000521389798 throughput 21753593.962op/s 21870784.848op/s ± 48454.342op/s 21867899.037op/s ± 33234.469op/s 21904208.346op/s 21950976.896op/s 22001158.879op/s 22020303.524op/s 0.70% 0.242 0.098 0.22% 3426.239op/s 1 200
credit_card/is_card_number/x371413321323331 execution_time 6.554µs 6.628µs ± 0.014µs 6.633µs ± 0.005µs 6.636µs 6.640µs 6.647µs 6.664µs 0.47% -1.786 5.129 0.20% 0.001µs 1 200
credit_card/is_card_number/x371413321323331 throughput 150068062.326op/s 150880241.501op/s ± 308835.444op/s 150766206.848op/s ± 105170.226op/s 150991235.167op/s 151474650.923op/s 151799767.988op/s 152578947.985op/s 1.20% 1.810 5.266 0.20% 21837.964op/s 1 200
credit_card/is_card_number_no_luhn/ execution_time 3.900µs 3.916µs ± 0.003µs 3.916µs ± 0.002µs 3.918µs 3.920µs 3.921µs 3.923µs 0.18% -0.574 3.071 0.07% 0.000µs 1 200
credit_card/is_card_number_no_luhn/ throughput 254934351.661op/s 255392296.015op/s ± 183418.671op/s 255391228.889op/s ± 128394.689op/s 255517649.889op/s 255651068.056op/s 255726645.679op/s 256388771.677op/s 0.39% 0.585 3.124 0.07% 12969.659op/s 1 200
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 execution_time 65.515µs 65.702µs ± 0.047µs 65.702µs ± 0.030µs 65.734µs 65.779µs 65.800µs 65.805µs 0.16% -0.371 0.660 0.07% 0.003µs 1 200
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 throughput 15196433.268op/s 15220172.605op/s ± 10862.901op/s 15220155.824op/s ± 6994.332op/s 15225962.238op/s 15239065.834op/s 15245015.200op/s 15263783.621op/s 0.29% 0.376 0.672 0.07% 768.123op/s 1 200
credit_card/is_card_number_no_luhn/ 378282246310005 execution_time 53.359µs 53.425µs ± 0.033µs 53.423µs ± 0.023µs 53.447µs 53.479µs 53.503µs 53.537µs 0.21% 0.369 0.013 0.06% 0.002µs 1 200
credit_card/is_card_number_no_luhn/ 378282246310005 throughput 18678715.365op/s 18717847.721op/s ± 11509.342op/s 18718468.901op/s ± 7958.149op/s 18726116.576op/s 18736188.571op/s 18739739.053op/s 18741150.912op/s 0.12% -0.365 0.007 0.06% 813.833op/s 1 200
credit_card/is_card_number_no_luhn/37828224631 execution_time 3.895µs 3.914µs ± 0.003µs 3.914µs ± 0.002µs 3.916µs 3.920µs 3.922µs 3.924µs 0.25% -0.625 6.228 0.08% 0.000µs 1 200
credit_card/is_card_number_no_luhn/37828224631 throughput 254860122.690op/s 255473191.837op/s ± 208532.274op/s 255493446.593op/s ± 111479.242op/s 255591124.626op/s 255747955.330op/s 255837682.466op/s 256751561.160op/s 0.49% 0.644 6.338 0.08% 14745.459op/s 1 200
credit_card/is_card_number_no_luhn/378282246310005 execution_time 50.134µs 50.217µs ± 0.036µs 50.216µs ± 0.025µs 50.243µs 50.277µs 50.298µs 50.335µs 0.24% 0.270 -0.187 0.07% 0.003µs 1 200
credit_card/is_card_number_no_luhn/378282246310005 throughput 19866803.019op/s 19913520.330op/s ± 14411.311op/s 19913848.708op/s ± 10048.977op/s 19923458.556op/s 19935011.464op/s 19942358.230op/s 19946398.045op/s 0.16% -0.266 -0.191 0.07% 1019.034op/s 1 200
credit_card/is_card_number_no_luhn/37828224631000521389798 execution_time 45.492µs 45.733µs ± 0.092µs 45.737µs ± 0.065µs 45.798µs 45.879µs 45.946µs 45.961µs 0.49% -0.097 -0.328 0.20% 0.006µs 1 200
credit_card/is_card_number_no_luhn/37828224631000521389798 throughput 21757726.228op/s 21866153.226op/s ± 43926.924op/s 21863983.463op/s ± 31108.637op/s 21898938.463op/s 21940145.311op/s 21971550.091op/s 21982012.691op/s 0.54% 0.107 -0.326 0.20% 3106.103op/s 1 200
credit_card/is_card_number_no_luhn/x371413321323331 execution_time 6.588µs 6.630µs ± 0.013µs 6.635µs ± 0.007µs 6.640µs 6.644µs 6.649µs 6.652µs 0.26% -0.908 0.337 0.19% 0.001µs 1 200
credit_card/is_card_number_no_luhn/x371413321323331 throughput 150338196.226op/s 150833636.556op/s ± 287678.396op/s 150723738.479op/s ± 159105.409op/s 151031981.027op/s 151338304.703op/s 151689782.061op/s 151781645.116op/s 0.70% 0.917 0.362 0.19% 20341.934op/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 [3.915µs; 3.916µs] or [-0.010%; +0.010%] None None None
credit_card/is_card_number/ throughput [255371419.378op/s; 255425025.733op/s] or [-0.010%; +0.010%] None None None
credit_card/is_card_number/ 3782-8224-6310-005 execution_time [79.566µs; 79.731µs] or [-0.103%; +0.103%] None None None
credit_card/is_card_number/ 3782-8224-6310-005 throughput [12542832.495op/s; 12568817.685op/s] or [-0.103%; +0.103%] None None None
credit_card/is_card_number/ 378282246310005 execution_time [71.706µs; 71.805µs] or [-0.069%; +0.069%] None None None
credit_card/is_card_number/ 378282246310005 throughput [13926979.707op/s; 13946097.438op/s] or [-0.069%; +0.069%] None None None
credit_card/is_card_number/37828224631 execution_time [3.915µs; 3.916µs] or [-0.010%; +0.010%] None None None
credit_card/is_card_number/37828224631 throughput [255352403.973op/s; 255401953.127op/s] or [-0.010%; +0.010%] None None None
credit_card/is_card_number/378282246310005 execution_time [68.579µs; 68.690µs] or [-0.081%; +0.081%] None None None
credit_card/is_card_number/378282246310005 throughput [14558758.062op/s; 14582049.035op/s] or [-0.080%; +0.080%] None None None
credit_card/is_card_number/37828224631000521389798 execution_time [45.709µs; 45.737µs] or [-0.031%; +0.031%] None None None
credit_card/is_card_number/37828224631000521389798 throughput [21864069.542op/s; 21877500.154op/s] or [-0.031%; +0.031%] None None None
credit_card/is_card_number/x371413321323331 execution_time [6.626µs; 6.630µs] or [-0.028%; +0.028%] None None None
credit_card/is_card_number/x371413321323331 throughput [150837439.879op/s; 150923043.123op/s] or [-0.028%; +0.028%] None None None
credit_card/is_card_number_no_luhn/ execution_time [3.915µs; 3.916µs] or [-0.010%; +0.010%] None None None
credit_card/is_card_number_no_luhn/ throughput [255366875.951op/s; 255417716.079op/s] or [-0.010%; +0.010%] None None None
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 execution_time [65.696µs; 65.709µs] or [-0.010%; +0.010%] None None None
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 throughput [15218667.112op/s; 15221678.099op/s] or [-0.010%; +0.010%] None None None
credit_card/is_card_number_no_luhn/ 378282246310005 execution_time [53.420µs; 53.430µs] or [-0.009%; +0.009%] None None None
credit_card/is_card_number_no_luhn/ 378282246310005 throughput [18716252.637op/s; 18719442.805op/s] or [-0.009%; +0.009%] None None None
credit_card/is_card_number_no_luhn/37828224631 execution_time [3.914µs; 3.915µs] or [-0.011%; +0.011%] None None None
credit_card/is_card_number_no_luhn/37828224631 throughput [255444291.269op/s; 255502092.405op/s] or [-0.011%; +0.011%] None None None
credit_card/is_card_number_no_luhn/378282246310005 execution_time [50.212µs; 50.222µs] or [-0.010%; +0.010%] None None None
credit_card/is_card_number_no_luhn/378282246310005 throughput [19911523.061op/s; 19915517.599op/s] or [-0.010%; +0.010%] None None None
credit_card/is_card_number_no_luhn/37828224631000521389798 execution_time [45.720µs; 45.746µs] or [-0.028%; +0.028%] None None None
credit_card/is_card_number_no_luhn/37828224631000521389798 throughput [21860065.377op/s; 21872241.075op/s] or [-0.028%; +0.028%] None None None
credit_card/is_card_number_no_luhn/x371413321323331 execution_time [6.628µs; 6.632µs] or [-0.026%; +0.026%] None None None
credit_card/is_card_number_no_luhn/x371413321323331 throughput [150793767.097op/s; 150873506.015op/s] or [-0.026%; +0.026%] None None None

Group 9

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 2d4e32d 1761777238 sameerank/FFL-1284-Create-datadog-ffe-ffi-crate
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 86.216µs 86.488µs ± 0.169µs 86.467µs ± 0.057µs 86.524µs 86.655µs 86.884µs 88.334µs 2.16% 6.901 70.942 0.19% 0.012µ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 [86.464µs; 86.511µs] or [-0.027%; +0.027%] None None None

Group 10

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 2d4e32d 1761777238 sameerank/FFL-1284-Create-datadog-ffe-ffi-crate
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 160.440µs 161.105µs ± 0.410µs 161.032µs ± 0.163µs 161.246µs 161.581µs 162.174µs 165.208µs 2.59% 5.378 49.091 0.25% 0.029µ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 [161.048µs; 161.162µs] or [-0.035%; +0.035%] None None None

Group 11

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 2d4e32d 1761777238 sameerank/FFL-1284-Create-datadog-ffe-ffi-crate
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.172µs 27.179µs ± 9.958µs 18.807µs ± 0.212µs 34.976µs 45.422µs 46.468µs 64.066µs 240.65% 0.793 0.014 36.55% 0.704µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
two way interface execution_time [25.799µs; 28.559µs] or [-5.078%; +5.078%] None None None

Group 12

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 2d4e32d 1761777238 sameerank/FFL-1284-Create-datadog-ffe-ffi-crate
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 33.078µs 33.642µs ± 0.944µs 33.193µs ± 0.082µs 33.378µs 35.639µs 35.690µs 37.053µs 11.63% 1.728 1.240 2.80% 0.067µ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 [33.511µs; 33.772µs] or [-0.389%; +0.389%] None None None

Group 13

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 2d4e32d 1761777238 sameerank/FFL-1284-Create-datadog-ffe-ffi-crate
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
sdk_test_data/rules-based execution_time 121.358µs 123.142µs ± 1.419µs 122.886µs ± 0.369µs 123.332µs 124.444µs 128.624µs 136.449µs 11.04% 5.803 44.928 1.15% 0.100µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
sdk_test_data/rules-based execution_time [122.946µs; 123.339µs] or [-0.160%; +0.160%] None None None

Group 14

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 2d4e32d 1761777238 sameerank/FFL-1284-Create-datadog-ffe-ffi-crate
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 2.364µs 2.420µs ± 0.019µs 2.416µs ± 0.009µs 2.430µs 2.463µs 2.471µs 2.477µs 2.52% 0.605 1.458 0.77% 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 [2.418µs; 2.423µs] or [-0.107%; +0.107%] None None None

Group 15

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 2d4e32d 1761777238 sameerank/FFL-1284-Create-datadog-ffe-ffi-crate
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
receiver_entry_point/report/2597 execution_time 6.116ms 6.395ms ± 0.049ms 6.396ms ± 0.015ms 6.411ms 6.458ms 6.543ms 6.574ms 2.78% -1.631 11.735 0.77% 0.003ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
receiver_entry_point/report/2597 execution_time [6.389ms; 6.402ms] or [-0.107%; +0.107%] None None None

Group 16

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 2d4e32d 1761777238 sameerank/FFL-1284-Create-datadog-ffe-ffi-crate
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 239.761ns 250.790ns ± 13.795ns 245.142ns ± 3.175ns 249.803ns 284.750ns 294.167ns 296.471ns 20.94% 1.826 2.215 5.49% 0.975ns 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 [248.878ns; 252.702ns] or [-0.762%; +0.762%] None None None

Group 17

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 2d4e32d 1761777238 sameerank/FFL-1284-Create-datadog-ffe-ffi-crate
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
single_flag_killswitch/rules-based execution_time 171.657ns 175.925ns ± 3.239ns 175.495ns ± 2.254ns 177.507ns 181.911ns 185.419ns 189.053ns 7.73% 1.025 1.135 1.84% 0.229ns 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
single_flag_killswitch/rules-based execution_time [175.476ns; 176.374ns] or [-0.255%; +0.255%] None None None

Baseline

Omitted due to size.

@codecov-commenter
Copy link

codecov-commenter commented Oct 24, 2025

Codecov Report

❌ Patch coverage is 0% with 82 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.96%. Comparing base (3ad7d4a) to head (2d4e32d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1282      +/-   ##
==========================================
- Coverage   72.05%   71.96%   -0.09%     
==========================================
  Files         368      371       +3     
  Lines       58076    58158      +82     
==========================================
+ Hits        41847    41854       +7     
- Misses      16229    16304      +75     
Components Coverage Δ
datadog-crashtracker 50.67% <ø> (+0.02%) ⬆️
datadog-crashtracker-ffi 5.86% <ø> (ø)
datadog-alloc 98.73% <ø> (ø)
data-pipeline 88.16% <ø> (ø)
data-pipeline-ffi 88.19% <ø> (ø)
ddcommon 80.95% <ø> (ø)
ddcommon-ffi 73.84% <ø> (ø)
ddtelemetry 59.98% <ø> (-0.04%) ⬇️
ddtelemetry-ffi 21.24% <ø> (ø)
dogstatsd-client 83.26% <ø> (ø)
datadog-ipc 82.39% <ø> (ø)
datadog-profiling 76.90% <ø> (ø)
datadog-profiling-ffi 62.12% <ø> (ø)
datadog-sidecar 37.69% <ø> (ø)
datdog-sidecar-ffi 15.88% <ø> (ø)
spawn-worker 55.18% <ø> (ø)
tinybytes 92.44% <ø> (ø)
datadog-trace-normalization 98.24% <ø> (ø)
datadog-trace-obfuscation 94.17% <ø> (ø)
datadog-trace-protobuf 59.65% <ø> (ø)
datadog-trace-utils 90.15% <ø> (ø)
datadog-tracer-flare 64.98% <ø> (ø)
datadog-log 75.57% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dd-octo-sts
Copy link

dd-octo-sts bot commented Oct 24, 2025

Artifact Size Benchmark Report

aarch64-alpine-linux-musl
Artifact Baseline Commit Change
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.a 71.36 MB 71.36 MB 0% (0 B) 👌
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 7.25 MB 7.25 MB 0% (0 B) 👌
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 83.71 MB 83.71 MB 0% (0 B) 👌
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 9.20 MB 9.20 MB 0% (0 B) 👌
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 18.61 MB 18.61 MB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 65.77 KB 65.77 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 131.05 MB 131.06 MB +.01% (+16.00 KB) 🔍
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 692.03 MB 692.03 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 5.93 MB 5.93 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 65.77 KB 65.77 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 17.51 MB 17.51 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 32.46 MB 32.46 MB 0% (0 B) 👌
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 15.85 MB 15.85 MB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 66.79 KB 66.79 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 133.14 MB 133.14 MB 0% (0 B) 👌
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 680.66 MB 680.66 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 4.54 MB 4.54 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 66.79 KB 66.79 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 18.66 MB 18.66 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 30.52 MB 30.52 MB 0% (0 B) 👌
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 63.98 MB 63.98 MB 0% (0 B) 👌
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 8.56 MB 8.56 MB 0% (0 B) 👌
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 78.42 MB 78.42 MB 0% (0 B) 👌
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 9.91 MB 9.91 MB 0% (0 B) 👌

Creates C-compatible FFI layer for Feature Flagging & Experimentation:

- Add datadog-ffe-ffi crate following ddsketch-ffi patterns
- Implement Handle<T> wrappers for Configuration, EvaluationContext, Assignment
- Export get_assignment, configuration_new, evaluation_context_new functions
- Add memory management with drop functions
- Generate C headers via cbindgen for Ruby integration
- Update Cargo.toml to include new FFI crate in workspace
- Remove trailing whitespace from doc comments
- Reformat function call in assignment.rs to fit line length constraints
@sameerank sameerank force-pushed the sameerank/FFL-1284-Create-datadog-ffe-ffi-crate branch from 553e2ac to dfc60e3 Compare October 24, 2025 19:11
- Updated build.rs to use a variable for the header name and improved readability.
- Modified cbindgen.toml to reorganize export settings and enforce naming conventions for types and functions.
- Added Clippy lints in lib.rs to enhance code quality and prevent common pitfalls.
[package]
name = "datadog-ffe-ffi"
edition.workspace = true
version = "0.1.0"
Copy link
Author

@sameerank sameerank Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To match with

version = "0.1.0"

to indicate that datadog-ffe-ffi is not production ready

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can pin this, so that datadog-ffe and datadog-ffe-ffi versions are always aligned? Maybe we should put FFI functions into datadog-ffe directly

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a temporary issue. When FFI is ready, we can update datadog-ffe/Cargo.toml and datadog-ffe-ffi/Cargo.toml to

version.workspace = true  # Would use "22.1.0"

From

version = "22.1.0"

Also the version in the dependency should cause a build failure, which is another way of ensuring that they match

datadog-ffe = { path = "../datadog-ffe", version = "=0.1.0" }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we will not use the workspace version.

  1. It doesn't really suit us to have use the workspace version as it makes version bumps more complicated requiring cross-team alignment without any benefit
  2. libdatadog is migrating into the direction of each package having its own version

@sameerank sameerank marked this pull request as ready for review October 27, 2025 21:54
@sameerank sameerank requested review from a team as code owners October 27, 2025 21:54
sameerank and others added 2 commits October 28, 2025 11:12
Pin datadog-ffe to exact version

Co-authored-by: Oleksii Shmalko <[email protected]>
refactor(ffe): simplify error handling

Merge branch 'sameerank/FFL-1284-Create-datadog-ffe-ffi-crate' into ffe-simplify-error-handling

Co-authored-by: sameerank <[email protected]>
Replace ddog_ffe_evaluation_context_new_with_attribute with ddog_ffe_evaluation_context_new_with_attributes that accepts an array of AttributePair structs.
Handle take() errors gracefully in ddog_ffe_configuration_drop and ddog_ffe_assignment_drop to prevent malloc corruption from double-free or use-after-free scenarios. Previously, take() failures would panic and cause "pointer being freed was not allocated" errors.
- Changed the `context` parameter in `ddog_ffe_get_assignment` to be a pointer for consistency.
- Removed the single-attribute constructor `ddog_ffe_evaluation_context_new` and updated the multi-attribute constructor's documentation for clarity.
@sameerank sameerank requested a review from dd-oleksii October 29, 2025 23:32
Comment on lines +28 to +29
let config = config.to_inner_mut()?;
let context = context.to_inner_mut()?;
Copy link
Contributor

@dd-oleksii dd-oleksii Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor (postpone for now): .to_inner_mut() is creating &mut references which is unsound/unsafe with multi-threading. We'll need to migrate to using const-references in the future

Comment on lines +32 to +38
let assignment_result = get_assignment(Some(config), flag_key, context, None, now())?;

let handle = if let Some(assignment) = assignment_result {
Handle::from(assignment)
} else {
Handle::empty()
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major: ? is stripping all of the error details which are going to be important to populate reason/error_code/error_message openfeature fields. We need to return a new structure that would accurately preserve error codes, similarly to ResolutionDetails in DataDog/dd-trace-py#15098

mut config: *mut Handle<Configuration>,
flag_key: *const c_char,
mut context: *mut Handle<EvaluationContext>,
) -> Result<Handle<Assignment>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major(?): is Ruby able to access fields directly (I guess not?) or we need to provide accessor methods?

targeting_key: *const c_char,
attributes: *const AttributePair,
attributes_count: usize,
) -> Handle<EvaluationContext> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: consider using similar error-handling pattern here

Comment on lines +63 to +64
Str::from(name_str.to_string()),
Attribute::from(value_str.to_string()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: this seems to do unnecessary allocation of String: CStr -> &str -> String -> Str. We shall be able to go directly from &str to Str:

Suggested change
Str::from(name_str.to_string()),
Attribute::from(value_str.to_string()),
Str::from(name_str),
Attribute::from(value_str),

#[repr(C)]
pub struct AttributePair {
pub name: *const c_char,
pub value: *const c_char,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major: how does this work for numeric and boolean attributes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants