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

Log DB query & environment values #574

Merged
merged 8 commits into from
Aug 29, 2024
Merged

Conversation

kmcginnes
Copy link
Collaborator

@kmcginnes kmcginnes commented Aug 29, 2024

Description

Sends DB query to server to log. Also sends broad context at the explorer request level to the server.

Logging

  • Add DB query string logging to proxy server at debug level
  • Logs client side explorer requests to server at info level
  • Adds explorer request logs to all client side explorers (openCypher and SPARQL)
  • Fix bug in remote logger creation, where the remote logger would never be created
  • Send logs to both client and server when using remote logger
  • Rename logger to remoteLogger to be more clear when it is being used
  • Don't log in the request middleware for path /logger to reduce noise

Environment Values

Reworked how environment values are parsed.

  • Move access to process.env to a single place in env.ts
  • Add Zod schema for environment values the server cares about
    • Default values are used if the key is missing or undefined
  • Parse process.env and print out any errors
    • Any errors will terminate the server

Validation

Logging in app

CleanShot 2024-08-29 at 14 44 34@2x

Logging on server

CleanShot 2024-08-29 at 14 45 39@2x

Parsing environment values successful

CleanShot 2024-08-29 at 14 22 27@2x

Parsing environment values error

CleanShot 2024-08-29 at 14 17 57@2x

Related Issues

Check List

  • I confirm that my contribution is made under the terms of the Apache 2.0
    license.
  • I have run pnpm checks to ensure code compiles and meets standards.
  • I have run pnpm test to check if all tests are passing.
  • I have covered new added functionality with unit tests if necessary.
  • I have added an entry in the Changelog.md.

Copy link

codecov bot commented Aug 29, 2024

Codecov Report

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

Project coverage is 14.43%. Comparing base (a86b9b9) to head (7672bec).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
packages/graph-explorer/src/core/connector.ts 0.00% 19 Missing ⚠️
...rer/src/connector/openCypher/openCypherExplorer.ts 0.00% 11 Missing ⚠️
...-explorer/src/connector/gremlin/gremlinExplorer.ts 0.00% 9 Missing ⚠️
...ph-explorer/src/connector/sparql/sparqlExplorer.ts 0.00% 9 Missing ⚠️
...es/graph-explorer/src/connector/LoggerConnector.ts 0.00% 6 Missing ⚠️
packages/graph-explorer/src/hooks/useSchemaSync.ts 0.00% 6 Missing ⚠️
...ackages/graph-explorer/src/hooks/useExpandNode.tsx 0.00% 2 Missing ⚠️
...ges/graph-explorer-proxy-server/src/node-server.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #574      +/-   ##
==========================================
- Coverage   14.84%   14.43%   -0.41%     
==========================================
  Files         404      564     +160     
  Lines       20296    24832    +4536     
  Branches      997     1129     +132     
==========================================
+ Hits         3013     3585     +572     
- Misses      17006    20915    +3909     
- Partials      277      332      +55     
Flag Coverage Δ
unittests 14.43% <0.00%> (-0.41%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@kmcginnes kmcginnes marked this pull request as ready for review August 29, 2024 19:58
@kmcginnes kmcginnes changed the title Log DB query to server Log DB query & environment values Aug 29, 2024
@kmcginnes kmcginnes merged commit 21a930e into aws:main Aug 29, 2024
1 check passed
@kmcginnes kmcginnes deleted the logging-db-query branch August 29, 2024 22:54
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.

[Task] Add database query logging from client
2 participants