The effective rate at which statement execution should be sampled. This is the value of the session var `statement_logging_sample_rate`, constrained by the system var `statement_logging_max_sample_rate`.
(session: &Session, system_vars: &SystemVars)
| 724 | /// This is the value of the session var `statement_logging_sample_rate`, |
| 725 | /// constrained by the system var `statement_logging_max_sample_rate`. |
| 726 | pub(crate) fn effective_sample_rate(session: &Session, system_vars: &SystemVars) -> f64 { |
| 727 | let system_max: f64 = system_vars |
| 728 | .statement_logging_max_sample_rate() |
| 729 | .try_into() |
| 730 | .expect("value constrained to be convertible to f64"); |
| 731 | let user_rate: f64 = session |
| 732 | .vars() |
| 733 | .get_statement_logging_sample_rate() |
| 734 | .try_into() |
| 735 | .expect("value constrained to be convertible to f64"); |
| 736 | f64::min(system_max, user_rate) |
| 737 | } |
| 738 | |
| 739 | /// Helper function to decide whether to sample a statement execution. |
| 740 | /// Returns `true` if the statement should be sampled based on the sample rate. |
no test coverage detected