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

Enhancement/request logs #140

Merged
merged 10 commits into from
Jan 10, 2023
Merged

Enhancement/request logs #140

merged 10 commits into from
Jan 10, 2023

Conversation

lok52
Copy link
Collaborator

@lok52 lok52 commented Jan 9, 2023

Changes:

  • Request data is logged to console, as well as to a file. You can specify ignored routes (for console logging), space separated, via RELAYER_LOG_IGNORE_ROUTES env, e.g. /fee /params/hash/tx. Also, I removed some common headers from requests to not flood the logs. Example request log:
info: HTTP GET /params/hash/tree {"meta":{"req":{"headers":{"host":"127.0.0.1:8000","user-agent":"PostmanRuntime/7.30.0"},"httpVersion":"1.1","method":"GET","originalUrl":"/params/hash/tree","query":{},"url":"/params/hash/tree"},"res":{"statusCode":200},"responseTime":1}}

Closes #67

This PR should be considered as a draft, so any suggestions about logs format are welcome.

@akolotov
Copy link

akolotov commented Jan 9, 2023

Consider to reduce the level for the http data to debug as so it is possible to filter it by setting RELAYER_LOG_LEVEL to info.

@lok52
Copy link
Collaborator Author

lok52 commented Jan 9, 2023

Updates:

  • Set level to debug
  • Removed duplicated properties from request log, such as url, originalUrl, query, method

Now, log looks like this:

debug: HTTP GET /siblings?index=10 {"meta":{"req":{"headers":{"host":"127.0.0.1:8000","user-agent":"PostmanRuntime/7.30.0"},"httpVersion":"1.1"},"res":{"statusCode":400},"responseTime":4},"timestamp":"2023-01-09T14:15:11.570Z"}

zp-relayer/index.ts Outdated Show resolved Hide resolved
zp-relayer/config.ts Show resolved Hide resolved
zp-relayer/services/loggerMiddleware.ts Outdated Show resolved Hide resolved
zp-relayer/config.ts Show resolved Hide resolved
@r0wdy1 r0wdy1 requested a review from akolotov January 10, 2023 15:17
zp-relayer/config.ts Show resolved Hide resolved
@akolotov akolotov merged commit f9fc9f6 into devel Jan 10, 2023
@akolotov akolotov deleted the enhancement/request-logs branch January 10, 2023 18:16
akolotov added a commit that referenced this pull request Jan 17, 2023
This merge contains the following set of changes:
  - Add debug log for RPC request errors (#131)
  - Add internal account validation (#135)
  - Add counter exceeded check for re-sent iterations (#138)
  - Improvement of logging requests to relayer (#140)
  - Fix failed contract calls (#145)
akolotov added a commit that referenced this pull request Jan 30, 2023
This merge contains the following set of changes:
  - Add debug log for RPC request errors (#131)
  - Add internal account validation (#135)
  - Add counter exceeded check for re-sent iterations (#138)
  - Improvement of logging requests to relayer (#140)
  - Fix failed contract calls (#145)
  - Add missed log (#149)
  - Add poolId validation (#154)
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.

Extend debug info with HTTP requests and response
3 participants