From 2c6a2944e42762fb9b98c0168976e72b89ce07d0 Mon Sep 17 00:00:00 2001 From: Louis Beaumont Date: Wed, 7 Dec 2022 13:34:49 +0100 Subject: [PATCH] 1.4.0: fix ci cd --- run/collection/logic.py | 17 +++++++++++++---- setup.py | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/run/collection/logic.py b/run/collection/logic.py index 2941b93..6f36960 100644 --- a/run/collection/logic.py +++ b/run/collection/logic.py @@ -1,6 +1,7 @@ import os import logging from datetime import datetime +import time from typing import Optional from flask import request, jsonify import sentry_sdk @@ -154,7 +155,10 @@ async def create_starter(): 400, {}, ) - with sentry_sdk.start_transaction(op="task", name="request_starter_for_service"): + start_time = time.time() + with sentry_sdk.start_transaction( + op="task", name="request_starter_for_service" + ) as span: # https://cloud.google.com/run/docs/tips/general#avoid_background_activities_if_cpu_is_allocated_only_during_request_processing conversation_starters, error = await request_starter_for_service( api_key_doc=api_key_doc, @@ -166,9 +170,14 @@ async def create_starter(): profanity_threshold="open", personas=personas, ) - logger.info( - f"Got conversation starter response: {conversation_starters} error: {error}" - ) + end_time = time.time() + span.set_data("duration", end_time - start_time) + span.set_data("conversation_starters", conversation_starters) + span.set_data("error", error) + logger.info( + f"Got conversation starter response: {conversation_starters} error: {error}" + + f" in {end_time - start_time} seconds" + ) if error: return ( diff --git a/setup.py b/setup.py index 1f58ecb..f3f5c56 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ name="langame", packages=find_packages(), include_package_data=True, - version="1.3.8", + version="1.4.0", description="", install_requires=[ "firebase_admin",