Skip to content

Commit

Permalink
fix check
Browse files Browse the repository at this point in the history
  • Loading branch information
mcasimir committed Aug 27, 2024
1 parent 5d1adc9 commit c988743
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 5 deletions.
76 changes: 74 additions & 2 deletions packages/compass-telemetry/src/telemetry-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ type AtlasSignOutEvent = {
*/
type AggregationUseCaseAddedEvent = ConnectionScoped<{
name: 'Aggregation Use Case Added';
payload: { drag_and_drop?: boolean; stage_name?: string };
payload: {
/**
* Specifies if the use case was added via drag and drop
*/
drag_and_drop?: boolean;
stage_name?: string;
};
}>;

/**
Expand Down Expand Up @@ -1271,6 +1277,61 @@ type ThemeChangedEvent = {
payload: { theme: 'DARK' | 'LIGHT' | 'OS_THEME' };
};

/**
* This event is fired at startup to report the First Contentful Paint metric.
* See: https://web.dev/articles/vitals.
*
* @category Web Vitals
*/
type FirstContentfulPaintEvent = {
name: 'First Contentful Paint';
payload: { value: number };
};

/**
* This event is fired at startup to report the Largest Contentful Paint metric.
* See: https://web.dev/articles/vitals.
*
* @category Web Vitals
*/
type LargestContentfulPaintEvent = {
name: 'Largest Contentful Paint';
payload: { value: number };
};

/**
* This event is fired at startup to report the First Input Delay metric.
* See: https://web.dev/articles/vitals.
*
* @category Web Vitals
*/
type FirstInputDelayEvent = {
name: 'First Input Delay';
payload: { value: number };
};

/**
* This event is fired at startup to report the Cumulative Layout Shift metric.
* See: https://web.dev/articles/vitals.
*
* @category Web Vitals
*/
type CumulativeLayoutShiftEvent = {
name: 'Cumulative Layout Shift';
payload: { value: number };
};

/**
* This event is fired at startup to report the Time to First Byte metric.
* See: https://web.dev/articles/vitals.
*
* @category Web Vitals
*/
type TimeToFirstByteEvent = {
name: 'Time to First Byte';
payload: { value: number };
};

/**
* This event is fired when user clicks on Atlas CTA
*
Expand Down Expand Up @@ -1346,6 +1407,12 @@ type PerformanceAdvisorClickedEvent = ConnectionScoped<{
};
}>;

/**
* This event is fired at startup when we detect that the application is running on
* a system that doesn't offer a suitable secret storage backend.
*
* @category Other
*/
type SecretStorageNotAvailable = {
name: 'Secret Storage Not Available';
payload: {
Expand Down Expand Up @@ -1460,4 +1527,9 @@ export type TelemetryEvent =
| UpdateExportedEvent
| UpdateExportOpenedEvent
| ViewUpdatedEvent
| SecretStorageNotAvailable;
| SecretStorageNotAvailable
| FirstContentfulPaintEvent
| LargestContentfulPaintEvent
| FirstInputDelayEvent
| CumulativeLayoutShiftEvent
| TimeToFirstByteEvent;
7 changes: 4 additions & 3 deletions packages/compass/src/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,15 @@ const Application = View.extend({
name,
value,
}: Pick<webvitals.Metric, 'name' | 'value'>) {
const fullName = {
const events = {
FCP: 'First Contentful Paint',
LCP: 'Largest Contentful Paint',
FID: 'First Input Delay',
CLS: 'Cumulative Layout Shift',
TTFB: 'Time to First Byte',
}[name];
track(fullName, { value });
} as const;

track(events[name], { value });
}

webvitals.getFCP(trackPerfEvent);
Expand Down

0 comments on commit c988743

Please sign in to comment.