Skip to content

Conversation

@david1alvarez
Copy link
Contributor

@david1alvarez david1alvarez commented May 15, 2025

Because:

  • Current logs to bigquery from payments next are malformed and not queriable

This commit:

  • Addresses formatting issues of the logs

Closes #FXA-11639

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

Screenshots (Optional)

Please attach the screenshots of the changes made in case of change in user interface.
Screenshot 2025-05-20 at 5 41 43 PM

Other information (Optional)

Any other information that is important to this pull request.

@david1alvarez david1alvarez requested a review from a team as a code owner May 15, 2025 17:10
Copy link
Contributor

@StaberindeZA StaberindeZA left a comment

Choose a reason for hiding this comment

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

There's a couple of console statements in payments-next and with sanitizeExceptions as well. Could you have a look at those as well please?

@david1alvarez david1alvarez force-pushed the FXA-11639 branch 4 times, most recently from 9a58137 to 82213e3 Compare May 21, 2025 18:11
Copy link
Contributor

@StaberindeZA StaberindeZA left a comment

Choose a reason for hiding this comment

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

In the image below, I've noticed a few issues, which I've listed below.

  1. ERROR logs aren't including the additional data. The LOG and ERROR statements are the same in the code,
  2. The error property is meant to be an Error object, but only shows an empty object instead
  3. Is this the expected format for parsing into BigQuery?

image

AccountDatabaseNestFactory,
CartManager,
LegacyStatsDProvider,
{ provide: Logger, useValue: winstonLogger },
Copy link
Contributor

Choose a reason for hiding this comment

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

Does fxa-admin-server use winstonLogger in the rest of the app? If not, then the same logger should be reused here, as is in the rest of the app.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like fxa-admin-server mostly uses the MozLoggerService, though predominantly this will be used in the CartManager, which is imported here for use in the admin panel. I'll make the change for consistency with the admin panel though

@david1alvarez david1alvarez force-pushed the FXA-11639 branch 7 times, most recently from bde3b1d to 2ad6f05 Compare May 28, 2025 00:08
Comment on lines 88 to 91
this.log.error('profileClient.deleteCache.failed', {
uid,
error: err.toString(),
});
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought for log.error, the first argument needs to be an Error object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does, yes. I'll go through the PR this morning to see if I can catch anything else. It's changed a bit over the time its been worked on haha

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yes fair enough. Sorry for jumping in a bit early.

Copy link
Contributor

Choose a reason for hiding this comment

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

This still looks open?

Copy link
Contributor

@StaberindeZA StaberindeZA left a comment

Choose a reason for hiding this comment

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

r+wc. Just 2 comments, but otherwise lets get this merged. Thank you!

info,
});
this.name = 'CartError';
Object.setPrototypeOf(this, CartError.prototype);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious and for logging purposes, why is this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Object.setPrototype is used for instanceof checks, which comes into play for several of our tests. instanceof check are inconsistent otherwise

Comment on lines 88 to 91
this.log.error('profileClient.deleteCache.failed', {
uid,
error: err.toString(),
});
Copy link
Contributor

Choose a reason for hiding this comment

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

This still looks open?

Because:

* Current logs to bigquery from payments next are malformed and not queriable

This commit:

* Addresses formatting issues of the logs

Closes #FXA-11639
this.log.error('profile.deleteCache.failed', uid, err);
throw err;
} catch (error) {
this.log.error(error);
Copy link
Contributor

@StaberindeZA StaberindeZA May 29, 2025

Choose a reason for hiding this comment

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

nit. ideally this would be something like the code below, so that the additional context of the uid isn't lost. This can be fixed up at a later stage though.

const deleteCacheError = new ProfileClientDeleteCacheError(
  'Error occurred during delete cache',
  uid,
  error
)
this.log.error(deleteCacheError);
throw deleteCacheError;

@david1alvarez david1alvarez merged commit b94ee70 into main May 29, 2025
19 checks passed
@david1alvarez david1alvarez deleted the FXA-11639 branch May 29, 2025 17:42
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.

3 participants