@@ -34,8 +34,6 @@ import {
3434 CustomerContextKey ,
3535 defineContextMethod ,
3636 startBufferingData ,
37- isExperimentalFeatureEnabled ,
38- ExperimentalFeature ,
3937 mockable ,
4038 generateUUID ,
4139 timeStampNow ,
@@ -176,16 +174,29 @@ export interface RumPublicApi extends PublicApi {
176174 addAction : ( name : string , context ?: object ) => void
177175
178176 /**
179- * [Experimental] Start an action, stored in `@action`
177+ * Start tracking a custom action.
178+ *
179+ * Call {@link stopAction} with the same name (and optional `actionKey`) to send a RUM action event
180+ * with the elapsed duration. Errors and resources triggered between start and stop are associated
181+ * with the action.
180182 *
181183 * @category Data Collection
182184 * @param name - Name of the action
183185 * @param options - Options of the action (@default type: 'custom')
186+ * @example
187+ * ```ts
188+ * datadogRum.startAction('checkout', { context: { cartId: 'abc' } })
189+ * // ... user completes checkout
190+ * datadogRum.stopAction('checkout')
191+ * ```
184192 */
185193 startAction : ( name : string , options ?: ActionOptions ) => void
186194
187195 /**
188- * [Experimental] Stop an action, stored in `@action`
196+ * Stop tracking a custom action started with {@link startAction}.
197+ *
198+ * Sends a RUM action event with the elapsed duration since the matching start call. Context from
199+ * start and stop calls is merged into the event.
189200 *
190201 * @category Data Collection
191202 * @param name - Name of the action
@@ -194,16 +205,28 @@ export interface RumPublicApi extends PublicApi {
194205 stopAction : ( name : string , options ?: ActionOptions ) => void
195206
196207 /**
197- * [Experimental] Start tracking a resource, stored in `@resource`
208+ * Start tracking a resource manually.
209+ *
210+ * Use this for network activity that the SDK cannot automatically instrument. Call {@link stopResource}
211+ * with the same URL (and optional `resourceKey`) to send a RUM resource event with the elapsed duration.
198212 *
199213 * @category Data Collection
200214 * @param url - URL of the resource
201215 * @param options - Options of the resource (@default type: 'other')
216+ * @example
217+ * ```ts
218+ * datadogRum.startResource('https://api.example.com/users', { type: 'fetch', method: 'POST' })
219+ * // ... perform the request
220+ * datadogRum.stopResource('https://api.example.com/users', { statusCode: 201 })
221+ * ```
202222 */
203223 startResource : ( url : string , options ?: ResourceOptions ) => void
204224
205225 /**
206- * [Experimental] Stop tracking a resource, stored in `@resource`
226+ * Stop tracking a resource started with {@link startResource}.
227+ *
228+ * Sends a RUM resource event with the elapsed duration since the matching start call. Context from
229+ * start and stop calls is merged into the event.
207230 *
208231 * @category Data Collection
209232 * @param url - URL of the resource
@@ -727,11 +750,7 @@ export function makeRumPublicApi(
727750 } ,
728751
729752 startAction : monitor ( ( name , options ) => {
730- // Check feature flag only after init; pre-init calls should be buffered
731- if ( strategy . initConfiguration && ! isExperimentalFeatureEnabled ( ExperimentalFeature . START_STOP_ACTION ) ) {
732- return
733- }
734- // addTelemetryUsage({ feature: 'start-action' })
753+ addTelemetryUsage ( { feature : 'start-action' } )
735754 strategy . startAction ( sanitize ( name ) ! , {
736755 type : sanitize ( options && options . type ) as ActionType | undefined ,
737756 context : sanitize ( options && options . context ) as Context ,
@@ -740,10 +759,7 @@ export function makeRumPublicApi(
740759 } ) ,
741760
742761 stopAction : monitor ( ( name , options ) => {
743- if ( strategy . initConfiguration && ! isExperimentalFeatureEnabled ( ExperimentalFeature . START_STOP_ACTION ) ) {
744- return
745- }
746- // addTelemetryUsage({ feature: 'stop-action' })
762+ addTelemetryUsage ( { feature : 'stop-action' } )
747763 strategy . stopAction ( sanitize ( name ) ! , {
748764 type : sanitize ( options && options . type ) as ActionType | undefined ,
749765 context : sanitize ( options && options . context ) as Context ,
@@ -752,11 +768,7 @@ export function makeRumPublicApi(
752768 } ) ,
753769
754770 startResource : monitor ( ( url , options ) => {
755- // Check feature flag only after init; pre-init calls should be buffered
756- if ( strategy . initConfiguration && ! isExperimentalFeatureEnabled ( ExperimentalFeature . START_STOP_RESOURCE ) ) {
757- return
758- }
759- // addTelemetryUsage({ feature: 'start-resource' })
771+ addTelemetryUsage ( { feature : 'start-resource' } )
760772 strategy . startResource ( sanitize ( url ) ! , {
761773 type : sanitize ( options && options . type ) as ResourceType | undefined ,
762774 method : sanitize ( options && options . method ) as string | undefined ,
@@ -766,10 +778,7 @@ export function makeRumPublicApi(
766778 } ) ,
767779
768780 stopResource : monitor ( ( url , options ) => {
769- if ( strategy . initConfiguration && ! isExperimentalFeatureEnabled ( ExperimentalFeature . START_STOP_RESOURCE ) ) {
770- return
771- }
772- // addTelemetryUsage({ feature: 'stop-resource' })
781+ addTelemetryUsage ( { feature : 'stop-resource' } )
773782 strategy . stopResource ( sanitize ( url ) ! , {
774783 type : sanitize ( options && options . type ) as ResourceType | undefined ,
775784 statusCode : options && options . statusCode ,
0 commit comments