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 Sentry client setup #5297

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Fix Sentry client setup #5297

wants to merge 2 commits into from

Conversation

obulat
Copy link
Contributor

@obulat obulat commented Dec 20, 2024

Fixes

Fixes #5296 by @obulat

Description

This PR changes the way the release value is set for the Sentry module on the client. It uses a sentryRelease value in the nuxtConfig set to the process.env.SEMANTIC_VERSION. Using a different name for the variable (i.e., not the corresponding NUXT_PUBLIC_SENTRY_RELEASE one) makes sure that the value is not changed during the runtime.

This PR also adds a platform tag to easily filter server/client events in Sentry UI.

Testing Instructions

To test that the release is baked in during the build time, you can use different values for SEMANTIC_VERSION env variable during build/runtime. To do that:

  1. Build the app using ov env SEMANTIC_VERSION=build just frontend/run build
  2. Start the app with a different value: ov env SEMANTIC_VERSION=start just frontend/run build
  3. Go to http://localhost:8443/preferences, scroll down to see the "Capture Sentry Exception" button and click it. In the devtools, check the payload of the Sentry POST request. It should have release: "build" in it.

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (ov just catalog/generate-docs for catalog
    PRs) or the media properties generator (ov just catalog/generate-docs media-props
    for the catalog or ov just api/generate-docs for the API) where applicable.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@openverse-bot openverse-bot added 🧱 stack: documentation Related to Sphinx documentation 🧱 stack: frontend Related to the Nuxt frontend 🟨 priority: medium Not blocking but should be addressed soon 🧰 goal: internal improvement Improvement that benefits maintainers, not users 💻 aspect: code Concerns the software code in the repository labels Dec 20, 2024
@obulat obulat force-pushed the fix/sentry-client-setup branch from 8588c4c to 0f7ee99 Compare December 20, 2024 07:23
Copy link

github-actions bot commented Dec 20, 2024

Latest k6 run output1

     ✓ status was 200

     checks.........................: 100.00% ✓ 410      ✗ 0   
     data_received..................: 95 MB   394 kB/s
     data_sent......................: 54 kB   223 B/s
     http_req_blocked...............: avg=52.37µs  min=2.33µs   med=4.65µs   max=7.39ms   p(90)=146.1µs  p(95)=161.68µs
     http_req_connecting............: avg=39.73µs  min=0s       med=0s       max=7.34ms   p(90)=101.47µs p(95)=111.53µs
     http_req_duration..............: avg=162.17ms min=17.31ms  med=118.04ms max=1.02s    p(90)=343.62ms p(95)=473.11ms
       { expected_response:true }...: avg=162.17ms min=17.31ms  med=118.04ms max=1.02s    p(90)=343.62ms p(95)=473.11ms
   ✓ http_req_failed................: 0.00%   ✓ 0        ✗ 410 
     http_req_receiving.............: avg=175.81µs min=54.23µs  med=145.53µs max=684.72µs p(90)=286.47µs p(95)=378.59µs
     http_req_sending...............: avg=25.2µs   min=8.46µs   med=23.67µs  max=76.33µs  p(90)=36.83µs  p(95)=41.14µs 
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=161.97ms min=17.18ms  med=117.85ms max=1.02s    p(90)=343.44ms p(95)=472.72ms
     http_reqs......................: 410     1.701842/s
     iteration_duration.............: avg=882.06ms min=323.78ms med=936.39ms max=1.74s    p(90)=1.13s    p(95)=1.49s   
     iterations.....................: 76      0.315463/s
     vus............................: 3       min=0      max=6 
     vus_max........................: 60      min=60     max=60

Footnotes

  1. This comment will automatically update with new output each time k6 runs for this PR

Copy link

Full-stack documentation: https://docs.openverse.org/_preview/5297

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.

@obulat obulat marked this pull request as ready for review December 20, 2024 08:53
@obulat obulat requested a review from a team as a code owner December 20, 2024 08:53
@obulat obulat requested review from krysal and dhruvkb December 20, 2024 08:53
@@ -108,7 +108,7 @@
"npm-run-all2": "^7.0.0",
"nuxt": "^3.14.1592",
"rimraf": "^6.0.1",
"storybook": "^8.3.6",
"storybook": "8.3.6",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The CI was failing because it was using the latest Storybook version

Copy link
Member

Choose a reason for hiding this comment

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

What a weird error to have!


return await $fetch<MediaProvider[]>(
`${apiUrl}v1/${mediaSlug(mediaType)}/stats/`,
{
headers: {
...getProxyRequestHeaders(event),
...userAgentHeader,
"Content-Type": "application/json",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the headers to handle the fluke when sometimes the API returns HTML response.

Copy link
Member

@dhruvkb dhruvkb left a comment

Choose a reason for hiding this comment

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

LGTM, appreciate the additional button to test this from the preferences page.

consola.info(`Fetching sources for ${mediaType} media`)
consola.info(`Fetching ${mediaType} sources.`)
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for making the logs more grammatically correct 😁.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🟨 priority: medium Not blocking but should be addressed soon 🧱 stack: documentation Related to Sphinx documentation 🧱 stack: frontend Related to the Nuxt frontend
Projects
Status: ✅ Approved
Development

Successfully merging this pull request may close these issues.

Sentry release is not set in the Nuxt client
3 participants