@@ -43,8 +43,10 @@ import type { RumConfiguration, RumInitConfiguration } from '../domain/configura
4343import type { ViewOptions } from '../domain/view/trackViews'
4444import type {
4545 AddDurationVitalOptions ,
46- DurationVitalOptions ,
4746 DurationVitalReference ,
47+ DurationVitalOptions ,
48+ FeatureOperationOptions ,
49+ FailureReason ,
4850} from '../domain/vital/vitalCollection'
4951import { createCustomVitalsState } from '../domain/vital/vitalCollection'
5052import { callPluginsMethod } from '../domain/plugins'
@@ -425,9 +427,37 @@ export interface RumPublicApi extends PublicApi {
425427 *
426428 * @category Vital
427429 * @param nameOrRef - Name or reference of the custom vital
428- * @param options - Options for the custom vital (context, description)
430+ * @param options - Options for the custom vital (operationKey, context, description)
429431 */
430432 stopDurationVital : ( nameOrRef : string | DurationVitalReference , options ?: DurationVitalOptions ) => void
433+
434+ /**
435+ * [Experimental] start a feature operation
436+ *
437+ * @category Vital
438+ * @param name - Name of the operation step
439+ * @param options - Options for the operation step (operationKey, context, description)
440+ */
441+ startFeatureOperation : ( name : string , options ?: FeatureOperationOptions ) => void
442+
443+ /**
444+ * [Experimental] succeed a feature operation
445+ *
446+ * @category Vital
447+ * @param name - Name of the operation step
448+ * @param options - Options for the operation step (operationKey, context, description)
449+ */
450+ succeedFeatureOperation : ( name : string , options ?: FeatureOperationOptions ) => void
451+
452+ /**
453+ * [Experimental] fail a feature operation
454+ *
455+ * @category Vital
456+ * @param name - Name of the operation step
457+ * @param failureReason
458+ * @param options - Options for the operation step (operationKey, context, description)
459+ */
460+ failFeatureOperation : ( name : string , failureReaon : FailureReason , options ?: FeatureOperationOptions ) => void
431461}
432462
433463export interface RecorderApi {
@@ -496,6 +526,7 @@ export interface Strategy {
496526 startDurationVital : StartRumResult [ 'startDurationVital' ]
497527 stopDurationVital : StartRumResult [ 'stopDurationVital' ]
498528 addDurationVital : StartRumResult [ 'addDurationVital' ]
529+ addOperationStepVital : StartRumResult [ 'addOperationStepVital' ]
499530}
500531
501532export function makeRumPublicApi (
@@ -773,6 +804,21 @@ export function makeRumPublicApi(
773804 description : sanitize ( options && options . description ) as string | undefined ,
774805 } )
775806 } ) ,
807+
808+ startFeatureOperation : monitor ( ( name , options ) => {
809+ addTelemetryUsage ( { feature : 'add-operation-step-vital' , action_type : 'start' } )
810+ strategy . addOperationStepVital ( name , 'start' , options )
811+ } ) ,
812+
813+ succeedFeatureOperation : monitor ( ( name , options ) => {
814+ addTelemetryUsage ( { feature : 'add-operation-step-vital' , action_type : 'succeed' } )
815+ strategy . addOperationStepVital ( name , 'end' , options )
816+ } ) ,
817+
818+ failFeatureOperation : monitor ( ( name , failureReason , options ) => {
819+ addTelemetryUsage ( { feature : 'add-operation-step-vital' , action_type : 'fail' } )
820+ strategy . addOperationStepVital ( name , 'end' , options , failureReason )
821+ } ) ,
776822 } )
777823
778824 return rumPublicApi
0 commit comments