Skip to content

Commit

Permalink
Remove collect_flush_reason ff
Browse files Browse the repository at this point in the history
  • Loading branch information
amortemousque committed May 21, 2024
1 parent 18f486c commit bce53cf
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 43 deletions.
26 changes: 0 additions & 26 deletions packages/core/src/domain/configuration/endpointBuilder.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import type { BuildEnvWindow } from '../../../test'
import {
ExperimentalFeature,
resetExperimentalFeatures,
addExperimentalFeatures,
} from '../../tools/experimentalFeatures'
import { startsWith } from '../../tools/utils/polyfills'
import type { Payload } from '../../transport'
import type { InitConfiguration } from './configuration'
Expand All @@ -18,7 +13,6 @@ describe('endpointBuilder', () => {
beforeEach(() => {
initConfiguration = { clientToken }
;(window as unknown as BuildEnvWindow).__BUILD_ENV__SDK_VERSION__ = 'some_version'
resetExperimentalFeatures()
})

describe('query parameters', () => {
Expand Down Expand Up @@ -125,31 +119,11 @@ describe('endpointBuilder', () => {
})
).toContain('retry_count%3A5%2Cretry_after%3A408')
})

it('should contain flush reason when ff collect_flush_reason is enabled', () => {
addExperimentalFeatures([ExperimentalFeature.COLLECT_FLUSH_REASON])
expect(
createEndpointBuilder(initConfiguration, 'rum', []).build('xhr', {
...DEFAULT_PAYLOAD,
flushReason: 'bytes_limit',
})
).toContain('flush_reason%3Abytes_limit')
})

it('should not contain flush reason when ff collect_flush_reason is disabled', () => {
expect(
createEndpointBuilder(initConfiguration, 'rum', []).build('xhr', {
...DEFAULT_PAYLOAD,
flushReason: 'bytes_limit',
})
).not.toContain('flush_reason')
})
})

describe('PCI compliance intake with option', () => {
beforeEach(() => {
;(window as unknown as BuildEnvWindow).__BUILD_ENV__SDK_VERSION__ = 'some_version'
resetExperimentalFeatures()
})

it('should return PCI compliance intake endpoint if site is us1', () => {
Expand Down
6 changes: 1 addition & 5 deletions packages/core/src/domain/configuration/endpointBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Payload } from '../../transport'
import { timeStampNow } from '../../tools/utils/timeUtils'
import { normalizeUrl } from '../../tools/utils/urlPolyfill'
import { ExperimentalFeature, isExperimentalFeatureEnabled } from '../../tools/experimentalFeatures'
import { generateUUID } from '../../tools/utils/stringUtils'
import type { InitConfiguration } from './configuration'
import { INTAKE_SITE_US1, INTAKE_SITE_FED_STAGING, PCI_INTAKE_HOST_US1 } from './intakeSites'
Expand Down Expand Up @@ -88,12 +87,9 @@ function buildEndpointParameters(
trackType: TrackType,
configurationTags: string[],
api: ApiType,
{ retry, flushReason, encoding }: Payload
{ retry, encoding }: Payload
) {
const tags = [`sdk_version:${__BUILD_ENV__SDK_VERSION__}`, `api:${api}`].concat(configurationTags)
if (flushReason && isExperimentalFeatureEnabled(ExperimentalFeature.COLLECT_FLUSH_REASON)) {
tags.push(`flush_reason:${flushReason}`)
}
if (retry) {
tags.push(`retry_count:${retry.count}`, `retry_after:${retry.lastFailureStatus}`)
}
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/tools/experimentalFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// string is an expected feature flag
// eslint-disable-next-line no-restricted-syntax
export enum ExperimentalFeature {
COLLECT_FLUSH_REASON = 'collect_flush_reason',
DISABLE_REPLAY_INLINE_CSS = 'disable_replay_inline_css',
WRITABLE_RESOURCE_GRAPHQL = 'writable_resource_graphql',
CUSTOM_VITALS = 'custom_vitals',
Expand Down
7 changes: 0 additions & 7 deletions packages/core/src/transport/batch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { display } from '../tools/display'
import type { Encoder } from '../tools/encoder'
import { createIdentityEncoder } from '../tools/encoder'
import { Batch } from './batch'
import type { FlushReason } from './flushController'
import type { HttpRequest } from './httpRequest'

describe('batch', () => {
Expand All @@ -21,7 +20,6 @@ describe('batch', () => {
sendOnExit: jasmine.Spy<HttpRequest['sendOnExit']>
}

const flushReason: FlushReason = 'bytes_limit'
let flushController: MockFlushController
let encoder: Encoder<string>

Expand All @@ -43,7 +41,6 @@ describe('batch', () => {
expect(transport.send.calls.mostRecent().args[0]).toEqual({
data: '{"message":"hello"}',
bytesCount: SMALL_MESSAGE_BYTES_COUNT,
flushReason,
encoding: undefined,
})
})
Expand Down Expand Up @@ -114,7 +111,6 @@ describe('batch', () => {
expect(transport.send.calls.mostRecent().args[0]).toEqual({
data: '{"message":"2"}\n{"message":"3"}\n{"message":"4"}',
bytesCount: jasmine.any(Number),
flushReason,
encoding: undefined,
})

Expand All @@ -126,7 +122,6 @@ describe('batch', () => {
expect(transport.send.calls.mostRecent().args[0]).toEqual({
data: '{"message":"5"}\n{"message":"6"}\n{"message":"7"}',
bytesCount: jasmine.any(Number),
flushReason,
encoding: undefined,
})

Expand All @@ -139,7 +134,6 @@ describe('batch', () => {
expect(transport.send.calls.mostRecent().args[0]).toEqual({
data: '{"message":"10"}\n{"message":"11"}',
bytesCount: jasmine.any(Number),
flushReason,
encoding: undefined,
})
})
Expand All @@ -154,7 +148,6 @@ describe('batch', () => {
expect(transport.send.calls.mostRecent().args[0]).toEqual({
data: '{"message":"1"}\n{"message":"2"}',
bytesCount: jasmine.any(Number),
flushReason,
encoding: undefined,
})
})
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/transport/batch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export class Batch {
send({
data: pendingMessages,
bytesCount: computeBytesCount(pendingMessages),
flushReason: event.reason,
})
}
} else {
Expand Down Expand Up @@ -142,6 +141,5 @@ function formatPayloadFromEncoder(encoderResult: EncoderResult, flushEvent: Flus
data,
bytesCount: encoderResult.outputBytesCount,
encoding: encoderResult.encoding,
flushReason: flushEvent.reason,
}
}
2 changes: 0 additions & 2 deletions packages/core/src/transport/httpRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { monitor } from '../tools/monitor'
import { addEventListener } from '../browser/addEventListener'
import type { RawError } from '../domain/error/error.types'
import { newRetryState, sendWithRetryStrategy } from './sendWithRetryStrategy'
import type { FlushReason } from './flushController'

/**
* Use POST request without content type to:
Expand All @@ -27,7 +26,6 @@ export interface Payload {
data: string | FormData | Blob
bytesCount: number
retry?: RetryInfo
flushReason?: FlushReason
encoding?: 'deflate'
}

Expand Down

0 comments on commit bce53cf

Please sign in to comment.