Skip to content

Commit dadb76e

Browse files
authored
[PROD] - add some extra logging (#1522)
* Adding more logging Stubbing out where stuff can go * putting this back in * not checking active so removing it * cleaning up and adding comments
1 parent 1a60f66 commit dadb76e

File tree

4 files changed

+64
-1
lines changed

4 files changed

+64
-1
lines changed

src/services/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export enum CustomEvents {
1717
CAPTURE_MATERIALIZE_SUCCESS = 'Capture_Materialize_Success',
1818
CAPTURE_TEST = 'Capture_Test',
1919
COLLECTION_CREATE = 'Collection_Create',
20+
CONNECTOR_VERSION_MISSING = 'Connector_Version:Missing',
2021
CONNECTOR_VERSION_UNSUPPORTED = 'Connector_Version:Unsupported',
2122
DATA_PLANE_SELECTOR = 'Data_Pane_Selector',
2223
DATE_TIME_PICKER_CHANGE = 'Date_Time_Picker:Change',

src/stores/DetailsForm/Hydrator.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useEntityType } from 'context/EntityContext';
22
import { useEntityWorkflow } from 'context/Workflow';
3+
34
import { useEffectOnce } from 'react-use';
45
import { logRocketConsole } from 'services/shared';
56
import { BaseComponentProps } from 'types';

src/stores/DetailsForm/Store.ts

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getLiveSpecs_detailsForm } from 'api/liveSpecsExt';
44
import { GlobalSearchParams } from 'hooks/searchParams/useGlobalSearchParams';
55
import produce from 'immer';
66
import { isEmpty } from 'lodash';
7-
import { logRocketEvent } from 'services/shared';
7+
import { logRocketConsole, logRocketEvent } from 'services/shared';
88
import { CustomEvents } from 'services/types';
99
import { DATA_PLANE_SETTINGS } from 'settings/dataPlanes';
1010
import {
@@ -39,6 +39,9 @@ const getConnectorImage = async (
3939
connectorId: string,
4040
existingImageTag?: ConnectorVersionEvaluationOptions['existingImageTag']
4141
): Promise<Details['data']['connectorImage'] | null> => {
42+
logRocketConsole('DetailsFormHydrator>getConnectorImage', {
43+
connectorId,
44+
});
4245
const { data, error } = await getConnectors_detailsForm(connectorId);
4346

4447
if (!error && data && data.length > 0) {
@@ -190,6 +193,9 @@ export const getInitialState = (
190193
set(
191194
produce((state: DetailsFormState) => {
192195
if (connectorImage.id === '') {
196+
logRocketConsole(
197+
'DetailsFormHydrator>setDetails_connector>resetting'
198+
);
193199
state.details.data.connectorImage =
194200
getInitialStateData().details.data.connectorImage;
195201
} else {
@@ -293,11 +299,24 @@ export const getInitialState = (
293299
workflow === 'capture_create' ||
294300
workflow === 'materialization_create';
295301

302+
logRocketConsole('DetailsFormHydrator>hydrateState', {
303+
connectorId,
304+
createWorkflow,
305+
dataPlaneId,
306+
liveSpecId,
307+
searchParams: searchParams.toString(),
308+
workflow,
309+
});
310+
296311
if (connectorId) {
297312
let dataPlaneOptions: DataPlaneOption[] = [];
298313

299314
const dataPlaneResponse = await getDataPlaneOptions();
300315

316+
logRocketConsole(
317+
'DetailsFormHydrator>hydrateState>getDataPlaneOptions'
318+
);
319+
301320
if (
302321
!dataPlaneResponse.error &&
303322
dataPlaneResponse.data &&
@@ -307,6 +326,9 @@ export const getInitialState = (
307326
generateDataPlaneOption
308327
);
309328

329+
logRocketConsole(
330+
'DetailsFormHydrator>hydrateState>setDataPlaneOptions'
331+
);
310332
get().setDataPlaneOptions(dataPlaneOptions);
311333
} else {
312334
get().setHydrationError(
@@ -316,8 +338,25 @@ export const getInitialState = (
316338
}
317339

318340
if (createWorkflow) {
341+
logRocketConsole(
342+
'DetailsFormHydrator>hydrateState>createWorkflow'
343+
);
319344
const connectorImage = await getConnectorImage(connectorId);
345+
logRocketConsole(
346+
'DetailsFormHydrator>hydrateState>createWorkflow>getConnectorImage',
347+
{
348+
connectorId: connectorImage?.connectorId,
349+
connectorImageId: connectorImage?.id,
350+
}
351+
);
352+
320353
const dataPlane = getDataPlane(dataPlaneOptions, dataPlaneId);
354+
logRocketConsole(
355+
'DetailsFormHydrator>hydrateState>createWorkflow>getDataPlane',
356+
{
357+
dataPlaneName: dataPlane?.dataPlaneName,
358+
}
359+
);
321360

322361
if (!isProduction && connectorImage && dataPlane === null) {
323362
get().setDetails_connector(connectorImage);
@@ -332,6 +371,10 @@ export const getInitialState = (
332371
errors,
333372
});
334373
} else if (connectorImage && dataPlane !== null) {
374+
logRocketConsole(
375+
'DetailsFormHydrator>hydrateState>createWorkflow>setDetails_connector'
376+
);
377+
335378
get().setDetails_connector(connectorImage);
336379

337380
const {
@@ -345,6 +388,9 @@ export const getInitialState = (
345388
errors,
346389
});
347390
} else {
391+
logRocketConsole(
392+
'DetailsFormHydrator>hydrateState>createWorkflow>setHydrationErrorsExist'
393+
);
348394
get().setHydrationErrorsExist(true);
349395
}
350396
} else if (liveSpecId) {
@@ -403,6 +449,13 @@ export const getInitialState = (
403449
});
404450
get().setHydrationErrorsExist(true);
405451
}
452+
} else {
453+
logRocketEvent(CustomEvents.CONNECTOR_VERSION_MISSING);
454+
// TODO (details hydration) should really show an error here
455+
// get().setHydrationError(
456+
// 'Unable to locate selected connector. If the issue persists, please contact support.'
457+
// );
458+
// get().setHydrationErrorsExist(true);
406459
}
407460
},
408461

src/stores/DetailsForm/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ export interface Details extends Pick<JsonFormsCore, 'data' | 'errors'> {
4545
};
4646
}
4747

48+
// TODO (search params) - need to stop getting search params from within zustand
49+
// should pass in with optiosn like this one
50+
// export interface DetailsHydrateOptions {
51+
// connectorId: string | null;
52+
// dataPlaneId: string | null;
53+
// liveSpecId: string | null;
54+
// }
55+
4856
export interface DetailsFormState
4957
extends StoreWithHydration,
5058
StoreWithCustomErrors {

0 commit comments

Comments
 (0)