Skip to content

Commit

Permalink
feat: Add SERVICE_NAME to metadata to track in LiteralAI
Browse files Browse the repository at this point in the history
  • Loading branch information
yoomlam committed Jun 9, 2024
1 parent 2468f25 commit 565a507
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ jobs:
"command": [],
"environment": {
"ENV": "PROD",
"SERVICE_NAME": "$SERVICE_NAME",
"DEPLOYMENT_DATE": "$DEPLOYMENT_DATE",
"BUILD_DATE": "$BUILD_DATE",
"BUILD_FOLDER": "${{ inputs.dockerfile_folder }}",
Expand Down
8 changes: 7 additions & 1 deletion 05-assistive-chatbot/chatbot-chainlit.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,20 @@ async def init_chat():
git_sha = os.environ.get("GIT_SHA", "")
build_date = os.environ.get("BUILD_DATE", "unknown")
initial_settings = chatbot.create_init_settings()
service_name = os.environ.get("SERVICE_NAME", "n/a")
metadata = {
**initial_settings,
"build_date": build_date,
"git_sha": git_sha,
"service_name": service_name,
"hostname": socket.gethostname(),
}

await cl.Message(metadata=metadata, content=f"Welcome to the Assistive Chat prototype (built {build_date})").send()
await cl.Message(
metadata=metadata,
disable_feedback=True,
content=f"Welcome to the Assistive Chat prototype (built {build_date})",
).send()

available_llms = llms.available_llms()
# https://docs.chainlit.io/api-reference/chat-settings
Expand Down
3 changes: 2 additions & 1 deletion 05-assistive-chatbot/chatbot_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ async def healthcheck(request: Request):

git_sha = os.environ.get("GIT_SHA", "")
build_date = os.environ.get("BUILD_DATE", "")
service_name = os.environ.get("SERVICE_NAME", "")
hostname = f"{platform.node()} {socket.gethostname()}"

logger.info("Returning: Healthy %s %s", build_date, git_sha)
return HTMLResponse(f"Healthy {git_sha} built at {build_date}<br/>{hostname}")
return HTMLResponse(f"Healthy {git_sha} built at {build_date}<br/>{service_name} {hostname}")


ALLOWED_ENV_VARS = [
Expand Down

0 comments on commit 565a507

Please sign in to comment.