diff --git a/packages/core/src/tools/experimentalFeatures.ts b/packages/core/src/tools/experimentalFeatures.ts index 1fc658d946..4fd2d66288 100644 --- a/packages/core/src/tools/experimentalFeatures.ts +++ b/packages/core/src/tools/experimentalFeatures.ts @@ -15,7 +15,6 @@ import { objectHasValue } from './utils/objectUtils' // eslint-disable-next-line no-restricted-syntax export enum ExperimentalFeature { TRACK_INTAKE_REQUESTS = 'track_intake_requests', - FEATURE_OPERATION_VITAL = 'feature_operation_vital', TOO_MANY_REQUESTS_INVESTIGATION = 'too_many_requests_investigation', SESSION_RENEWAL_DEBUG_CONTEXT = 'session_renewal_debug_context', } diff --git a/packages/rum-core/src/boot/rumPublicApi.ts b/packages/rum-core/src/boot/rumPublicApi.ts index 6e97d35d96..3d218facc3 100644 --- a/packages/rum-core/src/boot/rumPublicApi.ts +++ b/packages/rum-core/src/boot/rumPublicApi.ts @@ -517,33 +517,43 @@ export interface RumPublicApi extends PublicApi { stopDurationVital: (name: string, options?: DurationVitalOptions) => void /** - * start a feature operation + * Start a feature operation. + * + * Call {@link succeedFeatureOperation} or {@link failFeatureOperation} with the same name (and optional + * `operationKey`) to send a RUM vital event marking the end of the operation. * * @category Vital - Feature Operation - * @param name - Name of the operation step - * @param options - Options for the operation step (operationKey, context, description) - * @hidden // TODO: replace by @since when GA + * @param name - Name of the operation + * @param options - Options for the operation (operationKey, context, description) + * @example + * ```ts + * datadogRum.startFeatureOperation('checkout') + * // ... perform the operation + * datadogRum.succeedFeatureOperation('checkout') + * ``` */ startFeatureOperation: (name: string, options?: FeatureOperationOptions) => void /** - * succeed a feature operation + * Mark a feature operation as successful. + * + * Sends a RUM vital event marking the end of the operation started with {@link startFeatureOperation}. * * @category Vital - Feature Operation - * @param name - Name of the operation step - * @param options - Options for the operation step (operationKey, context, description) - * @hidden // TODO: replace by @since when GA + * @param name - Name of the operation + * @param options - Options for the operation (operationKey, context, description) */ succeedFeatureOperation: (name: string, options?: FeatureOperationOptions) => void /** - * fail a feature operation + * Mark a feature operation as failed. + * + * Sends a RUM vital event marking the end of the operation started with {@link startFeatureOperation}. * * @category Vital - Feature Operation - * @param name - Name of the operation step + * @param name - Name of the operation * @param failureReason - Reason for the failure - * @param options - Options for the operation step (operationKey, context, description) - * @hidden // TODO: replace by @since when GA + * @param options - Options for the operation (operationKey, context, description) */ failFeatureOperation: (name: string, failureReason: FailureReason, options?: FeatureOperationOptions) => void diff --git a/packages/rum-core/src/domain/vital/vitalCollection.spec.ts b/packages/rum-core/src/domain/vital/vitalCollection.spec.ts index d7f68c4cf9..e0408f4c27 100644 --- a/packages/rum-core/src/domain/vital/vitalCollection.spec.ts +++ b/packages/rum-core/src/domain/vital/vitalCollection.spec.ts @@ -1,6 +1,6 @@ import type { Duration } from '@datadog/browser-core' import { mockClock, type Clock } from '@datadog/browser-core/test' -import { addExperimentalFeatures, clocksNow, ExperimentalFeature, generateUUID } from '@datadog/browser-core' +import { clocksNow, generateUUID } from '@datadog/browser-core' import { collectAndValidateRawRumEvents, mockPageStateHistory } from '../../../test' import type { RawRumEvent, RawRumVitalEvent } from '../../rawRumEvent.types' import { VitalType, RumEventType } from '../../rawRumEvent.types' @@ -221,7 +221,6 @@ describe('vitalCollection', () => { describe('operation step vital', () => { it('should collect raw rum event from operation step vital', () => { - addExperimentalFeatures([ExperimentalFeature.FEATURE_OPERATION_VITAL]) vitalCollection.addOperationStepVital('foo', 'start') expect(rawRumEvents[0].startClocks.relative).toEqual(jasmine.any(Number)) @@ -243,7 +242,6 @@ describe('vitalCollection', () => { }) it('should create operation step vital with handling stack in domainContext', () => { - addExperimentalFeatures([ExperimentalFeature.FEATURE_OPERATION_VITAL]) vitalCollection.addOperationStepVital('foo', 'start', { handlingStack: 'Error\n at foo\n at bar', }) @@ -254,7 +252,6 @@ describe('vitalCollection', () => { }) it('should create a operation step vital from add API', () => { - addExperimentalFeatures([ExperimentalFeature.FEATURE_OPERATION_VITAL]) vitalCollection.addOperationStepVital( 'foo', 'end', diff --git a/packages/rum-core/src/domain/vital/vitalCollection.ts b/packages/rum-core/src/domain/vital/vitalCollection.ts index 6113e2f5c8..f8e24e7973 100644 --- a/packages/rum-core/src/domain/vital/vitalCollection.ts +++ b/packages/rum-core/src/domain/vital/vitalCollection.ts @@ -1,12 +1,5 @@ import type { ClocksState, Duration } from '@datadog/browser-core' -import { - clocksNow, - ExperimentalFeature, - generateUUID, - isExperimentalFeatureEnabled, - sanitize, - toServerDuration, -} from '@datadog/browser-core' +import { clocksNow, generateUUID, sanitize, toServerDuration } from '@datadog/browser-core' import type { LifeCycle, RawRumEventCollectedData } from '../lifeCycle' import { LifeCycleEventType } from '../lifeCycle' import type { RawRumVitalEvent } from '../../rawRumEvent.types' @@ -113,10 +106,6 @@ export function startVitalCollection(lifeCycle: LifeCycle, pageStateHistory: Pag options?: FeatureOperationOptions & { handlingStack?: string }, failureReason?: FailureReason ) { - if (!isExperimentalFeatureEnabled(ExperimentalFeature.FEATURE_OPERATION_VITAL)) { - return - } - const { operationKey, context, description, handlingStack } = options || {} const vital: OperationStepVital = { diff --git a/test/e2e/scenario/microfrontend.scenario.ts b/test/e2e/scenario/microfrontend.scenario.ts index 0f9f7b3fb4..005ccc91d1 100644 --- a/test/e2e/scenario/microfrontend.scenario.ts +++ b/test/e2e/scenario/microfrontend.scenario.ts @@ -1,7 +1,6 @@ import type { RumEvent, RumEventDomainContext, RumInitConfiguration } from '@datadog/browser-rum-core' import type { LogsEvent, LogsInitConfiguration, LogsEventDomainContext } from '@datadog/browser-logs' import { test, expect } from '@playwright/test' -import { ExperimentalFeature } from '@datadog/browser-core' import { createTest, microfrontendSetup } from '../lib/framework' import { isLongAnimationFrameSupported } from '../lib/helpers/browser' @@ -184,7 +183,7 @@ test.describe('microfrontend', () => { }) createTest('expose handling stack for DD_RUM.startFeatureOperation') - .withRum({ ...RUM_CONFIG, enableExperimentalFeatures: [ExperimentalFeature.FEATURE_OPERATION_VITAL] }) + .withRum({ ...RUM_CONFIG }) .withRumInit((configuration) => { window.DD_RUM!.init(configuration) @@ -412,7 +411,7 @@ test.describe('microfrontend', () => { }) createTest('feature operations should have service and version from source code context') - .withRum({ ...RUM_CONFIG, enableExperimentalFeatures: [ExperimentalFeature.FEATURE_OPERATION_VITAL] }) + .withRum({ ...RUM_CONFIG }) .withSetup(microfrontendSetup) .run(async ({ intakeRegistry, flushEvents, page }) => { await page.click('#app1-feature-operation') diff --git a/test/e2e/scenario/rum/vitals.scenario.ts b/test/e2e/scenario/rum/vitals.scenario.ts index af3734e950..1dfd1d9102 100644 --- a/test/e2e/scenario/rum/vitals.scenario.ts +++ b/test/e2e/scenario/rum/vitals.scenario.ts @@ -1,5 +1,4 @@ import { test, expect } from '@playwright/test' -import { ExperimentalFeature } from '@datadog/browser-core' import { createTest } from '../../lib/framework' test.describe('vital collection', () => { @@ -46,9 +45,7 @@ test.describe('vital collection', () => { }) createTest('send operation step vital') - .withRum({ - enableExperimentalFeatures: [ExperimentalFeature.FEATURE_OPERATION_VITAL], - }) + .withRum() .run(async ({ flushEvents, intakeRegistry, page }) => { await page.evaluate(() => { window.DD_RUM!.startFeatureOperation('foo')