Skip to main content

InvocationRecord

Struct InvocationRecord 

Source
pub struct InvocationRecord {
Show 16 fields pub id: Uuid, pub session_id: String, pub timestamp: DateTime<Utc>, pub duration_ms: Option<i64>, pub cwd: String, pub cmd: String, pub executable: Option<String>, pub runner_id: Option<String>, pub exit_code: Option<i32>, pub status: String, pub format_hint: Option<String>, pub client_id: String, pub hostname: Option<String>, pub username: Option<String>, pub tag: Option<String>, pub metadata: HashMap<String, Value>,
}
Expand description

An invocation record (a captured command/process execution).

Fields§

§id: Uuid

Unique identifier (UUIDv7 for time-ordering).

§session_id: String

Session identifier (groups related invocations).

§timestamp: DateTime<Utc>

When the invocation started.

§duration_ms: Option<i64>

How long the invocation took in milliseconds.

§cwd: String

Working directory when invocation was executed.

§cmd: String

The full command string.

§executable: Option<String>

Extracted executable name (e.g., “make” from “make test”).

§runner_id: Option<String>

Runner identifier for liveness checking of pending invocations. Format depends on execution context:

  • Local process: “pid:12345”
  • GitHub Actions: “gha:run:12345678”
  • Kubernetes: “k8s:pod:abc123”
§exit_code: Option<i32>

Exit code (None while pending).

§status: String

Invocation status: “pending”, “completed”, “orphaned”.

§format_hint: Option<String>

Detected output format (e.g., “gcc”, “pytest”).

§client_id: String

Client identifier (user@hostname).

§hostname: Option<String>

Hostname where invocation was executed.

§username: Option<String>

Username who executed the invocation.

§tag: Option<String>

User-defined tag (unique alias for this invocation, like git tags).

§metadata: HashMap<String, Value>

Extensible metadata (VCS info, CI context, etc.). Stored on the AttemptRecord when converted to v5 schema.

Implementations§

Source§

impl InvocationRecord

Source

pub fn new( session_id: impl Into<String>, cmd: impl Into<String>, cwd: impl Into<String>, exit_code: i32, client_id: impl Into<String>, ) -> Self

Create a new invocation record.

If BIRD_INVOCATION_UUID is set in the environment, uses that UUID to enable deduplication across nested BIRD clients.

Source

pub fn with_id( id: Uuid, session_id: impl Into<String>, cmd: impl Into<String>, cwd: impl Into<String>, exit_code: i32, client_id: impl Into<String>, ) -> Self

Create a new invocation record with an explicit UUID.

Use this when you need to control the UUID (e.g., for testing or when the UUID is provided externally).

Source

pub fn new_pending( session_id: impl Into<String>, cmd: impl Into<String>, cwd: impl Into<String>, runner_id: impl Into<String>, client_id: impl Into<String>, ) -> Self

Create a new pending invocation record.

Use this when a command starts but hasn’t completed yet. The exit_code is None and status is “pending”.

runner_id identifies the execution context for liveness checking:

  • Local process: “pid:12345”
  • GitHub Actions: “gha:run:12345678”
  • Kubernetes: “k8s:pod:abc123”
Source

pub fn new_pending_local( session_id: impl Into<String>, cmd: impl Into<String>, cwd: impl Into<String>, pid: i32, client_id: impl Into<String>, ) -> Self

Create a pending invocation for a local process.

Convenience method that formats the PID as “pid:{pid}”.

Source

pub fn complete(self, exit_code: i32, duration_ms: Option<i64>) -> Self

Mark this invocation as completed with the given exit code.

Source

pub fn mark_orphaned(self) -> Self

Mark this invocation as orphaned (process died without cleanup).

Source

pub fn with_runner_id(self, runner_id: impl Into<String>) -> Self

Set the runner ID.

Source

pub fn is_inherited() -> bool

Check if this invocation was inherited from a parent BIRD client.

Source

pub fn parent_client() -> Option<String>

Get the parent BIRD client name, if any.

Source

pub fn with_duration(self, duration_ms: i64) -> Self

Set the duration.

Source

pub fn with_format_hint(self, hint: impl Into<String>) -> Self

Set the format hint.

Source

pub fn with_tag(self, tag: impl Into<String>) -> Self

Set the tag (unique alias for this invocation).

Source

pub fn with_metadata_entry(self, key: impl Into<String>, value: Value) -> Self

Add a single metadata entry.

Source

pub fn with_metadata(self, metadata: HashMap<String, Value>) -> Self

Set all metadata from a HashMap.

Source

pub fn merge_metadata(self, metadata: HashMap<String, Value>) -> Self

Merge metadata from a HashMap (existing entries are preserved).

Source

pub fn date(&self) -> NaiveDate

Get the date portion of the timestamp (for partitioning).

Source

pub fn to_attempt(&self) -> AttemptRecord

Convert this invocation record to an AttemptRecord (v5 schema).

Source

pub fn to_outcome(&self) -> Option<OutcomeRecord>

Convert this invocation record to an OutcomeRecord (v5 schema).

Returns None if this is a pending invocation (no outcome yet).

Source

pub fn from_attempt_outcome( attempt: &AttemptRecord, outcome: Option<&OutcomeRecord>, ) -> Self

Create an InvocationRecord from AttemptRecord and optional OutcomeRecord (v5 schema).

Trait Implementations§

Source§

impl Clone for InvocationRecord

Source§

fn clone(&self) -> InvocationRecord

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InvocationRecord

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for InvocationRecord

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for InvocationRecord

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,