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(group_id, sender_installation_id, msg_epoch, epoch, hash, icon = "❗")]
43 MLSReceivedStagedCommit,
44 /// Processed staged commit.
45 #[context(
46 group_id,
47 actor_installation_id,
48 epoch,
49 epoch_auth,
50 added_inboxes,
51 removed_inboxes,
52 left_inboxes,
53 metadata_changes,
54 cursor,
55 originator,
56 icon = "😮💨"
57 )]
58 MLSProcessedStagedCommit,
59 /// Received application message.
60 #[context(group_id, epoch, msg_epoch, sender_inbox_id)]
61 MLSReceivedApplicationMessage,
62
63 // ===================== Network =====================
64 /// Stream started.
65 #[context(kind, icon = "🌊")]
66 StreamOpened,
67 /// Stream closed.
68 #[context(kind, icon = "🏜️")]
69 StreamClosed,
70
71 // ===================== Group Syncing =====================
72 /// Begin syncing group.
73 #[context(group_id, icon = "🔄")]
74 GroupSyncStart,
75 /// Syncing group.
76 #[context(group_id, attempt, backoff, icon = "🔃")]
77 GroupSyncAttempt,
78 /// Group sync complete.
79 #[context(group_id, summary, success, icon = "✅")]
80 GroupSyncFinished,
81 /// Attempted to sync on an inactive group.
82 #[context(group_id, icon = "⏸️")]
83 GroupSyncGroupInactive,
84 /// Intent failed to sync and will be retried.
85 #[context(group_id, intent_id, intent_kind, state, icon = "🔁")]
86 GroupSyncIntentRetry,
87 /// Intent was found to be in error after attempting to sync.
88 /// The summary is logged once by `GroupSyncFinished`; this only marks
89 /// which intent errored.
90 #[context(group_id, intent_id, intent_kind, icon = "⚠️")]
91 GroupSyncIntentErrored,
92 /// Attempt to publish intent failed.
93 #[context(group_id, intent_id, intent_kind, err, icon = "❌")]
94 GroupSyncPublishFailed,
95 /// Application message published successfully.
96 #[context(group_id, intent_id, icon = "📤")]
97 GroupSyncApplicationMessagePublishSuccess,
98 /// Commit published successfully.
99 #[context(group_id, intent_id, intent_kind, commit_hash, icon = "✨")]
100 GroupSyncCommitPublishSuccess,
101 /// Commit sent. Staged commit is present. Stopping further publishes for this round.
102 #[context(group_id, hash, icon = "🛑")]
103 GroupSyncStagedCommitPresent,
104 /// Updating group cursor.
105 #[context(group_id, cursor, originator, icon = "📍")]
106 GroupCursorUpdate,
107
108 // ===================== Group Membership =====================
109 /// Updated group membership.
110 #[context(group_id, added_installations, removed_installations, icon = "🫂")]
111 UpdatedGroupMembership,
112
113 // ===================== Device Sync =====================
114 /// Device Sync worker initializing.
115 DeviceSyncInitializing,
116 /// Device sync initialized.
117 DeviceSyncInitializingFinished,
118 /// No primary sync group found.
119 DeviceSyncNoPrimarySyncGroup,
120 /// Created primary sync group.
121 #[context(group_id)]
122 DeviceSyncCreatedPrimarySyncGroup,
123 /// Sent a sync request.
124 #[context(group_id)]
125 DeviceSyncSentSyncRequest,
126 /// Processing new sync message.
127 #[context(msg_type, external, msg_id, group_id)]
128 DeviceSyncProcessingMessages,
129 /// Failed to process device sync message.
130 #[context(msg_id, err)]
131 DeviceSyncMessageProcessingError,
132 /// Processing sync archive.
133 #[context(msg_id, group_id)]
134 DeviceSyncArchiveProcessingStart,
135 /// Received a V1 sync payload. V1 is no longer supported. Ignoring.
136 DeviceSyncV1Archive,
137 /// Received a sync archive message, but it was not requested by this instalaltion. Skipping.
138 DeviceSyncArchiveNotRequested,
139 /// Downloading sync archive.
140 DeviceSyncArchiveDownloading,
141 /// Sync archive download failure.
142 #[context(status, err)]
143 DeviceSyncPayloadDownloadFailure,
144 /// Beginning archive import.
145 DeviceSyncArchiveImportStart,
146 /// Finished sync archive import.
147 DeviceSyncArchiveImportSuccess,
148 /// Archive import failed.
149 #[context(err)]
150 DeviceSyncArchiveImportFailure,
151 /// Attempted to acknowledge a sync request, but it was already acknowledged
152 /// by another installation.
153 #[context(pin, acknowledged_by)]
154 DeviceSyncRequestAlreadyAcknowledged,
155 /// Acknowledged sync request.
156 #[context(pin)]
157 DeviceSyncRequestAcknowledged,
158 /// Scheduled task to respond to sync request.
159 #[context(pin)]
160 DeviceSyncResponseTaskScheduled,
161 /// Sending sync archive.
162 #[context(group_id, server_url)]
163 DeviceSyncArchiveUploadStart,
164 /// Failed to send sync archive.
165 #[context(group_id, pin, err)]
166 DeviceSyncArchiveUploadFailure,
167 /// Archive upload complete.
168 #[context(group_id)]
169 DeviceSyncArchiveUploadComplete,
170 /// Cannot send sync archive. No server_url present.
171 #[context(pin)]
172 DeviceSyncNoServerUrl,
173
174 // ===================== AppData Migration =====================
175 /// `enable_proposals` started — pre-flight passed, about to publish
176 /// the legacy-GMM bump (step A) and/or bootstrap commit (step B).
177 #[context(group_id, min_version, force, icon = "🌱")]
178 EnableProposalsStart,
179 /// `enable_proposals` completed. `already_migrated = true` means
180 /// the call was a no-op fast-path; `false` means a bootstrap
181 /// commit was actually published.
182 #[context(group_id, already_migrated, min_version, icon = "🌳")]
183 EnableProposalsCompleted,
184}