From 3175a2fd6126535fb65f86732e927d48b09a10bb Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Fri, 25 Oct 2024 10:03:01 -0700 Subject: [PATCH] Limit the size of query logging Reviewed By: iamirzhan Differential Revision: D64970166 fbshipit-source-id: dbaff770fc7a0b45af469648f92d27ba693cc00f --- glean/db/Glean/Backend/Logging.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/glean/db/Glean/Backend/Logging.hs b/glean/db/Glean/Backend/Logging.hs index 0cb486844..683eb5f35 100644 --- a/glean/db/Glean/Backend/Logging.hs +++ b/glean/db/Glean/Backend/Logging.hs @@ -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