Events
Events in Gigantic track user activities and system operations throughout the platform. They provide an audit trail of actions performed within models, projects, and organizations, and serve as the foundation for the notification system in the UI.
Purpose and Usage
Events are used for several key purposes:
- Audit Trail: Track all user actions for compliance and historical reference
- Notifications: Power the real-time notification system in the user interface
- Activity Monitoring: Monitor user and system activity across the platform
- Operational Insights: Provide insights into system usage and performance
Event Model Structure
The events are stored in MongoDB with the following structure:
| Field | Type | Description |
|---|---|---|
id | ObjectId | Unique identifier for the event |
user | ObjectId (ref: User) | Reference to the user who triggered the event |
project | ObjectId (optional) | Reference to the project context |
organization | ObjectId (optional) | Reference to the organization context |
model | ObjectId (optional) | Reference to the model context |
sourceId | ObjectId | Identifier of the specific entity that triggered the event |
action | EventAction | Type of action performed (sign, run, start, end, add, edit, delete) |
source | EventSource | Origin of the event (Auth, Organization, Project, Model, Rule, Scan, Discover, Dataset, Report, Load, Pump, Entity, Field, Label) |
info | String | Additional information about the event |
createdAt | Date | Timestamp when the event was created |
updatedAt | Date | Timestamp when the event was last updated |
readBy | [ObjectId] | List of users who have read/mark the event |
meta | Mixed | Flexible metadata storage for additional event details |
Event Actions
Events can have the following actions:
sign- User has signed or approved somethingrun- A process or job has been executedstart- An operation has startedend- An operation has endedadd- Something has been addededit- Something has been modifieddelete- Something has been removed
Event Sources
Events can originate from the following sources:
Auth- Authentication-related eventsOrganization- Organization-level eventsProject- Project-level eventsModel- Model-level eventsRule- Rule execution eventsScan- Scan job eventsDiscover- Discovery process eventsDataset- Dataset-related eventsReport- Report generation eventsLoad- Data loading eventsPump- Data pumping eventsEntity- Entity-related eventsField- Field-related eventsLabel- Label-related events
Storage and Retention
Events are stored in a MongoDB collection named "events". Based on the code review, there doesn't appear to be an automatic TTL (Time To Live) mechanism configured for events, suggesting they are stored indefinitely until manually removed.
Navigation Links
The client-side event store builds navigation links for different event types to direct users to the relevant sections of the application:
- Scan/Discover events: Navigate to job details page
- Dataset events: Navigate to datasets page (for add action) or job details page
- Load/Pump events: Navigate to job details page
- Rule events: Navigate to rule details page
- Model events: Navigate to model page
- Report events: Navigate to audit report page
Real-time Updates
Events are published in real-time using GraphQL subscriptions. The client-side event store subscribes to new events and updates the UI notification system accordingly.