@@ -16,7 +16,6 @@ use crate::{
1616
1717const LOG_TAG : & str = "Pyroscope::Agent" ;
1818
19-
2019/// A signal sent from the agent to the timer.
2120///
2221/// Either schedules another wake-up, or asks
@@ -54,8 +53,6 @@ pub struct PyroscopeConfig {
5453 pub tags : HashMap < String , String > ,
5554 /// Sample rate used in Hz
5655 pub sample_rate : i32 ,
57- /// How long to accumulate data for before sending it upstream
58- pub accumulation_cycle : std:: time:: Duration ,
5956 // TODO
6057 // log_level
6158 // auth_token
@@ -76,7 +73,6 @@ impl PyroscopeConfig {
7673 application_name : application_name. as_ref ( ) . to_owned ( ) ,
7774 tags : HashMap :: new ( ) ,
7875 sample_rate : 100i32 ,
79- accumulation_cycle : std:: time:: Duration :: from_secs ( 10 ) ,
8076 }
8177 }
8278
@@ -94,26 +90,6 @@ impl PyroscopeConfig {
9490 }
9591 }
9692
97- /// Override the accumulation cycle.
98- ///
99- /// # Example
100- ///
101- /// ```
102- /// # fn main() -> Result<(), PyroscopeError> {
103- /// use std::time::Duration;
104- /// use pyroscope::pyroscope::PyroscopeConfig;
105- /// let config = PyroscopeConfig::new("http://localhost:8080", "my-app")
106- /// .accumulation_cycle(Duration::from_millis(4587))?;
107- /// # Ok(())
108- /// # }
109- /// ```
110- pub fn accumulation_cycle ( self , accumulation_cycle : std:: time:: Duration ) -> Self {
111- Self {
112- accumulation_cycle,
113- ..self
114- }
115- }
116-
11793 /// Set the tags
11894 /// # Example
11995 /// ```ignore
@@ -203,28 +179,6 @@ impl PyroscopeAgentBuilder {
203179 }
204180 }
205181
206- /// Set the accumulation cycle. Default value is 10 seconds.
207- ///
208- /// # Example
209- ///
210- /// ```
211- /// # fn main() -> Result<(), PyroscopeError> {
212- /// use std::time::Duration;
213- ///
214- /// let builder = PyroscopeAgentBuilder::new("http://localhost:8080", "my-app")
215- /// .accumulation_cycle(Duration::from_secs(3))
216- /// .build()
217- /// ?;
218- /// # Ok(())
219- /// # }
220- /// ```
221- pub fn accumulation_cycle ( self , acc_cycle : impl Into < std:: time:: Duration > ) -> Self {
222- Self {
223- config : self . config . accumulation_cycle ( acc_cycle. into ( ) ) ,
224- ..self
225- }
226- }
227-
228182 /// Set tags. Default is empty.
229183 /// # Example
230184 /// ```ignore
@@ -248,7 +202,7 @@ impl PyroscopeAgentBuilder {
248202 log:: trace!( target: LOG_TAG , "Backend initialized" ) ;
249203
250204 // Start Timer
251- let timer = Timer :: initialize ( self . config . accumulation_cycle . clone ( ) ) ?;
205+ let timer = Timer :: initialize ( std :: time :: Duration :: from_secs ( 10 ) ) ?;
252206 log:: trace!( target: LOG_TAG , "Timer initialized" ) ;
253207
254208 // Start the SessionManager
@@ -306,7 +260,10 @@ impl Drop for PyroscopeAgent {
306260 // Stop the SessionManager
307261 match self . session_manager . push ( SessionSignal :: Kill ) {
308262 Ok ( _) => log:: trace!( target: LOG_TAG , "Sent kill signal to SessionManager" ) ,
309- Err ( _) => log:: error!( target: LOG_TAG , "Error sending kill signal to SessionManager" ) ,
263+ Err ( _) => log:: error!(
264+ target: LOG_TAG ,
265+ "Error sending kill signal to SessionManager"
266+ ) ,
310267 }
311268
312269 if let Some ( handle) = self . session_manager . handle . take ( ) {
@@ -325,7 +282,7 @@ impl Drop for PyroscopeAgent {
325282 }
326283 }
327284
328- log:: debug!( target: LOG_TAG , "Agent Dropped" ) ;
285+ log:: debug!( target: LOG_TAG , "Agent Dropped" ) ;
329286 }
330287}
331288
0 commit comments