From d5a5c17287cea915118753f805ef1e074508e314 Mon Sep 17 00:00:00 2001 From: andylokandy Date: Sat, 22 Jun 2024 21:23:52 +0800 Subject: [PATCH] update doc Signed-off-by: andylokandy --- minitrace/src/collector/mod.rs | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/minitrace/src/collector/mod.rs b/minitrace/src/collector/mod.rs index 7bfd5eb9..d460da07 100644 --- a/minitrace/src/collector/mod.rs +++ b/minitrace/src/collector/mod.rs @@ -271,14 +271,15 @@ pub struct Config { } impl Config { - /// A soft limit for the total number of spans and events for a trace, usually used - /// to avoid out-of-memory. + /// Sets a soft limit for the total number of spans and events in a trace, typically + /// used to prevent out-of-memory issues. /// /// The default value is `None`. /// /// # Note /// - /// Root span will always be collected. The eventually collected spans may exceed the limit. + /// The root span will always be collected, so the actual number of collected spans + /// may exceed the specified limit. /// /// # Examples /// @@ -295,7 +296,7 @@ impl Config { } } - /// The time duration between two batch reports. + /// Sets the time duration between two batch reports. #[deprecated( since = "0.6.7", note = "Please use `report_interval` instead. This method is now a no-op." @@ -304,7 +305,7 @@ impl Config { self } - /// The soft limit for the maximum number of spans in a batch report. + /// Sets the soft limit for the maximum number of spans in a batch report. #[deprecated( since = "0.6.7", note = "Please use `report_interval` instead. This method is now a no-op." @@ -313,13 +314,13 @@ impl Config { self } - /// The time duration between two reports. The reporter will be called when the time duration is - /// met even the collected spans are empty. So you may implement batching in the reporter. + /// Sets the time duration between two reports. The reporter will be invoked when the specified + /// duration elapses, even if no spans have been collected. This allows for batching in the + /// reporter. /// - /// In some cases, especially when you are under very high pressure, and have - /// vitnessed spans being lost, it's most likely that the channel is full during - /// the report interval. You may want to decrease the report interval even down to - /// zero to avoid losing spans. + /// In some scenarios, particularly under high load, you may notice spans being lost. This is + /// likely due to the channel being full during the reporting interval. To mitigate this issue, + /// consider reducing the report interval, potentially down to zero, to prevent losing spans. /// /// The default value is 10 milliseconds. pub fn report_interval(self, report_interval: Duration) -> Self { @@ -329,10 +330,10 @@ impl Config { } } - /// Whether to report the spans before the root span finishes. + /// Configures whether to report spans before the root span finishes. /// - /// If this is set to `true`, you may not be able to cancel all spans in a trace because some of - /// the spans may be reported before they are canceled. + /// If set to `true`, some spans may be reported before they are canceled, making it + /// difficult to cancel all spans in a trace. /// /// The default value is `false`. ///