Skip to content

2a: Add Session wire types to trapfall-proto #240

Description

@ajianaz

Parent: #232 · Blocked by: #235

Scope

Add session-related data types to trapfall-proto/src/lib.rs.

Structs to Add

SessionStatus enum

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum SessionStatus {
    Ok,
    Exited,
    Crashed,
    Abnormal,
}

SessionAttributes struct

pub struct SessionAttributes {
    pub release: String,
    pub environment: Option<String>,
    pub ip_address: Option<String>,
    pub user_agent: Option<String>,
}

SessionUpdate struct (individual session)

pub struct SessionUpdate {
    pub session_id: String,
    pub distinct_id: Option<String>,
    pub init: bool,
    pub started: String,
    pub duration: Option<f64>,
    pub status: SessionStatus,
    pub errors: u64,
    pub attributes: SessionAttributes,
}

SessionAggregateItem struct

pub struct SessionAggregateItem {
    pub started: String,
    pub distinct_id: Option<String>,
    pub exited: u32,
    pub errored: u32,
    pub abnormal: u32,
    pub crashed: u32,
}

SessionAggregates struct (batched)

pub struct SessionAggregates {
    pub aggregates: Vec<SessionAggregateItem>,
    pub attributes: SessionAttributes,
}

Extend ParsedEnvelope

pub struct ParsedEnvelope {
    pub events: Vec<Event>,
    pub transactions: Vec<Transaction>,
    pub session_updates: Vec<SessionUpdate>,       // NEW
    pub session_aggregates: Vec<SessionAggregates>, // NEW
}

Tasks

  • Add SessionStatus enum
  • Add SessionAttributes, SessionUpdate, SessionAggregateItem, SessionAggregates structs
  • Extend ParsedEnvelope with session fields
  • Unit tests: serde round-trip for all session types
  • Unit test: aggregated session with multiple buckets

Effort: ~1.5 hours

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestscope:prototrapfall-proto wire typestype:envelopeSentry envelope item type expansion

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions