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

BugFixes: Misc Performance Updates and Related Cleanup #1174

Merged
merged 15 commits into from
Dec 7, 2023
Merged

Conversation

NickPhura
Copy link
Collaborator

@NickPhura NickPhura commented Nov 21, 2023

Links to Jira Tickets

n/a

Description of Changes

  • Adjust API memory settings, set node env properly, adjust log levels

    • Added a NODE_OPTIONS pipeline param so that the max heap size is getting set explicitly. (I noticed in the pods in dev that despite the deploy config specifying 2Gig max memory, the max heap size was only 1Gig).
  • Some misc pipeline cleanup around env vs nodeEnv.

    • Some of the same keys were being referenced from different objects for different purposes, and it was getting a bit hard to track. So now env is the pipeline phase, and nodeEnv is the node environment variable.
    • Also tried to cleanup our node_env vars in general. We had a mixture of 'dev', 'test', 'prod', etc, which aren't even the ones that node/react look for. So now it should just be 'development' and 'production'.
  • Tweak parameters of trace command

  • Update tsconfigs

  • Pin zod package version, Remove some unused packages

    • Was some talk on the zod repo about possible issues with newer versions of typescript. Nothing concrete or certain if it was due to zod or typescript, but just to be safe, pinning the version to what we have now.
  • Simplify zod geojson schema

    • Only used in 1 spot in one of the bctw services. But, in an effort to prevent zod from taking a long time to process on large geometries, I simplified them to just check the top level structure, and not dig into every sub level.
  • Remove zod from keycloak token type definitions (hotspot).

    • Was flagged as a hotspot, and we never really used them that much. Also, since we get those tokens from the gov keycloak, parsing them shouldn't be needed, as if they change unexpected the app is going to break regardless.
  • Disable zod database response parsing in production.

  • New: Add query and zod timers in development.

    • In non-production, if you set LOG_LEVEL=silly it will log timers for the database query execution and subsequent zod schema parsing.
  • BugFix: Allow surveys to be created with $0 amounts.

    • Just had a bad falsy check that turned '0' into 'null'

Testing Notes

Everything works as before.

@NickPhura NickPhura added the Early Feedback Welcome PR is not finished, but early review feedback is welcomed label Nov 21, 2023
Copy link

codecov bot commented Nov 21, 2023

Codecov Report

Attention: 23 lines in your changes are missing coverage. Please review.

Comparison is base (311c5fd) 60.17% compared to head (dfb57d8) 60.09%.

Files Patch % Lines
api/src/database/db.ts 31.03% 18 Missing and 2 partials ⚠️
api/src/models/survey-create.ts 0.00% 1 Missing ⚠️
api/src/models/survey-update.ts 0.00% 0 Missing and 1 partial ⚠️
api/src/models/survey-view.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1174      +/-   ##
==========================================
- Coverage   60.17%   60.09%   -0.08%     
==========================================
  Files         569      569              
  Lines       17202    17160      -42     
  Branches     2668     2658      -10     
==========================================
- Hits        10352    10313      -39     
  Misses       6167     6167              
+ Partials      683      680       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

curtisupshall
curtisupshall previously approved these changes Nov 21, 2023
Copy link
Contributor

@curtisupshall curtisupshall left a comment

Choose a reason for hiding this comment

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

Code looks good to me!

api/src/database/db.ts Show resolved Hide resolved
@NickPhura NickPhura added Ready For Review PR is ready for review and removed Early Feedback Welcome PR is not finished, but early review feedback is welcomed labels Nov 22, 2023
Copy link
Contributor

@curtisupshall curtisupshall left a comment

Choose a reason for hiding this comment

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

Tested locally; everything works as expected. ✅

Copy link

sonarqubecloud bot commented Dec 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Contributor

@al-rosenthal al-rosenthal left a comment

Choose a reason for hiding this comment

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

🦆

@KjartanE KjartanE self-assigned this Dec 7, 2023
@al-rosenthal al-rosenthal self-requested a review December 7, 2023 19:09
Copy link
Contributor

@al-rosenthal al-rosenthal left a comment

Choose a reason for hiding this comment

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

🍖

Copy link
Contributor

@KjartanE KjartanE left a comment

Choose a reason for hiding this comment

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

🐈

@KjartanE KjartanE merged commit c387d81 into dev Dec 7, 2023
18 of 20 checks passed
@KjartanE KjartanE deleted the npBugFixes branch December 7, 2023 19:18
KjartanE pushed a commit that referenced this pull request Dec 7, 2023
* Adjust API memory settings, set node env properly, adjust log levels
* Simplify zod geojson schema
* Remove zod from keycloak token type definitions (hotspot).
Disable zod database response parsing in production.
Add query and zod timers in development.
* BugFix: Allow surveys to be created with $0 amounts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review PR is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants