Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Event data

An event’s attributes describe the data captured when that event occurs. The generated event method receives one typed argument for each attribute, in declaration order.

Data types

The scalar types are:

YAML typeValue
booltrue or false
u8, u16, u32, u64Unsigned integers of the indicated width
i8, i16, i32, i64Signed integers of the indicated width
f32, f64Floating-point numbers of the indicated width
stringText
uuidA universally unique identifier

Types can also be composed or refer to generated types:

YAML typeValue
{ option: T }A value of type T that may be absent
{ list: T }An ordered collection of values of type T
A record nameAn instance of that record
dynamicString-keyed values whose names and types are chosen at runtime
refA reference to any entity instance

Semantic modules add more specific reference forms. These are introduced with targeted references, scoped references, and resources.

YAML model

quent: alpha
model: event_data

entities:
  Task:
    events:
      started:
        attributes:
          enabled: bool
          byte: u8
          short_count: u16
          attempt: u32
          item_count: u64
          small_offset: i8
          short_offset: i16
          offset: i32
          large_offset: i64
      ended:
        attributes:
          ratio: f32
          score: f64
          message: string
          run_id: uuid
          retry_after: { option: u64 }
          tags: { list: string }
          extra: dynamic

Instrumentation API

The generated API maps each YAML type to the corresponding type in the selected programming language. Options, lists, records, and references remain typed. dynamic is the exception: it deliberately accepts values whose names and types are determined at runtime.

// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

#[allow(unused, clippy::too_many_arguments)]
mod instrumentation {
    include!(concat!(env!("OUT_DIR"), "/event_data.rs"));
}

use instrumentation::{Context, DynamicAttributes, EventData, Noop, Task, Uuid};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let context = Context::<EventData>::try_new(Noop)?;
    let mut task = context.observer::<Task>().handle();

    task.started(true, 1, 2, 3, 4, -1, -2, -3, -4)?;

    let mut extra = DynamicAttributes::new();
    extra.add("worker", "alpha");
    extra.add("queue_depth", 3_u64);

    task.ended(
        0.5,
        0.95,
        "complete".to_owned(),
        Uuid::now_v7(),
        None,
        vec!["batch".to_owned(), "priority".to_owned()],
        extra,
    )?;

    Ok(())
}
Key point

Event attributes produce typed parameters in the generated instrumentation API.

Check yourself

Which declaration permits an attribute value to be absent?

Which declaration represents several ordered values of the same type?