Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Messenger for logging and telemetry #2173

Merged
merged 5 commits into from
Dec 20, 2021
Merged

Use Messenger for logging and telemetry #2173

merged 5 commits into from
Dec 20, 2021

Conversation

fregante
Copy link
Contributor

@fregante fregante commented Dec 17, 2021

PR best reviewed without whitespace changes

Resolved TypeScript issue

Related to and blocked by:

For some reason, TypeScript is throwing an error when I import the background/telemetry.ts file in logging.ts. This is actually solved/avoided by #2178 so that PR should be merged first.

@fregante fregante marked this pull request as ready for review December 18, 2021 09:19
@twschiller twschiller added this to the 1.4.12 milestone Dec 18, 2021
Comment on lines +110 to +123
export const recordLog = getNotifier("RECORD_LOG", bg);
export const recordError = getNotifier("RECORD_ERROR", bg);
export const recordEvent = getNotifier("RECORD_EVENT", bg);
export const getLoggingConfig = getMethod("GET_LOGGING_CONFIG", bg);
export const setLoggingConfig = getMethod("SET_LOGGING_CONFIG", bg);

export const traces = {
addEntry: getNotifier("ADD_TRACE_ENTRY", bg),
addExit: getNotifier("ADD_TRACE_EXIT", bg),
clear: getNotifier("CLEAR_TRACES", bg),
};

export const initTelemetry = getNotifier("INIT_TELEMETRY", bg);
export const sendDeploymentAlert = getNotifier("SEND_DEPLOYMENT_ALERT", bg);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test report

Working

  • GET_LOGGING_CONFIG
  • SET_LOGGING_CONFIG
  • RECORD_EVENT
  • ADD_TRACE_ENTRY
  • ADD_TRACE_EXIT
  • CLEAR_TRACES
  • RECORD_ERROR

Seen

  • INIT_TELEMETRY (old INIT_UID)

Unable to reproduce

  • SEND_DEPLOYMENT_ALERT
  • RECORD_LOG

Comment on lines +110 to +112
export const recordLog = getNotifier("RECORD_LOG", bg);
export const recordError = getNotifier("RECORD_ERROR", bg);
export const recordEvent = getNotifier("RECORD_EVENT", bg);
Copy link
Contributor Author

@fregante fregante Dec 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One note about these, since I mentioned them as blockers in:

I found:

  • recordLog isn't used at all in the app
  • recordEvent appears in the app, but it isn't called
  • recordError may be called, but since this is a "notifier" it will not throw any errors:

Comment on lines -32 to -35
export function initTelemetry(): void {
void initUID().catch((error) => {
console.warn("Error initializing uid", { error });
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dropped this function because it was just a redirect of initUID. Now initUID is called initTelemetry instead

@@ -54,5 +54,5 @@ async function _reportError(
console.error(error);
}

await recordError(serializeError(selectError(error)), context, null);
recordError(serializeError(selectError(error)), context, null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@twschiller
Copy link
Contributor

image

@twschiller twschiller merged commit dbe7b69 into main Dec 20, 2021
@twschiller twschiller deleted the F/messenger/no-app branch December 20, 2021 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants