Skip to content

Commit

Permalink
server: consistently log request_id at the same level
Browse files Browse the repository at this point in the history
GITHUB_PR_NUMBER: 6244
GITHUB_PR_URL: hasura#6244

Co-authored-by: José Lorenzo Rodríguez <37621+lorenzo@users.noreply.github.com>
GitOrigin-RevId: fef22d9
  • Loading branch information
hasura-bot and lorenzo committed Jan 19, 2021
1 parent bd2e6a0 commit 38fc4cb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ and be accessible according to the permissions that were configured for the role
- server: fix issue with non-optional fields of the remote schema being added as optional in the graphql-engine (fix #6401)
- server: accept new config `allowed_skew` in JWT config to provide leeway for JWT expiry (fixes #2109)
- server: fix issue with query actions with relationship with permissions configured on the remote table (fix #6385)
- server: always log the `request_id` at the `detail.request_id` path for both `query-log` and `http-log` (#6244)
- server: fix issue with `--stringify-numeric-types` not stringifying aggregate fields (fix #5704)
- console: allow user to cascade Postgres dependencies when dropping Postgres objects (close #5109) (#5248)
- console: mark inconsistent remote schemas in the UI (close #5093) (#5181)
Expand Down
1 change: 1 addition & 0 deletions docs/graphql/core/deployment/logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ This is how the HTTP access logs look like:
"level": "info",
"type": "http-log",
"detail": {
"request_id": "072b3617-6653-4fd5-b5ee-580e9d098c3d",
"operation": {
"query_execution_time": 0.009240042,
"user_vars": {
Expand Down
5 changes: 3 additions & 2 deletions server/src-lib/Hasura/Server/Logging.hs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ data HttpLogContext
= HttpLogContext
{ hlcHttpInfo :: !HttpInfoLog
, hlcOperation :: !OperationLog
, hlcRequestId :: !RequestId
} deriving (Show, Eq)
$(deriveToJSON (aesonDrop 3 snakeCase) ''HttpLogContext)

Expand Down Expand Up @@ -236,7 +237,7 @@ mkHttpAccessLogContext userInfoM reqId req res mTiming compressTypeM headers =
, olRawQuery = Nothing
, olError = Nothing
}
in HttpLogContext http op
in HttpLogContext http op reqId
where
status = HTTP.status200
respSize = Just $ BL.length res
Expand Down Expand Up @@ -272,7 +273,7 @@ mkHttpErrorLogContext userInfoM reqId waiReq (reqBody, parsedReq) err mTiming co
, olRawQuery = maybe (Just $ bsToTxt $ BL.toStrict reqBody) (const Nothing) parsedReq
, olError = Just err
}
in HttpLogContext http op
in HttpLogContext http op reqId

data HttpLogLine
= HttpLogLine
Expand Down

0 comments on commit 38fc4cb

Please sign in to comment.