Skip to main content

aperture_shared/wasm/
mod.rs

1use serde::{Deserialize, Serialize};
2
3/// Filter input containing event data
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct FilterInput {
6    /// Event type (cpu, lock, syscall)
7    pub event_type: String,
8
9    /// Process ID
10    pub pid: u32,
11
12    /// Thread ID
13    pub tid: u32,
14
15    /// Timestamp (nanoseconds)
16    pub timestamp: u64,
17
18    /// Process name
19    pub comm: String,
20
21    /// Stack trace (instruction pointers)
22    pub stack_trace: Vec<u64>,
23
24    /// Event-specific data (JSON)
25    pub event_data: String,
26}
27
28/// Filter output result
29#[derive(Debug, Clone, Serialize, Deserialize)]
30pub enum FilterResult {
31    /// Keep the event as-is
32    Keep,
33
34    /// Drop the event
35    Drop,
36
37    /// Transform the event
38    Transform(FilterInput),
39}
40
41/// Filter API version
42pub const FILTER_API_VERSION: u32 = 1;