Repository: meilisearch/meilisearch
File: meilisearch/src/analytics/segment_analytics.rs (Rust)

Code before:
        if total_received == 0 {
            None
        } else {
            // we get all the values in a sorted manner
            let time_spent = time_spent.into_sorted_vec();
            // the index of the 99th percentage of value
            let percentile_99th = time_spent.len() * 99 / 100;
            // We are only interested by the slowest value of the 99th fastest results
            let time_spent = time_spent.get(percentile_99th);

            let properties = json!({
                "user-agent": user_agents,
                "requests": {
                    "99th_response_time": time_spent.map(|t| format!("{:.2}", t)),
                    "total_succeeded": total_succeeded,
                    "total_failed": total_received.saturating_sub(total_succeeded), // just to be sure we never panics
                    "total_received": total_received,
                    "total_degraded": total_degraded,
                    "total_used_negative_operator": total_used_negative_operator,
                },
                "sort": {
                    "with_geoPoint": sort_with_geo_point,
                    "avg_criteria_number": format!("{:.2}", sort_sum_of_criteria_terms as f64 / sort_total_number_of_criteria as f64),
                },
                // TODO ask help from María
                "distinct": distinct,
                "filter": {
                   "with_geoRadius": filter_with_geo_radius,
                   "with_geoBoundingBox": filter_with_geo_bounding_box,
                   "avg_criteria_number": format!("{:.2}", filter_sum_of_criteria_terms as f64 / filter_total_number_of_criteria as f64),
                   "most_used_syntax": used_syntax.iter().max_by_key(|(_, v)| *v).map(|(k, _)| json!(k)).unwrap_or_else(|| json!(null)),
                },
                "attributes_to_search_on": {
                   "total_number_of_uses": attributes_to_search_on_total_number_of_uses,
                },
                "q": {
                   "max_terms_number": max_terms_number,
                },
                "vector": {
                    "max_vector_size": max_vector_size,
                },
                "hybrid": {
                    "enabled": hybrid,
                    "semantic_ratio": semantic_ratio,
                    "embedder": embedder,
                },
                "pagination": {
                   "max_limit": max_limit,
                   "max_offset": max_offset,
                   "most_used_navigation": if finite_pagination > (total_received / 2) { "exhaustive" } else { "estimated" },
                },

Review comment (refactor):
```suggestion
                "distinct": distinct,
```

I guess we can remove this comment now?

Code after:
        if total_received == 0 {
            None
        } else {
            // we get all the values in a sorted manner
            let time_spent = time_spent.into_sorted_vec();
            // the index of the 99th percentage of value
            let percentile_99th = time_spent.len() * 99 / 100;
            // We are only interested by the slowest value of the 99th fastest results
            let time_spent = time_spent.get(percentile_99th);

            let properties = json!({
                "user-agent": user_agents,
                "requests": {
                    "99th_response_time": time_spent.map(|t| format!("{:.2}", t)),
                    "total_succeeded": total_succeeded,
                    "total_failed": total_received.saturating_sub(total_succeeded), // just to be sure we never panics
                    "total_received": total_received,
                    "total_degraded": total_degraded,
                    "total_used_negative_operator": total_used_negative_operator,
                },
                "sort": {
                    "with_geoPoint": sort_with_geo_point,
                    "avg_criteria_number": format!("{:.2}", sort_sum_of_criteria_terms as f64 / sort_total_number_of_criteria as f64),
                },
                "distinct": distinct,
                "filter": {
                   "with_geoRadius": filter_with_geo_radius,
                   "with_geoBoundingBox": filter_with_geo_bounding_box,
                   "avg_criteria_number": format!("{:.2}", filter_sum_of_criteria_terms as f64 / filter_total_number_of_criteria as f64),
                   "most_used_syntax": used_syntax.iter().max_by_key(|(_, v)| *v).map(|(k, _)| json!(k)).unwrap_or_else(|| json!(null)),
                },
                "attributes_to_search_on": {
                   "total_number_of_uses": attributes_to_search_on_total_number_of_uses,
                },
                "q": {
                   "max_terms_number": max_terms_number,
                },
                "vector": {
                    "max_vector_size": max_vector_size,
                },
                "hybrid": {
                    "enabled": hybrid,
                    "semantic_ratio": semantic_ratio,
                    "embedder": embedder,
                },
                "pagination": {
                   "max_limit": max_limit,
                   "max_offset": max_offset,
                   "most_used_navigation": if finite_pagination > (total_received / 2) { "exhaustive" } else { "estimated" },
                },
                "formatting": {