[PR #463] [MERGED] feat: track deployment and service status with Prometheus #480

Closed
opened 2026-02-16 02:15:03 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/run-llama/llama_deploy/pull/463
Author: @masci
Created: 2/13/2025
Status: Merged
Merged: 2/14/2025
Merged by: @masci

Base: mainHead: massi/stats


📝 Commits (3)

  • 8cb030e track deployment and service status
  • aa1d353 ignore prometheus metrics definition in test coverage
  • 424e15b fix copypasta

📊 Changes

4 files changed (+53 additions, -1 deletions)

View changed files

📝 llama_deploy/apiserver/deployment.py (+10 -0)
📝 llama_deploy/apiserver/server.py (+4 -0)
llama_deploy/apiserver/stats.py (+36 -0)
📝 pyproject.toml (+3 -1)

📄 Description

After requesting the API Server to create a deployment, some time can pass in order to fetch the code, install dependencies and setting up all the LlamaDeploy components that are needed.

With this PR we track in Prometheus the intermediate states for the API Server itself, a deployment and its services.
We also need better logging but I won't add it here to ease the review.

Resulting metrics:

# HELP deployment_state Current state of a deployment
# TYPE deployment_state gauge
deployment_state{deployment_name="QuickStart",deployment_state="loading_services"} 0.0
deployment_state{deployment_name="QuickStart",deployment_state="ready"} 0.0
deployment_state{deployment_name="QuickStart",deployment_state="starting_services"} 1.0
deployment_state{deployment_name="QuickStart",deployment_state="running"} 0.0
deployment_state{deployment_name="QuickStart",deployment_state="stopped"} 0.0
# HELP service_state Current state of a service attached to a deployment
# TYPE service_state gauge
service_state{deployment_name="QuickStart",service_name="dummy_workflow",service_state="loading"} 0.0
service_state{deployment_name="QuickStart",service_name="dummy_workflow",service_state="syncing"} 0.0
service_state{deployment_name="QuickStart",service_name="dummy_workflow",service_state="installing"} 0.0
service_state{deployment_name="QuickStart",service_name="dummy_workflow",service_state="ready"} 1.0

(when a state goes to 1.0 the others switch to 0.0)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/run-llama/llama_deploy/pull/463 **Author:** [@masci](https://github.com/masci) **Created:** 2/13/2025 **Status:** ✅ Merged **Merged:** 2/14/2025 **Merged by:** [@masci](https://github.com/masci) **Base:** `main` ← **Head:** `massi/stats` --- ### 📝 Commits (3) - [`8cb030e`](https://github.com/run-llama/llama_deploy/commit/8cb030e757c69eebf1b33fa01d004977a5fdc7c7) track deployment and service status - [`aa1d353`](https://github.com/run-llama/llama_deploy/commit/aa1d35391d1ba9effd8a287496631bc64696b06d) ignore prometheus metrics definition in test coverage - [`424e15b`](https://github.com/run-llama/llama_deploy/commit/424e15b190e5b216cbeca3a39702a407410469dc) fix copypasta ### 📊 Changes **4 files changed** (+53 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `llama_deploy/apiserver/deployment.py` (+10 -0) 📝 `llama_deploy/apiserver/server.py` (+4 -0) ➕ `llama_deploy/apiserver/stats.py` (+36 -0) 📝 `pyproject.toml` (+3 -1) </details> ### 📄 Description After requesting the API Server to create a deployment, some time can pass in order to fetch the code, install dependencies and setting up all the LlamaDeploy components that are needed. With this PR we track in Prometheus the intermediate states for the API Server itself, a deployment and its services. We also need better logging but I won't add it here to ease the review. Resulting metrics: ``` # HELP deployment_state Current state of a deployment # TYPE deployment_state gauge deployment_state{deployment_name="QuickStart",deployment_state="loading_services"} 0.0 deployment_state{deployment_name="QuickStart",deployment_state="ready"} 0.0 deployment_state{deployment_name="QuickStart",deployment_state="starting_services"} 1.0 deployment_state{deployment_name="QuickStart",deployment_state="running"} 0.0 deployment_state{deployment_name="QuickStart",deployment_state="stopped"} 0.0 # HELP service_state Current state of a service attached to a deployment # TYPE service_state gauge service_state{deployment_name="QuickStart",service_name="dummy_workflow",service_state="loading"} 0.0 service_state{deployment_name="QuickStart",service_name="dummy_workflow",service_state="syncing"} 0.0 service_state{deployment_name="QuickStart",service_name="dummy_workflow",service_state="installing"} 0.0 service_state{deployment_name="QuickStart",service_name="dummy_workflow",service_state="ready"} 1.0 ``` (when a state goes to 1.0 the others switch to 0.0) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 02:15:03 -05:00
yindo closed this issue 2026-02-16 02:15:03 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/llama_deploy#480