Skip to content

Commit

Permalink
truncate log message on large query body
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdunnjpl committed Dec 20, 2023
1 parent 8f5e560 commit 747a159
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pds/registrysweepers/utils/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ def query_registry_db(
scroll_keepalive = f"{scroll_keepalive_minutes}m"
request_timeout = 20
query_id = get_random_hex_id() # This is just used to differentiate queries during logging
log.info(f"Initiating query with id {query_id}: {json.dumps(query)}")

full_query_content = json.dumps(query)
logged_query_content = full_query_content if len(full_query_content) < 5000 else "<LARGE QUERY CONTENT OMITTED>"
log.info(f"Initiating query with id {query_id}: {logged_query_content}")
served_hits = 0

last_info_log_at_percentage = 0
Expand Down

0 comments on commit 747a159

Please sign in to comment.