@@ -165,11 +165,19 @@ export interface Client<O extends ClientOptions = ClientOptions> {
165165
166166 // HOOKS
167167 // TODO(v8): Make the hooks non-optional.
168+ /* eslint-disable @typescript-eslint/unified-signatures */
168169
169170 /**
170- * Register a callback for transaction start and finish.
171+ * Register a callback for transaction start.
172+ * Receives the transaction as argument.
171173 */
172- on ?( hook : 'startTransaction' | 'finishTransaction' , callback : ( transaction : Transaction ) => void ) : void ;
174+ on ?( hook : 'startTransaction' , callback : ( transaction : Transaction ) => void ) : void ;
175+
176+ /**
177+ * Register a callback for transaction finish.
178+ * Receives the transaction as argument.
179+ */
180+ on ?( hook : 'finishTransaction' , callback : ( transaction : Transaction ) => void ) : void ;
173181
174182 /**
175183 * Register a callback for transaction start and finish.
@@ -178,14 +186,17 @@ export interface Client<O extends ClientOptions = ClientOptions> {
178186
179187 /**
180188 * Register a callback for before sending an event.
181- * `beforeSendEvent` is called right before an event is sent and should not be used to mutate the event.
182- * `preprocessEvent` is called before all global event processors.
189+ * This is called right before an event is sent and should not be used to mutate the event.
183190 * Receives an Event & EventHint as arguments.
184191 */
185- on ?(
186- hook : 'beforeSendEvent' | 'preprocessEvent' ,
187- callback : ( event : Event , hint ?: EventHint | undefined ) => void ,
188- ) : void ;
192+ on ?( hook : 'beforeSendEvent' , callback : ( event : Event , hint ?: EventHint | undefined ) => void ) : void ;
193+
194+ /**
195+ * Register a callback for preprocessing an event,
196+ * before it is passed to (global) event processors.
197+ * Receives an Event & EventHint as arguments.
198+ */
199+ on ?( hook : 'preprocessEvent' , callback : ( event : Event , hint ?: EventHint | undefined ) => void ) : void ;
189200
190201 /**
191202 * Register a callback for when an event has been sent.
@@ -212,10 +223,16 @@ export interface Client<O extends ClientOptions = ClientOptions> {
212223 on ?( hook : 'otelSpanEnd' , callback : ( otelSpan : unknown , mutableOptions : { drop : boolean } ) => void ) : void ;
213224
214225 /**
215- * Fire a hook event for transaction start and finish. Expects to be given a transaction as the
216- * second argument.
226+ * Fire a hook event for transaction start.
227+ * Expects to be given a transaction as the second argument.
217228 */
218- emit ?( hook : 'startTransaction' | 'finishTransaction' , transaction : Transaction ) : void ;
229+ emit ?( hook : 'startTransaction' , transaction : Transaction ) : void ;
230+
231+ /**
232+ * Fire a hook event for transaction finish.
233+ * Expects to be given a transaction as the second argument.
234+ */
235+ emit ?( hook : 'finishTransaction' , transaction : Transaction ) : void ;
219236
220237 /*
221238 * Fire a hook event for envelope creation and sending. Expects to be given an envelope as the
@@ -225,11 +242,16 @@ export interface Client<O extends ClientOptions = ClientOptions> {
225242
226243 /**
227244 * Fire a hook event before sending an event.
228- * `beforeSendEvent` is called right before an event is sent and should not be used to mutate the event.
229- * `preprocessEvent` is called before all global event processors.
245+ * This is called right before an event is sent and should not be used to mutate the event.
230246 * Expects to be given an Event & EventHint as the second/third argument.
231247 */
232- emit ?( hook : 'beforeSendEvent' | 'preprocessEvent' , event : Event , hint ?: EventHint ) : void ;
248+ emit ?( hook : 'beforeSendEvent' , event : Event , hint ?: EventHint ) : void ;
249+
250+ /**
251+ * Fire a hook event to process events before they are passed to (global) event processors.
252+ * Expects to be given an Event & EventHint as the second/third argument.
253+ */
254+ emit ?( hook : 'preprocessEvent' , event : Event , hint ?: EventHint ) : void ;
233255
234256 /*
235257 * Fire a hook event after sending an event. Expects to be given an Event as the
@@ -253,4 +275,6 @@ export interface Client<O extends ClientOptions = ClientOptions> {
253275 * The option argument may be mutated to drop the span.
254276 */
255277 emit ?( hook : 'otelSpanEnd' , otelSpan : unknown , mutableOptions : { drop : boolean } ) : void ;
278+
279+ /* eslint-enable @typescript-eslint/unified-signatures */
256280}
0 commit comments