Function note

Source
pub fn note(task: &str, key: &str, value: Value)
Expand description

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

This function allows you to annotate a task with additional metadata in the form of key-value pairs. The value can be any valid JSON value.

§Arguments

  • task - The string identifier of the task to annotate
  • key - The key for the metadata entry
  • value - The value to associate with the key (any valid JSON value)

§Panics

  • Panics if the last event was not started (i.e., if you try to add a note to a task that wasn’t started or was already ended)

§Examples

use altius_benchtools::profiler;
use serde_json::json;
 
profiler::start("http_request");
profiler::note("http_request", "method", json!("POST"));
profiler::note("http_request", "headers", json!({
    "Content-Type": "application/json",
    "Authorization": "Bearer token"
}));
// ... perform request ...
profiler::end("http_request");