@@ -42,8 +42,10 @@ import type { RumConfiguration, RumInitConfiguration } from '../domain/configura
42
42
import type { ViewOptions } from '../domain/view/trackViews'
43
43
import type {
44
44
AddDurationVitalOptions ,
45
- DurationVitalOptions ,
46
45
DurationVitalReference ,
46
+ DurationVitalOptions ,
47
+ FeatureOperationOptions ,
48
+ FailureReason ,
47
49
} from '../domain/vital/vitalCollection'
48
50
import { createCustomVitalsState } from '../domain/vital/vitalCollection'
49
51
import { callPluginsMethod } from '../domain/plugins'
@@ -424,9 +426,37 @@ export interface RumPublicApi extends PublicApi {
424
426
*
425
427
* @category Vital
426
428
* @param nameOrRef - Name or reference of the custom vital
427
- * @param options - Options for the custom vital (context, description)
429
+ * @param options - Options for the custom vital (operationKey, context, description)
428
430
*/
429
431
stopDurationVital : ( nameOrRef : string | DurationVitalReference , options ?: DurationVitalOptions ) => void
432
+
433
+ /**
434
+ * [Experimental] start a feature operation
435
+ *
436
+ * @category Vital
437
+ * @param name - Name of the operation step
438
+ * @param options - Options for the operation step (operationKey, context, description)
439
+ */
440
+ startFeatureOperation : ( name : string , options ?: FeatureOperationOptions ) => void
441
+
442
+ /**
443
+ * [Experimental] succeed a feature operation
444
+ *
445
+ * @category Vital
446
+ * @param name - Name of the operation step
447
+ * @param options - Options for the operation step (operationKey, context, description)
448
+ */
449
+ succeedFeatureOperation : ( name : string , options ?: FeatureOperationOptions ) => void
450
+
451
+ /**
452
+ * [Experimental] fail a feature operation
453
+ *
454
+ * @category Vital
455
+ * @param name - Name of the operation step
456
+ * @param failureReason
457
+ * @param options - Options for the operation step (operationKey, context, description)
458
+ */
459
+ failFeatureOperation : ( name : string , failureReaon : FailureReason , options ?: FeatureOperationOptions ) => void
430
460
}
431
461
432
462
export interface RecorderApi {
@@ -494,6 +524,7 @@ export interface Strategy {
494
524
startDurationVital : StartRumResult [ 'startDurationVital' ]
495
525
stopDurationVital : StartRumResult [ 'stopDurationVital' ]
496
526
addDurationVital : StartRumResult [ 'addDurationVital' ]
527
+ addOperationStepVital : StartRumResult [ 'addOperationStepVital' ]
497
528
}
498
529
499
530
export function makeRumPublicApi (
@@ -771,6 +802,21 @@ export function makeRumPublicApi(
771
802
description : sanitize ( options && options . description ) as string | undefined ,
772
803
} )
773
804
} ) ,
805
+
806
+ startFeatureOperation : monitor ( ( name , options ) => {
807
+ addTelemetryUsage ( { feature : 'add-operation-step-vital' , action_type : 'start' } )
808
+ strategy . addOperationStepVital ( name , 'start' , options )
809
+ } ) ,
810
+
811
+ succeedFeatureOperation : monitor ( ( name , options ) => {
812
+ addTelemetryUsage ( { feature : 'add-operation-step-vital' , action_type : 'succeed' } )
813
+ strategy . addOperationStepVital ( name , 'end' , options )
814
+ } ) ,
815
+
816
+ failFeatureOperation : monitor ( ( name , failureReason , options ) => {
817
+ addTelemetryUsage ( { feature : 'add-operation-step-vital' , action_type : 'fail' } )
818
+ strategy . addOperationStepVital ( name , 'end' , options , failureReason )
819
+ } ) ,
774
820
} )
775
821
776
822
return rumPublicApi
0 commit comments