@@ -165,11 +165,19 @@ export interface Client<O extends ClientOptions = ClientOptions> {
165
165
166
166
// HOOKS
167
167
// TODO(v8): Make the hooks non-optional.
168
+ /* eslint-disable @typescript-eslint/unified-signatures */
168
169
169
170
/**
170
- * Register a callback for transaction start and finish.
171
+ * Register a callback for transaction start.
172
+ * Receives the transaction as argument.
171
173
*/
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 ;
173
181
174
182
/**
175
183
* Register a callback for transaction start and finish.
@@ -178,14 +186,17 @@ export interface Client<O extends ClientOptions = ClientOptions> {
178
186
179
187
/**
180
188
* 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.
183
190
* Receives an Event & EventHint as arguments.
184
191
*/
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 ;
189
200
190
201
/**
191
202
* Register a callback for when an event has been sent.
@@ -212,10 +223,16 @@ export interface Client<O extends ClientOptions = ClientOptions> {
212
223
on ?( hook : 'otelSpanEnd' , callback : ( otelSpan : unknown , mutableOptions : { drop : boolean } ) => void ) : void ;
213
224
214
225
/**
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.
217
228
*/
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 ;
219
236
220
237
/*
221
238
* 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> {
225
242
226
243
/**
227
244
* 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.
230
246
* Expects to be given an Event & EventHint as the second/third argument.
231
247
*/
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 ;
233
255
234
256
/*
235
257
* 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> {
253
275
* The option argument may be mutated to drop the span.
254
276
*/
255
277
emit ?( hook : 'otelSpanEnd' , otelSpan : unknown , mutableOptions : { drop : boolean } ) : void ;
278
+
279
+ /* eslint-enable @typescript-eslint/unified-signatures */
256
280
}
0 commit comments