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(RHINENG-10654): Reimplement Sentry #2881

Merged
merged 3 commits into from
Oct 4, 2024

Conversation

adonispuente
Copy link
Contributor

@adonispuente adonispuente commented Jun 28, 2024

This reconfigures sentry so that it handles multiple frontends properly with chrome being the wrapper.
Currently there are a few changes I need to make in the settings of the repo itself to add secret keys to the environment, as well as a CI/CD addition, but these changes will allow the projects to be better monitored. I dont have perms for this and will ping platform team in regards to the set up aspect, those changes must be merged for this to work at all

This is step 1, but by the end, ideally, the cp-001 project will only report errors sentry deems is from chrome, and all the apps will have their own projects where we can monitor the health of specific apps.
All the apps would need to do after this is done is have a similar PR like this : https://github.com/RedHatInsights/insights-advisor-frontend/pull/1268/files
and then some CI/CD changes + secret variables added

https://issues.redhat.com/browse/RHINENG-10654

@adonispuente adonispuente changed the title New sentry fix(RHINENG-10654): Reimplement Sentry Jun 28, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jun 28, 2024

Codecov Report

Attention: Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.

Project coverage is 48.00%. Comparing base (67d7d4a) to head (f49af70).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #2881       +/-   ##
===========================================
- Coverage   63.44%   48.00%   -15.44%     
===========================================
  Files         202      105       -97     
  Lines        4650     2552     -2098     
  Branches      858      468      -390     
===========================================
- Hits         2950     1225     -1725     
+ Misses       1689      917      -772     
- Partials       11      410      +399     
Files Coverage Δ
src/utils/sentry.ts 0.00% <0.00%> (-16.22%) ⬇️

... and 174 files with indirect coverage changes

config/webpack.config.js Outdated Show resolved Hide resolved
config/webpack.plugins.js Outdated Show resolved Hide resolved
Copy link
Contributor

@Hyperkid123 Hyperkid123 left a comment

Choose a reason for hiding this comment

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

Exposed federated modules are failing to be build. Here is the common error:

ERROR in ./src/components/FavoriteServices/DashboardFavorites.tsx
Module build failed (from ./node_modules/swc-loader/src/index.js):
Error: Bindings not found.
    at Compiler.<anonymous> (/home/martin/insights/insights-chrome/node_modules/@swc/core/index.js:227:19)
    at Generator.next (<anonymous>)
    at /home/martin/insights/insights-chrome/node_modules/@swc/core/index.js:31:71
    at new Promise (<anonymous>)
    at __awaiter (/home/martin/insights/insights-chrome/node_modules/@swc/core/index.js:27:12)
    at Compiler.transform (/home/martin/insights/insights-chrome/node_modules/@swc/core/index.js:203:16)
    at Object.transform (/home/martin/insights/insights-chrome/node_modules/@swc/core/index.js:352:21)
    at Object.<anonymous> (/home/martin/insights/insights-chrome/node_modules/swc-loader/src/index.js:97:21)
 @ container entry ./DashboardFavorites[0]

config/webpack.plugins.js Outdated Show resolved Hide resolved
src/utils/sentry.ts Show resolved Hide resolved
src/utils/sentry.ts Outdated Show resolved Hide resolved
@adonispuente adonispuente force-pushed the newSentry branch 2 times, most recently from 8664357 to e0ebc19 Compare July 10, 2024 21:05
@adonispuente
Copy link
Contributor Author

Exposed federated modules are failing to be build. Here is the common error:

ERROR in ./src/components/FavoriteServices/DashboardFavorites.tsx
Module build failed (from ./node_modules/swc-loader/src/index.js):
Error: Bindings not found.
    at Compiler.<anonymous> (/home/martin/insights/insights-chrome/node_modules/@swc/core/index.js:227:19)
    at Generator.next (<anonymous>)
    at /home/martin/insights/insights-chrome/node_modules/@swc/core/index.js:31:71
    at new Promise (<anonymous>)
    at __awaiter (/home/martin/insights/insights-chrome/node_modules/@swc/core/index.js:27:12)
    at Compiler.transform (/home/martin/insights/insights-chrome/node_modules/@swc/core/index.js:203:16)
    at Object.transform (/home/martin/insights/insights-chrome/node_modules/@swc/core/index.js:352:21)
    at Object.<anonymous> (/home/martin/insights/insights-chrome/node_modules/swc-loader/src/index.js:97:21)
 @ container entry ./DashboardFavorites[0]

I believe the issue is the tsconfig, "sourceRoot": "/",
This is needed for sentry to map against hidden source maps. Looking into the most non-hacky solution i can come up with.

@adonispuente
Copy link
Contributor Author

ci keeps failing because it cant find the container for this PR

@adonispuente
Copy link
Contributor Author

/retest

1 similar comment
@adonispuente
Copy link
Contributor Author

/retest

@adonispuente
Copy link
Contributor Author

converting to draft for a bit. I need to find a better way to map the source maps. there are too many with no refs

@adonispuente
Copy link
Contributor Author

it fails because the package.json file is missing from the directory /opt/app-root/src/ inside the container. Has this happened before? @Hyperkid123

@Hyperkid123
Copy link
Contributor

@adonispuente you can ignore the Jenkins issues. The pipeline is broken nd will be fixed once we migrate to konflux.

@Hyperkid123 Hyperkid123 requested a review from a team September 12, 2024 08:35
@adonispuente
Copy link
Contributor Author

/retest

@BlakeHolifield
Copy link
Contributor

Just a heads up, this PR seems to be causing a webpack-dev-server issue and looping forever in some jenkins jobs.

12:21:01 [webpack-cli] TypeError: Cannot read properties of undefined (reading 'constructor')
12:21:01     at /home/tester/workspace/node_modules/webpack-dev-server/lib/Server.js:1860:22
12:21:01     at Array.find (<anonymous>)
12:21:01     at /home/tester/workspace/node_modules/webpack-dev-server/lib/Server.js:1859:60
12:21:01     at Array.forEach (<anonymous>)
12:21:01     at Server.initialize (/home/tester/workspace/node_modules/webpack-dev-server/lib/Server.js:1846:17)
12:21:01     at Server.start (/home/tester/workspace/node_modules/webpack-dev-server/lib/Server.js:3358:16)
12:21:01     at async Command.<anonymous> (/home/tester/workspace/node_modules/@webpack-cli/serve/lib/index.js:158:21)
12:21:01     at async Command.parseAsync (/home/tester/workspace/node_modules/commander/lib/command.js:935:5)
12:21:01     at async Command.<anonymous> (/home/tester/workspace/node_modules/webpack-cli/lib/webpack-cli.js:1356:13)
12:21:01     at async Command.parseAsync (/home/tester/workspace/node_modules/commander/lib/command.js:935:5)
12:21:03 making HTTP(S) head request to  url:https://127.0.0.1:1337/webpack-dev-server ...
12:21:03 (node:82) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS

@adonispuente
Copy link
Contributor Author

/retest

@adonispuente
Copy link
Contributor Author

@Hyperkid12 Everything else is passing other than synk. I dont have access to view why its failing. Can you give me perms?

@Hyperkid123
Copy link
Contributor

@Hyperkid12 Everything else is passing other than synk. I dont have access to view why its failing. Can you give me perms?

It's just a random thing in package.json nothing you should need to be worried about.

Copy link
Contributor

@Hyperkid123 Hyperkid123 left a comment

Choose a reason for hiding this comment

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

Something is wrong with the build process. Here is how I can reproduce issues in my machine.

  1. run npm ci
  2. run npm run build
  3. run npm i
  4. run npm run build

If I try to run build after regular dependency install, the build fails with:

assets by status 9.45 KiB [cached] 8 assets
runtime modules 9.36 KiB 14 modules
built modules 237 bytes [built]
  modules by path ./src/components/FavoriteServices/*.tsx 78 bytes
    ./src/components/FavoriteServices/LandingNavFavorites.tsx 39 bytes [built] [code generated] [1 error]
    ./src/components/FavoriteServices/DashboardFavorites.tsx 39 bytes [built] [code generated] [1 error]
  ./src/index.ts 39 bytes [built] [code generated] [1 error]
  container entry 42 bytes [built] [code generated]
  ./src/pdf/DownloadButton.tsx 39 bytes [built] [code generated] [1 error]
  ./src/layouts/SatelliteToken.tsx 39 bytes [built] [code generated] [1 error]

ERROR in ./src/components/FavoriteServices/DashboardFavorites.tsx
Module build failed (from ./node_modules/swc-loader/src/index.js):
Error: Bindings not found.
    at Compiler.<anonymous> (/Users/martin/insights/insights-chrome/node_modules/@swc/core/index.js:227:19)
    at Generator.next (<anonymous>)
    at /Users/martin/insights/insights-chrome/node_modules/@swc/core/index.js:31:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/martin/insights/insights-chrome/node_modules/@swc/core/index.js:27:12)
    at Compiler.transform (/Users/martin/insights/insights-chrome/node_modules/@swc/core/index.js:203:16)
    at Object.transform (/Users/martin/insights/insights-chrome/node_modules/@swc/core/index.js:352:21)
    at Object.<anonymous> (/Users/martin/insights/insights-chrome/node_modules/swc-loader/src/index.js:97:21)
 @ container entry ./DashboardFavorites[0]

...

Until this is eliminated, I can't merge the PR.

config/webpack.config.js Outdated Show resolved Hide resolved
config/webpack.plugins.js Outdated Show resolved Hide resolved
@adonispuente adonispuente force-pushed the newSentry branch 10 times, most recently from a78614f to 15847d2 Compare September 30, 2024 18:59
@adonispuente
Copy link
Contributor Author

@Hyperkid123 After investigating the issue you described, this seems to be an issue with master branch. Currently on master,

Deleteing package.lock file and then running clear && rm -rf node_modules && npm i && npm run build and then trying to run cypress test npm run test:ct, you will encounter the errors you mentioned above as well as some other issues. The swc issue seems to be unrelated to this PR.

@Hyperkid123
Copy link
Contributor

@adonispuente we do not have the build issues on other branches. The changes to the build must be the root cause. The cypress component tests have their own webpack configuration. I suggest trying to poking awround there.

@adonispuente
Copy link
Contributor Author

@Hyperkid123 I believe we're ok now. I wasnt able to replicate the errors you mentioned after running your flow with this version of the PR.

@Hyperkid123
Copy link
Contributor

@adonispuente when i run npm i I still have some changes in the lock file. Can you update it?

Other than that I think we are good now. let me just do one more pass over the code.

config/webpack.config.js Outdated Show resolved Hide resolved
config/webpack.plugins.js Outdated Show resolved Hide resolved
@Hyperkid123 Hyperkid123 closed this Oct 3, 2024
@Hyperkid123 Hyperkid123 reopened this Oct 3, 2024
@Hyperkid123 Hyperkid123 merged commit 4991bb3 into RedHatInsights:master Oct 4, 2024
9 of 11 checks passed
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.

4 participants