Skip to content

Commit

Permalink
Limit the size of query logging
Browse files Browse the repository at this point in the history
Reviewed By: iamirzhan

Differential Revision: D64970166

fbshipit-source-id: dbaff770fc7a0b45af469648f92d27ba693cc00f
  • Loading branch information
Simon Marlow authored and facebook-github-bot committed Oct 25, 2024
1 parent 31524e4 commit 3175a2f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion glean/db/Glean/Backend/Logging.hs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ runLogQuery cmd env repo Thrift.UserQuery{..} log = do
runLogRepo cmd env repo $ mconcat
[ log
, Logger.SetQuery
(Text.decodeUtf8With Text.lenientDecode userQuery_query)
(Text.decodeUtf8With Text.lenientDecode $
if ByteString.length userQuery_query > 1024
then "[truncated] " <> ByteString.take 1024 userQuery_query
else userQuery_query)
, Logger.SetPredicate userQuery_predicate
, maybe mempty (Logger.SetPredicateVersion . fromIntegral)
userQuery_predicate_version
Expand Down

0 comments on commit 3175a2f

Please sign in to comment.