feat(cg1+cg2): expose billing endpoints in Cloud Run agent
This commit is contained in:
parent
c0a248948f
commit
a82c07e692
25
main.py
25
main.py
|
|
@ -237,6 +237,31 @@ def telemetry_history(limit: int = 50):
|
|||
return {"history": get_store().history(limit=limit)}
|
||||
|
||||
|
||||
@app.get("/billing/summary")
|
||||
def get_billing_summary():
|
||||
try:
|
||||
agent = BillingAgent()
|
||||
return agent.get_summary()
|
||||
except Exception as e:
|
||||
return {"error": str(e)}
|
||||
|
||||
@app.get("/billing/forecast")
|
||||
def get_billing_forecast():
|
||||
try:
|
||||
agent = BillingAgent()
|
||||
return agent.get_forecast()
|
||||
except Exception as e:
|
||||
return {"error": str(e)}
|
||||
|
||||
@app.get("/billing/anomalies")
|
||||
def get_billing_anomalies():
|
||||
try:
|
||||
detector = AnomalyDetector()
|
||||
return detector.detect_anomalies()
|
||||
except Exception as e:
|
||||
return {"error": str(e)}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
port = int(os.environ.get("PORT", 8080))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user