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

Drop sending chromeos errors to sentry #2293

Merged
merged 3 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/util/handleError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ const logServerError = async (
const err = getErrorLog(error, ctx);
switch (logLevel) {
case "info":
await log.info(err);
log.info(err);
break;
case "warn":
await log.warn(err);
log.warn(err);
break;
case "error":
case undefined:
await log.error(err);
log.error(err);
break;
default:
unreachable(logLevel);
Expand Down
55 changes: 43 additions & 12 deletions src/util/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,46 @@ const isInformationalError = (exception: unknown): boolean => {
return logLevel === "info";
};

const sentryIgnoreErrors = [
'Object.prototype.hasOwnProperty.call(o,"telephone")',
'Object.prototype.hasOwnProperty.call(e,"telephone")',
"'get' on proxy: property 'javaEnabled' is a read-only and non-configurable data property",
type SentryIgnore = {
error: string;
exact?: boolean;
};

const sentryIgnoreErrors: SentryIgnore[] = [
// Network problems
{ error: "[Network error]: Failed to fetch", exact: true },
{ error: "Failed to fetch", exact: true },
Comment on lines +25 to +26
Copy link
Member Author

Choose a reason for hiding this comment

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

Disse skal treffe eksakt på errorbeskrivelse for å ikkje sendes.

// https://github.com/getsentry/sentry/issues/61469
{ error: 'Object.prototype.hasOwnProperty.call(o,"telephone")' },
{ error: 'Object.prototype.hasOwnProperty.call(e,"telephone")' },
// https://github.com/matomo-org/matomo/issues/22836
{ error: "'get' on proxy: property 'javaEnabled' is a read-only and non-configurable data property" },
// Based on Sentry issues. ChromeOS specific errors.
{ error: "Request timeout getDictionariesByLanguageId" },
{ error: "Request timeout getSupportScreenShot" },
{ error: "Request timeout isDictateAvailable" },
{ error: "Request timeout isPredictionAvailable" },
{ error: "Request timeout dictionariesDistributor.getValue" },
{ error: "Request timeout speechVoicesDistributor.getValue" },
{ error: "Request timeout userDistributor.getValue" },
{ error: "Request timeout predictionDistributor.getValue" },
{ error: "Request timeout dictateStateDistributor.getValue" },
{ error: "Request timeout nn-NO_wordsDistributor.getValue" },
{ error: "Request timeout availableTextCheckLanguagesDistributor.getValue" },
{ error: "Request timeout es_wordsDistributor.getValue" },
{ error: "Request timeout lettersVoicesDistributor.getValue" },
{ error: "Request timeout topicsDistributor.getValue" },
{ error: "Request timeout availableLanguagesDistributor.getValue" },
{ error: "Request timeout ac_wordsDistributor.getValue" },
{ error: "Request timeout nb-NO_wordsDistributor.getValue" },
{ error: "Request timeout ua_wordsDistributor.getValue" },
{ error: "Request timeout en_wordsDistributor.getValue" },
{ error: "Request timeout appSettingsDistributor.getValue" },
{ error: "Request timeout DefineExpirationForLanguagePacks.getValue" },
{ error: "Request timeout textCheckersDistributor.getValue" },
{ error: "Request timeout de_wordsDistributor.getValue" },
{ error: "Request timeout fr_wordsDistributor.getValue" },
{ error: "Request timeout ru_wordsDistributor.getValue" },
];

export const beforeSend = (event: Sentry.ErrorEvent, hint: Sentry.EventHint) => {
Expand All @@ -28,15 +64,10 @@ export const beforeSend = (event: Sentry.ErrorEvent, hint: Sentry.EventHint) =>

if (
exception instanceof Error &&
(exception.message === "Failed to fetch" || exception.message === "[Network error]: Failed to fetch")
sentryIgnoreErrors.find(
(e) => (e.exact ? exception.message === e.error : exception.message.includes(e.error)) !== undefined,
)
) {
// Don't send network errors without more information
// These are not really something we can fix, usually triggered by exceptions blocking requests
// so logging them shouldn't provide much value.
return null;
}

if (exception instanceof Error && sentryIgnoreErrors.find((e) => exception.message.includes(e)) !== undefined) {
// https://github.com/getsentry/sentry/issues/61469
// https://github.com/matomo-org/matomo/issues/22836
return null;
Expand Down
Loading