-
Notifications
You must be signed in to change notification settings - Fork 63
Conversation
Storybook and Tailwind configuration previews: Ready Storybook: https://wordpress.github.io/openverse-frontend/_preview/1823 Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again. You can check the GitHub pages deployment action list to see the current status of the deployments. |
Size Change: +5.71 kB (+1%) Total Size: 798 kB
ℹ️ View Unchanged
|
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.
Given that the implementation currently works, I'm ok with removing the logging.
But would it be a better solution to make the log
function a no-op on the production server-side? That allows us to keep the detailed logging in dev untouched, just in case.
openverse-frontend/src/utils/console.ts
Lines 3 to 8 in bb12c58
export const getLogger = (level: 'log' | 'warn' | 'error') => | |
isProd && isClient | |
? () => { | |
// do nothing | |
} | |
: console[level] |
@dhruvkb I'm not sure; they also clutter local development considerably too. Perhaps I should comment them out rather than delete for easy restoration if there's ever issues with the token implementation? |
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.
Better to delete them if they aren't useful in dev either.
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.
LGTM! This has been making the dev output almost unusable, but we might want to add at least some indication of whether the token is added to requests or not.
@@ -176,12 +161,6 @@ const apiToken: Plugin = async (context, inject) => { | |||
let openverseApiToken: string | undefined | |||
try { | |||
openverseApiToken = await getApiAccessToken(context) |
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.
Maybe we should leave these lines so that it's clear if we are using the token when fetching or not?
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'm not sure. We're already sending the error('Unable to retrieve API token, clearing existing token', e)
when things fail, which i think would be enough information to debug this token code in the event of a problem.
@sarayourfriend as the original author would you mind looking at this before I merge? |
What was the increase in log storage costs? We had zero logs before on the frontend so I'm not surprised if it went up several thousand percent, but I would like to know what the overall cost of these logs is. Can we remove the logs that happen on every request but keep the ones around the token refresh? Those should only happen every 12 hours per instance. |
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.
LGTM!
Description
We've had a pretty large increase to our log storage costs in production. This PR tries to remove some of the logs from the API token process. I'm opening to keeping a subset of these or whatever the minimum amount of information we need to debug problems with this is.
Testing Instructions
Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin