Skip to content

Commit

Permalink
Set latency log to info level
Browse files Browse the repository at this point in the history
  • Loading branch information
jstray committed Sep 3, 2024
1 parent 19fb260 commit 984fa06
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions perspective_ranker.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ async def score(self, attributes, statement, statement_id):
"requestedAttributes": {attr: {} for attr in attributes},
}

logger.info(f"Sending request to Perspective API for statement_id: {statement_id}")
# logger.debug(f"Request payload: {data}") don't log text, it's sensitive
logger.debug(f"Sending request to Perspective API for statement_id: {statement_id}")

try:
response = await self.client.post(
Expand All @@ -221,8 +220,6 @@ async def score(self, attributes, statement, statement_id):
response.raise_for_status()
response_json = await response.json()

# logger.debug(f"Response for statement_id {statement_id}: {response_json}")

results = []
scorable = True
for attr in attributes:
Expand Down Expand Up @@ -316,7 +313,7 @@ async def main(ranking_request: RankingRequest) -> RankingResponse:

latency = time.time() - start_time
logger.debug(f"ranking results: {results}")
logger.debug(f"ranking {len(results["ranked_ids"])} items took time: {latency}")
logger.info(f"ranking {len(results["ranked_ids"])} items took time: {latency}")

# Record metrics
rank_calls.inc()
Expand Down

0 comments on commit 984fa06

Please sign in to comment.