Skip to content

Commit 4f025e4

Browse files
committed
Change naming from transport to Fl.
1 parent ba78d97 commit 4f025e4

File tree

7 files changed

+58
-62
lines changed

7 files changed

+58
-62
lines changed

packages/performance/src/services/perf_logger.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,8 @@ describe('Performance Monitoring > perf_logger', () => {
338338
expect(addToQueueStub).not.called;
339339
});
340340

341-
it('skips performance collection if domain is transport', () => {
342-
const TRANSPORT_NETWORK_PERFORMANCE_ENTRY: PerformanceResourceTiming = {
341+
it('skips performance collection if domain is fl', () => {
342+
const FL_NETWORK_PERFORMANCE_ENTRY: PerformanceResourceTiming = {
343343
connectEnd: 0,
344344
connectStart: 0,
345345
decodedBodySize: 0,
@@ -370,7 +370,7 @@ describe('Performance Monitoring > perf_logger', () => {
370370
SettingsService.getInstance().loggingEnabled = true;
371371
SettingsService.getInstance().logNetworkAfterSampling = true;
372372
// Calls logNetworkRequest under the hood.
373-
createNetworkRequestEntry(TRANSPORT_NETWORK_PERFORMANCE_ENTRY);
373+
createNetworkRequestEntry(FL_NETWORK_PERFORMANCE_ENTRY);
374374
clock.tick(1);
375375

376376
expect(addToQueueStub).not.called;

packages/performance/src/services/perf_logger.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,11 @@ export function logNetworkRequest(networkRequest: NetworkRequest): void {
157157

158158
// Blacklist old log endpoint and new transport endpoint.
159159
const logEndpointHostName = new URL(settingsService.logEndPointUrl).hostname;
160-
const transportEndpointHostName = new URL(
161-
settingsService.transportEndpointUrl
162-
).hostname;
160+
const flEndpointHostName = new URL(settingsService.flTransportEndpointUrl)
161+
.hostname;
163162
if (
164163
networkRequestHostName === logEndpointHostName ||
165-
networkRequestHostName === transportEndpointHostName
164+
networkRequestHostName === flEndpointHostName
166165
) {
167166
return;
168167
}

packages/performance/src/services/remote_config_service.test.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { SettingsService } from './settings_service';
2020
import { CONFIG_EXPIRY_LOCAL_STORAGE_KEY } from '../constants';
2121
import { setupApi, Api } from './api_service';
2222
import * as iidService from './iid_service';
23-
import { getConfig, isDestTransport } from './remote_config_service';
23+
import { getConfig, isDestFl } from './remote_config_service';
2424
import { FirebaseApp } from '@firebase/app-types';
2525
import '../../test/setup';
2626

@@ -135,7 +135,7 @@ describe('Performance Monitoring > remote_config_service', () => {
135135
TRANSPORT_KEY
136136
);
137137
expect(SettingsService.getInstance().logSource).to.equal(LOG_SOURCE);
138-
expect(SettingsService.getInstance().shouldSendToTransport).to.be.true;
138+
expect(SettingsService.getInstance().shouldSendToFl).to.be.true;
139139
expect(
140140
SettingsService.getInstance().networkRequestsSamplingRate
141141
).to.equal(NETWORK_SAMPLIG_RATE);
@@ -176,7 +176,7 @@ describe('Performance Monitoring > remote_config_service', () => {
176176
TRANSPORT_KEY
177177
);
178178
expect(SettingsService.getInstance().logSource).to.equal(LOG_SOURCE);
179-
expect(SettingsService.getInstance().shouldSendToTransport).to.be.true;
179+
expect(SettingsService.getInstance().shouldSendToFl).to.be.true;
180180
expect(
181181
SettingsService.getInstance().networkRequestsSamplingRate
182182
).to.equal(NETWORK_SAMPLIG_RATE);
@@ -252,7 +252,7 @@ describe('Performance Monitoring > remote_config_service', () => {
252252
await getConfig(IID);
253253

254254
// If no template, will send to cc.
255-
expect(SettingsService.getInstance().shouldSendToTransport).to.be.false;
255+
expect(SettingsService.getInstance().shouldSendToFl).to.be.false;
256256
});
257257

258258
it('marks event destination to cc if instance state unspecified', async () => {
@@ -270,7 +270,7 @@ describe('Performance Monitoring > remote_config_service', () => {
270270
await getConfig(IID);
271271

272272
// If instance state unspecified, will send to cc.
273-
expect(SettingsService.getInstance().shouldSendToTransport).to.be.false;
273+
expect(SettingsService.getInstance().shouldSendToFl).to.be.false;
274274
});
275275

276276
it("marks event destination to cc if state doesn't exist", async () => {
@@ -285,10 +285,10 @@ describe('Performance Monitoring > remote_config_service', () => {
285285
await getConfig(IID);
286286

287287
// If "state" doesn't exist, will send to cc.
288-
expect(SettingsService.getInstance().shouldSendToTransport).to.be.false;
288+
expect(SettingsService.getInstance().shouldSendToFl).to.be.false;
289289
});
290290

291-
it('marks event destination to transport if template exists but no rollout flag', async () => {
291+
it('marks event destination to Fl if template exists but no rollout flag', async () => {
292292
const CONFIG_WITHOUT_ROLLOUT_FLAG = `{"entries":{"fpr_enabled":"true",\
293293
"fpr_log_endpoint_url":"https://firebaselogging.test.com",\
294294
"fpr_log_source":"2","fpr_vc_network_request_sampling_rate":"0.250000",\
@@ -304,8 +304,8 @@ describe('Performance Monitoring > remote_config_service', () => {
304304
);
305305
await getConfig(IID);
306306

307-
// If template exists but no rollout flag, will send to transport.
308-
expect(SettingsService.getInstance().shouldSendToTransport).to.be.true;
307+
// If template exists but no rollout flag, will send to Fl.
308+
expect(SettingsService.getInstance().shouldSendToFl).to.be.true;
309309
});
310310

311311
it('marks event destination to cc when instance is outside of rollout range', async () => {
@@ -326,10 +326,10 @@ describe('Performance Monitoring > remote_config_service', () => {
326326
await getConfig(IID);
327327

328328
// If rollout flag exists, will send to cc when this instance is out of rollout scope.
329-
expect(SettingsService.getInstance().shouldSendToTransport).to.be.false;
329+
expect(SettingsService.getInstance().shouldSendToFl).to.be.false;
330330
});
331331

332-
it('marks event destination to transport when instance is within rollout range', async () => {
332+
it('marks event destination to Fl when instance is within rollout range', async () => {
333333
const CONFIG_WITH_ROLLOUT_FLAG_40 = `{"entries":{"fpr_enabled":"true",\
334334
"fpr_log_endpoint_url":"https://firebaselogging.test.com",\
335335
"fpr_log_source":"2","fpr_vc_network_request_sampling_rate":"0.250000",\
@@ -346,25 +346,25 @@ describe('Performance Monitoring > remote_config_service', () => {
346346
);
347347
await getConfig(IID);
348348

349-
// If rollout flag exists, will send to transport when this instance is within rollout scope.
350-
expect(SettingsService.getInstance().shouldSendToTransport).to.be.true;
349+
// If rollout flag exists, will send to Fl when this instance is within rollout scope.
350+
expect(SettingsService.getInstance().shouldSendToFl).to.be.true;
351351
});
352352
});
353353

354-
describe('isDestTransport', () => {
354+
describe('isDestFl', () => {
355355
it('marks traffic to cc when rollout percentage is 0', () => {
356-
const shouldSendToTransport = isDestTransport('abc', 0); // Hash percentage of "abc" is 38%.
357-
expect(shouldSendToTransport).to.be.false;
356+
const shouldSendToFl = isDestFl('abc', 0); // Hash percentage of "abc" is 38%.
357+
expect(shouldSendToFl).to.be.false;
358358
});
359359

360-
it('marks traffic to transport when rollout percentage is 100', () => {
361-
const shouldSendToTransport = isDestTransport('abc', 100); // Hash percentage of "abc" is 38%.
362-
expect(shouldSendToTransport).to.be.true;
360+
it('marks traffic to Fl when rollout percentage is 100', () => {
361+
const shouldSendToFl = isDestFl('abc', 100); // Hash percentage of "abc" is 38%.
362+
expect(shouldSendToFl).to.be.true;
363363
});
364364

365-
it('marks traffic to transport if hash percentage is lower than rollout percentage 50%', () => {
366-
const shouldSendToTransport = isDestTransport('abc', 50); // Hash percentage of "abc" is 38%.
367-
expect(shouldSendToTransport).to.be.true;
365+
it('marks traffic to Fl if hash percentage is lower than rollout percentage 50%', () => {
366+
const shouldSendToFl = isDestFl('abc', 50); // Hash percentage of "abc" is 38%.
367+
expect(shouldSendToFl).to.be.true;
368368
});
369369
});
370370
});

packages/performance/src/services/remote_config_service.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ interface SecondaryConfig {
3434
logSource?: number;
3535
logEndPointUrl?: string;
3636
transportKey?: string;
37-
shouldSendToTransport?: boolean;
37+
shouldSendToFl?: boolean;
3838
tracesSamplingRate?: number;
3939
networkRequestsSamplingRate?: number;
4040
}
@@ -43,13 +43,13 @@ interface SecondaryConfig {
4343
// retrieved, but the template does not have these fields.
4444
const SECONDARY_CONFIGS: SecondaryConfig = {
4545
loggingEnabled: true,
46-
shouldSendToTransport: true
46+
shouldSendToFl: true
4747
};
4848

4949
// These values will be used if the remote config object is successfully
5050
// retrieved, but the config object state shows unspecified or no template.
5151
const NO_TEMPLATE_CONFIGS: SecondaryConfig = {
52-
shouldSendToTransport: false
52+
shouldSendToFl: false
5353
};
5454

5555
/* eslint-disable camelcase */
@@ -215,24 +215,23 @@ function processConfig(
215215
state === 'INSTANCE_STATE_UNSPECIFIED' ||
216216
state === 'NO_TEMPLATE'
217217
) {
218-
if (NO_TEMPLATE_CONFIGS.shouldSendToTransport !== undefined) {
219-
settingsServiceInstance.shouldSendToTransport =
220-
NO_TEMPLATE_CONFIGS.shouldSendToTransport;
218+
if (NO_TEMPLATE_CONFIGS.shouldSendToFl !== undefined) {
219+
settingsServiceInstance.shouldSendToFl =
220+
NO_TEMPLATE_CONFIGS.shouldSendToFl;
221221
}
222222
} else if (entries.fpr_log_transport_web_percent !== undefined) {
223223
// If config object state doesn't indicate no template, it can only be UPDATE for now.
224224
// - Performance Monitoring doesn't set etag in request, therefore state cannot be NO_CHANGE.
225225
// - Sampling rate flags and master flag are required, therefore state cannot be EMPTY_CONFIG.
226226
// If config object state is UPDATE and rollout flag is present, determine endpoint by iid.
227-
settingsServiceInstance.shouldSendToTransport = isDestTransport(
227+
settingsServiceInstance.shouldSendToFl = isDestFl(
228228
iid,
229229
Number(entries.fpr_log_transport_web_percent)
230230
);
231-
} else if (SECONDARY_CONFIGS.shouldSendToTransport !== undefined) {
231+
} else if (SECONDARY_CONFIGS.shouldSendToFl !== undefined) {
232232
// If config object state is UPDATE and rollout flag is not present, that means rollout is
233233
// complete and rollout flag is deprecated, therefore dispatch events to new transport endpoint.
234-
settingsServiceInstance.shouldSendToTransport =
235-
SECONDARY_CONFIGS.shouldSendToTransport;
234+
settingsServiceInstance.shouldSendToFl = SECONDARY_CONFIGS.shouldSendToFl;
236235
}
237236

238237
if (entries.fpr_vc_network_request_sampling_rate !== undefined) {
@@ -270,13 +269,13 @@ function shouldLogAfterSampling(samplingRate: number): boolean {
270269
}
271270

272271
/**
273-
* True if event should be sent to transport endpoint rather than log endpoint.
272+
* True if event should be sent to Fl transport endpoint rather than log endpoint.
274273
* rolloutPercent is in range [0.0, 100.0].
275274
* @param {string} iid Installation ID which identifies a web app installed on client.
276-
* @param {number} rolloutPercent the possibility of this app sending events to transport endpoint.
277-
* @return {boolean} true if this installation should send events to transport endpoint.
275+
* @param {number} rolloutPercent the possibility of this app sending events to Fl endpoint.
276+
* @return {boolean} true if this installation should send events to Fl endpoint.
278277
*/
279-
export function isDestTransport(iid: string, rolloutPercent: number): boolean {
278+
export function isDestFl(iid: string, rolloutPercent: number): boolean {
280279
if (iid.length === 0) {
281280
return false;
282281
}

packages/performance/src/services/settings_service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ export class SettingsService {
4040
'https://firebaselogging.googleapis.com/v0cc/log?format=json_proto';
4141
// Performance event transport endpoint URL which should be compatible with proto3.
4242
// New Address for transport service, not configurable via Remote Config.
43-
transportEndpointUrl = mergeStrings(
43+
flTransportEndpointUrl = mergeStrings(
4444
'hts/frbslgigp.ogepscmv/ieo/eaylg',
4545
'tp:/ieaeogn-agolai.o/1frlglgc/o'
4646
);
4747

4848
transportKey = mergeStrings('AzSC8r6ReiGqFMyfvgow', 'Iayx0u-XT3vksVM-pIV');
4949

50-
shouldSendToTransport = false;
50+
shouldSendToFl = false;
5151

5252
// Source type for performance event logs.
5353
logSource = 462;
@@ -96,8 +96,8 @@ export class SettingsService {
9696
return apiKey;
9797
}
9898

99-
getTransportFullUrl(): string {
100-
return this.transportEndpointUrl.concat('?key=', this.transportKey);
99+
getFlTransportFullUrl(): string {
100+
return this.flTransportEndpointUrl.concat('?key=', this.transportKey);
101101
}
102102

103103
static getInstance(): SettingsService {

packages/performance/src/services/transport_service.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('Firebase Performance > transport_service', () => {
4747
fetchStub.restore();
4848
clock.restore();
4949
resetTransportService();
50-
SettingsService.getInstance().shouldSendToTransport = false;
50+
SettingsService.getInstance().shouldSendToFl = false;
5151
});
5252

5353
it('throws an error when logging an empty message', () => {
@@ -85,10 +85,10 @@ describe('Firebase Performance > transport_service', () => {
8585
it('successful send a meesage to transport', () => {
8686
const transportDelayInterval = 30000;
8787
const setting = SettingsService.getInstance();
88-
const transportFullUrl =
89-
setting.transportEndpointUrl + '?key=' + setting.transportKey;
90-
setting.shouldSendToTransport = true;
91-
fetchStub.withArgs(transportFullUrl, match.any).resolves(
88+
const flTransportFullUrl =
89+
setting.flTransportEndpointUrl + '?key=' + setting.transportKey;
90+
setting.shouldSendToFl = true;
91+
fetchStub.withArgs(flTransportFullUrl, match.any).resolves(
9292
// DELETE_REQUEST means event dispatch is successful.
9393
new Response(
9494
'{\

packages/performance/src/services/transport_service.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface BatchEvent {
3535
}
3636

3737
/* eslint-disable camelcase */
38-
// CC/Transport accepted log format.
38+
// CC/Fl accepted log format.
3939
interface TransportBatchLogFormat {
4040
request_time_ms: string;
4141
client_info: ClientInfo;
@@ -124,18 +124,18 @@ function postToEndpoint(
124124
staged: BatchEvent[]
125125
): Promise<void> {
126126
// Gradually rollout traffic from cc to transport using remote config.
127-
if (SettingsService.getInstance().shouldSendToTransport) {
128-
return sendEventsToTransport(data, staged);
127+
if (SettingsService.getInstance().shouldSendToFl) {
128+
return sendEventsToFl(data, staged);
129129
} else {
130130
return sendEventsToCc(data);
131131
}
132132
}
133133

134-
function sendEventsToTransport(
134+
function sendEventsToFl(
135135
data: TransportBatchLogFormat,
136136
staged: BatchEvent[]
137137
): Promise<void> {
138-
return postToTransportEndpoint(data)
138+
return postToFlEndpoint(data)
139139
.then(res => {
140140
if (!res.ok) {
141141
consoleLogger.info('Call to Firebase backend failed.');
@@ -191,11 +191,9 @@ function sendEventsToCc(data: TransportBatchLogFormat): Promise<void> {
191191
});
192192
}
193193

194-
function postToTransportEndpoint(
195-
data: TransportBatchLogFormat
196-
): Promise<Response> {
197-
const transportFullUrl = SettingsService.getInstance().getTransportFullUrl();
198-
return fetch(transportFullUrl, {
194+
function postToFlEndpoint(data: TransportBatchLogFormat): Promise<Response> {
195+
const flTransportFullUrl = SettingsService.getInstance().getFlTransportFullUrl();
196+
return fetch(flTransportFullUrl, {
199197
method: 'POST',
200198
body: JSON.stringify(data)
201199
});

0 commit comments

Comments
 (0)