-
Notifications
You must be signed in to change notification settings - Fork 23
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
Conversation
42f9461
to
1e3d72d
Compare
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); |
There was a problem hiding this comment.
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
export const recordLog = getNotifier("RECORD_LOG", bg); | ||
export const recordError = getNotifier("RECORD_ERROR", bg); | ||
export const recordEvent = getNotifier("RECORD_EVENT", bg); |
There was a problem hiding this comment.
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:
- https://github.com/pixiebrix/pixiebrix-app/issues/882
- https://github.com/pixiebrix/pixiebrix-app/issues/883
I found:
recordLog
isn't used at all in the apprecordEvent
appears in the app, but it isn't calledrecordError
may be called, but since this is a "notifier" it will not throw any errors:- Where are notification errors handled? webext-messenger#40
- If we do see errors, they will be async and we can address them as part of the 2 issues I opened in the app
export function initTelemetry(): void { | ||
void initUID().catch((error) => { | ||
console.warn("Error initializing uid", { error }); | ||
}); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
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 inlogging.ts
. This is actually solved/avoided by #2178 so that PR should be merged first.