Skip to main content

xmtp_common/
event_logging.rs

1mod utils;
2pub use utils::*;
3
4#[xmtp_macro::build_logging_metadata]
5pub enum Event {
6    // ===================== General Client =====================
7    /// Client created.
8    #[context(
9        device_sync_enabled,
10        disabled_workers,
11        inbox_id,
12        full_installation_id,
13        icon = "⬆️"
14    )]
15    ClientCreated,
16    /// Client dropped.
17    #[context(icon = "⬇️")]
18    ClientDropped,
19    /// Client cleanly closed via `Client::close`.
20    #[context(icon = "🔒")]
21    ClientClosed,
22    /// Associating name with installation.
23    #[context(name)]
24    AssociateName,
25
26    // ===================== Group Operations =====================
27    /// DM created.
28    #[context(group_id, target_inbox)]
29    CreatedDM,
30    /// Group created.
31    #[context(group_id)]
32    CreatedGroup,
33    /// Added members to group.
34    #[context(group_id, members, epoch, icon = "➕")]
35    AddedMembers,
36    /// Received new group from welcome.
37    #[context(group_id, conversation_type, epoch, epoch_auth, icon = "🤝")]
38    ReceivedWelcome,
39
40    // ===================== MLS Operations =====================
41    /// Received staged commit. Merging and clearing any pending commits.
42    #[context(
43        group_id,
44        sender_installation_id,
45        message_epoch,
46        epoch,
47        hash,
48        icon = "❗"
49    )]
50    MLSReceivedStagedCommit,
51    /// Processed staged commit.
52    #[context(
53        group_id,
54        actor_installation_id,
55        epoch,
56        epoch_auth,
57        added_inboxes,
58        removed_inboxes,
59        left_inboxes,
60        metadata_changes,
61        cursor,
62        icon = "😮‍💨"
63    )]
64    MLSProcessedStagedCommit,
65    /// Received application message.
66    #[context(group_id, epoch, message_epoch, sender_inbox_id)]
67    MLSReceivedApplicationMessage,
68
69    // ===================== Network =====================
70    /// Stream started.
71    #[context(kind, icon = "🌊")]
72    StreamOpened,
73    /// Stream closed.
74    #[context(kind, icon = "🏜️")]
75    StreamClosed,
76
77    // ===================== Group Syncing =====================
78    /// Begin syncing group.
79    #[context(group_id, icon = "🔄")]
80    GroupSyncStart,
81    /// Syncing group.
82    #[context(group_id, attempt, backoff, icon = "🔃")]
83    GroupSyncAttempt,
84    /// Group sync complete.
85    #[context(group_id, summary, success, icon = "✅")]
86    GroupSyncFinished,
87    /// Attempted to sync on an inactive group.
88    #[context(group_id, icon = "⏸️")]
89    GroupSyncGroupInactive,
90    /// Intent failed to sync and will be retried.
91    #[context(group_id, intent_id, intent_kind, state, icon = "🔁")]
92    GroupSyncIntentRetry,
93    /// Intent was found to be in error after attempting to sync.
94    /// The summary is logged once by `GroupSyncFinished`; this only marks
95    /// which intent errored.
96    #[context(group_id, intent_id, intent_kind, icon = "⚠️")]
97    GroupSyncIntentErrored,
98    /// Attempt to publish intent failed.
99    #[context(group_id, intent_id, intent_kind, error, icon = "❌")]
100    GroupSyncPublishFailed,
101    /// Application message published successfully.
102    #[context(group_id, intent_id, icon = "📤")]
103    GroupSyncApplicationMessagePublishSuccess,
104    /// Commit published successfully.
105    #[context(group_id, intent_id, intent_kind, commit_hash, icon = "✨")]
106    GroupSyncCommitPublishSuccess,
107    /// Commit sent. Staged commit is present. Stopping further publishes for this round.
108    #[context(group_id, hash, icon = "🛑")]
109    GroupSyncStagedCommitPresent,
110    /// Updating group cursor.
111    #[context(group_id, cursor, icon = "📍")]
112    GroupCursorUpdate,
113
114    // ===================== Group Membership =====================
115    /// Updated group membership.
116    #[context(group_id, added_installations, removed_installations, icon = "🫂")]
117    UpdatedGroupMembership,
118
119    // ===================== Device Sync =====================
120    /// Device Sync worker initializing.
121    DeviceSyncInitializing,
122    /// Device sync initialized.
123    DeviceSyncInitializingFinished,
124    /// No primary sync group found.
125    DeviceSyncNoPrimarySyncGroup,
126    /// Created primary sync group.
127    #[context(group_id)]
128    DeviceSyncCreatedPrimarySyncGroup,
129    /// Processing new sync message.
130    #[context(msg_type, external, message_id, group_id)]
131    DeviceSyncProcessingMessages,
132    /// Failed to process device sync message.
133    #[context(message_id, error)]
134    DeviceSyncMessageProcessingError,
135
136    // ===================== AppData Migration =====================
137    /// `enable_proposals` started — pre-flight passed, about to publish
138    /// the legacy-GMM bump (step A) and/or bootstrap commit (step B).
139    #[context(group_id, min_version, force, icon = "🌱")]
140    EnableProposalsStart,
141    /// `enable_proposals` completed. `already_migrated = true` means
142    /// the call was a no-op fast-path; `false` means a bootstrap
143    /// commit was actually published.
144    #[context(group_id, already_migrated, min_version, icon = "🌳")]
145    EnableProposalsCompleted,
146}