Function notes

Source
pub fn notes(task: &str, description: &mut Map<String, Value>)
Expand description

Adds multiple key-value notes to the last event of a task.

This function allows you to add multiple annotations at once by providing a map of key-value pairs.

§Arguments

  • task - The string identifier of the task to annotate
  • description - A mutable map containing the key-value pairs to add

§Panics

  • Panics if the last event was not started

§Examples

use altius_benchtools::profiler;
use serde_json::{Map, Value, json};
 
profiler::start("query");
let mut desc = Map::new();
desc.insert("table".to_string(), json!("users"));
desc.insert("type".to_string(), json!("SELECT"));
desc.insert("filter".to_string(), json!({"age": ">= 18"}));
profiler::notes("query", &mut desc);
// ... perform query ...
profiler::end("query");