Skip to content

Commit 468fc8c

Browse files
authored
feat(flags): add node support for generic featureFlagsIntegration and move utils to core (#16585)
The `featureFlagsIntegration` is an integration to manually buffer feature flags on evaluation, and capture them in event contexts and span attributes. This PR moves it from browser to core, as well as the shared functionality/utils of all FF integrations (no browser specific logic). Browser exports and functionality is unchanged. Per @AbhiPrasad 's recommendation I've manually exported the integration in all the packages `zodErrorsIntegration` is exported. Note many backend pkgs use a wildcard (*) export from node. TODO: - [x] add node-integration-tests - [ ] update platform docs Part of - getsentry/team-replay#510
1 parent 98ee4cc commit 468fc8c

File tree

40 files changed

+314
-79
lines changed

40 files changed

+314
-79
lines changed

dev-packages/browser-integration-tests/suites/integrations/featureFlags/constants.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

dev-packages/browser-integration-tests/suites/integrations/featureFlags/featureFlags/onError/basic/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { expect } from '@playwright/test';
2+
import { _INTERNAL_FLAG_BUFFER_SIZE as FLAG_BUFFER_SIZE } from '@sentry/core';
23
import { sentryTest } from '../../../../../../utils/fixtures';
34
import {
45
envelopeRequestParser,
56
shouldSkipFeatureFlagsTest,
67
waitForErrorRequest,
78
} from '../../../../../../utils/helpers';
8-
import { FLAG_BUFFER_SIZE } from '../../../constants';
99

1010
sentryTest('Basic test with eviction, update, and no async tasks', async ({ getLocalTestUrl, page }) => {
1111
if (shouldSkipFeatureFlagsTest()) {

dev-packages/browser-integration-tests/suites/integrations/featureFlags/featureFlags/onSpan/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { expect } from '@playwright/test';
2+
import { _INTERNAL_MAX_FLAGS_PER_SPAN as MAX_FLAGS_PER_SPAN } from '@sentry/core';
23
import { sentryTest } from '../../../../../utils/fixtures';
34
import {
45
type EventAndTraceHeader,
@@ -7,7 +8,6 @@ import {
78
shouldSkipFeatureFlagsTest,
89
shouldSkipTracingTest,
910
} from '../../../../../utils/helpers';
10-
import { MAX_FLAGS_PER_SPAN } from '../../constants';
1111

1212
sentryTest("Feature flags are added to active span's attributes on span end.", async ({ getLocalTestUrl, page }) => {
1313
if (shouldSkipFeatureFlagsTest() || shouldSkipTracingTest()) {

dev-packages/browser-integration-tests/suites/integrations/featureFlags/launchdarkly/onError/basic/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { expect } from '@playwright/test';
2+
import { _INTERNAL_FLAG_BUFFER_SIZE as FLAG_BUFFER_SIZE } from '@sentry/core';
23
import { sentryTest } from '../../../../../../utils/fixtures';
34
import {
45
envelopeRequestParser,
56
shouldSkipFeatureFlagsTest,
67
waitForErrorRequest,
78
} from '../../../../../../utils/helpers';
8-
import { FLAG_BUFFER_SIZE } from '../../../constants';
99

1010
sentryTest('Basic test with eviction, update, and no async tasks', async ({ getLocalTestUrl, page }) => {
1111
if (shouldSkipFeatureFlagsTest()) {

dev-packages/browser-integration-tests/suites/integrations/featureFlags/launchdarkly/onSpan/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { expect } from '@playwright/test';
2+
import { _INTERNAL_MAX_FLAGS_PER_SPAN as MAX_FLAGS_PER_SPAN } from '@sentry/core';
23
import { sentryTest } from '../../../../../utils/fixtures';
34
import {
45
type EventAndTraceHeader,
@@ -7,7 +8,6 @@ import {
78
shouldSkipFeatureFlagsTest,
89
shouldSkipTracingTest,
910
} from '../../../../../utils/helpers';
10-
import { MAX_FLAGS_PER_SPAN } from '../../constants';
1111

1212
sentryTest("Feature flags are added to active span's attributes on span end.", async ({ getLocalTestUrl, page }) => {
1313
if (shouldSkipFeatureFlagsTest() || shouldSkipTracingTest()) {

dev-packages/browser-integration-tests/suites/integrations/featureFlags/openfeature/onError/basic/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { expect } from '@playwright/test';
2+
import { _INTERNAL_FLAG_BUFFER_SIZE as FLAG_BUFFER_SIZE } from '@sentry/core';
23
import { sentryTest } from '../../../../../../utils/fixtures';
34
import {
45
envelopeRequestParser,
56
shouldSkipFeatureFlagsTest,
67
waitForErrorRequest,
78
} from '../../../../../../utils/helpers';
8-
import { FLAG_BUFFER_SIZE } from '../../../constants';
99

1010
sentryTest('Basic test with eviction, update, and no async tasks', async ({ getLocalTestUrl, page }) => {
1111
if (shouldSkipFeatureFlagsTest()) {

dev-packages/browser-integration-tests/suites/integrations/featureFlags/openfeature/onError/errorHook/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { expect } from '@playwright/test';
2+
import { _INTERNAL_FLAG_BUFFER_SIZE as FLAG_BUFFER_SIZE } from '@sentry/core';
23
import { sentryTest } from '../../../../../../utils/fixtures';
34
import {
45
envelopeRequestParser,
56
shouldSkipFeatureFlagsTest,
67
waitForErrorRequest,
78
} from '../../../../../../utils/helpers';
8-
import { FLAG_BUFFER_SIZE } from '../../../constants';
99

1010
sentryTest('Flag evaluation error hook', async ({ getLocalTestUrl, page }) => {
1111
if (shouldSkipFeatureFlagsTest()) {

dev-packages/browser-integration-tests/suites/integrations/featureFlags/openfeature/onSpan/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { expect } from '@playwright/test';
2+
import { _INTERNAL_MAX_FLAGS_PER_SPAN as MAX_FLAGS_PER_SPAN } from '@sentry/core';
23
import { sentryTest } from '../../../../../utils/fixtures';
34
import {
45
type EventAndTraceHeader,
@@ -7,7 +8,6 @@ import {
78
shouldSkipFeatureFlagsTest,
89
shouldSkipTracingTest,
910
} from '../../../../../utils/helpers';
10-
import { MAX_FLAGS_PER_SPAN } from '../../constants';
1111

1212
sentryTest("Feature flags are added to active span's attributes on span end.", async ({ getLocalTestUrl, page }) => {
1313
if (shouldSkipFeatureFlagsTest() || shouldSkipTracingTest()) {

dev-packages/browser-integration-tests/suites/integrations/featureFlags/statsig/onError/basic/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { expect } from '@playwright/test';
2+
import { _INTERNAL_FLAG_BUFFER_SIZE as FLAG_BUFFER_SIZE } from '@sentry/core';
23
import { sentryTest } from '../../../../../../utils/fixtures';
34
import {
45
envelopeRequestParser,
56
shouldSkipFeatureFlagsTest,
67
waitForErrorRequest,
78
} from '../../../../../../utils/helpers';
8-
import { FLAG_BUFFER_SIZE } from '../../../constants';
99

1010
sentryTest('Basic test with eviction, update, and no async tasks', async ({ getLocalTestUrl, page }) => {
1111
if (shouldSkipFeatureFlagsTest()) {

dev-packages/browser-integration-tests/suites/integrations/featureFlags/statsig/onSpan/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { expect } from '@playwright/test';
2+
import { _INTERNAL_MAX_FLAGS_PER_SPAN as MAX_FLAGS_PER_SPAN } from '@sentry/core';
23
import { sentryTest } from '../../../../../utils/fixtures';
34
import {
45
type EventAndTraceHeader,
@@ -7,7 +8,6 @@ import {
78
shouldSkipFeatureFlagsTest,
89
shouldSkipTracingTest,
910
} from '../../../../../utils/helpers';
10-
import { MAX_FLAGS_PER_SPAN } from '../../constants';
1111

1212
sentryTest("Feature flags are added to active span's attributes on span end.", async ({ getLocalTestUrl, page }) => {
1313
if (shouldSkipFeatureFlagsTest() || shouldSkipTracingTest()) {

0 commit comments

Comments
 (0)