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

fix: improve mobile token error logging #5072

Merged
merged 2 commits into from
Mar 10, 2025

Conversation

reidzeibel
Copy link
Member

@reidzeibel reidzeibel commented Mar 10, 2025

Ref: Slack thread

Also maybe part of https://github.com/AtB-AS/kundevendt/issues/20215

Thomas from Entur notified us that our logging leaves many details out, so he asked if there are possibilities to improve it.

This PR will update the breadcrumb logging as shown below, hopefully will expose the metadata part more, and shows the stack if any.

from

  error: (msg, err, metadata?) => {
    logToBugsnag('Mobiletoken sdk info message: ' + msg, metadata);
    const onError = toOnErrorCallback('warning', msg, metadata);
    if (err) notifyBugsnag(err, {errorGroupHash: 'token', metadata: onError});
  }

to

  error: (msg, err, metadata?) => {
    logToBugsnag(`Mobiletoken sdk error message: ${msg} ${err}`, {
      'name': metadata?.name,
      'message' : metadata?.message,
      'stack' : metadata?.stack
    });
    const onError = toOnErrorCallback('error', msg, metadata);
    if (err) notifyBugsnag(err, {errorGroupHash: 'token', metadata: onError});
  }

Acceptance criteria

  • Error message on Bugsnag now shows the metadata properly (may need to be tested in prod?)

@reidzeibel reidzeibel merged commit 3e8d3f2 into master Mar 10, 2025
4 checks passed
@reidzeibel reidzeibel deleted the ridwan/improve-logging-mobiletoken branch March 10, 2025 13:48
@tormoseng
Copy link
Member

✅ Tested OK. See this event.

@reidzeibel When looking at the event. Do you think you'll get more info from the breadcrumb stacktrace than the event stacktrace? Just a question to possibly limit the amount of data from the user. If it's valuable, let's go!

@tormoseng
Copy link
Member

By the way, I cannot see a large difference from "normal" Bugsnag events in terms of size. So, let's go!

@reidzeibel
Copy link
Member Author

@tormoseng We'll need to see on Android, since the stacktrace on iOS is kind of broken now. Then we can compare the event stacktrace vs breadcrumb stacktrace and see what we should do next.

@tormoseng
Copy link
Member

@reidzeibel Here is a bugsnag event for Android: ref

@reidzeibel
Copy link
Member Author

@tormoseng seems like the breadcrumbs stacktrace gives more information here 🤔 , can we even skip the event stacktrace?

@tormoseng
Copy link
Member

Not sure. But it's not a way more data sent, so let's just keep it as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants