We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6a199f8 commit 8e8e204Copy full SHA for 8e8e204
plugins/wpgraphql-logging/src/Logger/Rules/SamplingRateRule.php
@@ -24,7 +24,12 @@ class SamplingRateRule implements LoggingRuleInterface {
24
*/
25
public function passes(array $config, ?string $query_string = null): bool {
26
$sampling_rate = (int) ( $config[ BasicConfigurationTab::DATA_SAMPLING ] ?? 100 );
27
- $rand = wp_rand( 0, 100 );
+ // If sampling rate is 0, never log.
28
+ if ( 1 > $sampling_rate ) {
29
+ return false;
30
+ }
31
+
32
+ $rand = wp_rand( 1, 100 );
33
return $rand <= $sampling_rate;
34
}
35
0 commit comments