pub fn add_tags(&mut self, tags: &[(&str, &str)]) -> Result<()> {
        log::debug!(target: LOG_TAG, "Adding tags");
        // Check that tags are not empty
        if tags.is_empty() {
            return Ok(());
        }

        // Stop Agent
        self.stop();

        // Convert &[(&str, &str)] to HashMap(String, String)
        let tags_hashmap: HashMap<String, String> = tags
            .to_owned()
            .iter()
            .cloned()
            .map(|(a, b)| (a.to_owned(), b.to_owned()))
            .collect();

        self.config.tags.extend(tags_hashmap);

        // Restart Agent
        self.start();

        Ok(())
    }
/// Add tags. This will restart the agent.
/// # Example
/// ```ignore
/// let agent = PyroscopeAgent::builder("http://localhost:8080", "my-app").build()?;
/// agent.start()?;
/// // Expensive operation
/// agent.add_tags(vec!["tag", "value"])?;
/// // Tagged operation
/// agent.stop()?;
/// ```
Add tags. This will restart the agent.
Add tags . This will restart the agent .
pub fn add_tags(&mut self, tags: &[(&str, &str)]) -> Result<()> {
        log::debug!(target: LOG_TAG, "Adding tags");
        // Check that tags are not empty
        if tags.is_empty() {
            return Ok(());
        }
        // Stop Agent
        self.stop();
        // Convert &[(&str, &str)] to HashMap(String, String)
        let tags_hashmap: HashMap<String, String> = tags
            .to_owned()
            .iter()
            .cloned()
            .map(|(a, b)| (a.to_owned(), b.to_owned()))
            .collect();
        self.config.tags.extend(tags_hashmap);
        // Restart Agent
        self.start();
        Ok(())
    }
pub fn add_tags ( & mut self , tags : & [ ( & str , & str ) ] ) -> Result < ( ) > { log :: debug ! ( target LOG_TAG " " ) ; // Check that tags are not empty if tags . is_empty ( ) { return Ok ( ( ) ) ; } // Stop Agent self . stop ( ) ; // Convert &[(&str, &str)] to HashMap(String, String) let tags_hashmap : HashMap < String , String > = tags . to_owned ( ) . iter ( ) . cloned ( ) . map ( | ( a , b ) | ( a . to_owned ( ) , b . to_owned ( ) ) ) . collect ( ) ; self . config . tags . extend ( tags_hashmap ) ; // Restart Agent self . start ( ) ; Ok ( ( ) ) }
Add tags.
Add tags .
&mut self
tags
&[(&str, &str)]
&mut self
tags
&[(&str, &str)]
example
None