mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-14 17:03:29 +03:00
feat: Add telemetry ping task to celery worker and main.py (#2494)
This pull request adds a new telemetry ping task to the celery worker and main.py files. The ping task sends a ping message to the telemetry system.
This commit is contained in:
parent
55b456bfe1
commit
2a25f442e5
@ -20,6 +20,7 @@ from modules.onboarding.service.onboarding_service import OnboardingService
|
||||
from packages.files.crawl.crawler import CrawlWebsite
|
||||
from packages.files.parsers.github import process_github
|
||||
from packages.files.processors import filter_file
|
||||
from packages.utils.telemetry import maybe_send_telemetry
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
@ -181,6 +182,11 @@ def process_integration_brain_sync_user_brain(brain_id, user_id):
|
||||
notion_connector.poll()
|
||||
|
||||
|
||||
@celery.task
|
||||
def ping_telemetry():
|
||||
maybe_send_telemetry("ping", {"ping": "pong"})
|
||||
|
||||
|
||||
@celery.task
|
||||
def process_integration_brain_sync():
|
||||
integration = IntegrationBrain()
|
||||
@ -213,4 +219,8 @@ celery.conf.beat_schedule = {
|
||||
"task": f"{__name__}.process_integration_brain_sync",
|
||||
"schedule": crontab(minute="*/5", hour="*"),
|
||||
},
|
||||
"ping_telemetry": {
|
||||
"task": f"{__name__}.ping_telemetry",
|
||||
"schedule": crontab(minute="*/30", hour="*"),
|
||||
},
|
||||
}
|
||||
|
@ -108,6 +108,7 @@ if os.getenv("TELEMETRY_ENABLED") == "true":
|
||||
"To disable telemetry, set the TELEMETRY_ENABLED environment variable to false."
|
||||
)
|
||||
maybe_send_telemetry("booting", {"status": "ok"})
|
||||
maybe_send_telemetry("ping", {"ping": "pong"})
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -142,7 +142,7 @@ def generate_replies(
|
||||
test_groundtruths = test_data.ground_truth.tolist()
|
||||
|
||||
for question in test_questions:
|
||||
response = brain_chain.invoke({"question": question})
|
||||
response = brain_chain.invoke({"question": question, "chat_history": []})
|
||||
answers.append(response["answer"].content)
|
||||
contexts.append([context.page_content for context in response["docs"]])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user