fix /spend logs call

This commit is contained in:
Ishaan Jaff 2024-08-30 17:02:24 -07:00
parent 2c86a62474
commit 06857d108d
2 changed files with 5 additions and 3 deletions

View file

@ -251,7 +251,7 @@ jobs:
command: | command: |
pwd pwd
ls ls
python -m pytest -vv tests/ -x --junitxml=test-results/junit.xml --durations=5 --ignore=tests/otel_tests --ignore=tests/pass_through_tests python -m pytest -s -vv tests/ -x --junitxml=test-results/junit.xml --durations=5 --ignore=tests/otel_tests --ignore=tests/pass_through_tests
no_output_timeout: 120m no_output_timeout: 120m
# Store test results # Store test results

View file

@ -10,6 +10,7 @@ import tempfile
import json import json
import os import os
import pytest import pytest
import asyncio
# Path to your service account JSON file # Path to your service account JSON file
@ -59,13 +60,13 @@ def load_vertex_ai_credentials():
async def call_spend_logs_endpoint(): async def call_spend_logs_endpoint():
""" """
Call this Call this
curl -X GET "http://0.0.0.0:4000/spend/logs?start_date={}" -H "Authorization: Bearer sk-1234" curl -X GET "http://0.0.0.0:4000/spend/logs" -H "Authorization: Bearer sk-1234"
""" """
import datetime import datetime
import requests import requests
todays_date = datetime.datetime.now().strftime("%Y-%m-%d") todays_date = datetime.datetime.now().strftime("%Y-%m-%d")
url = f"http://0.0.0.0:4000/spend/logs?start_date={todays_date}" url = f"http://0.0.0.0:4000/global/spend/logs"
headers = {"Authorization": f"Bearer sk-1234"} headers = {"Authorization": f"Bearer sk-1234"}
response = requests.get(url, headers=headers) response = requests.get(url, headers=headers)
print("response from call_spend_logs_endpoint", response) print("response from call_spend_logs_endpoint", response)
@ -91,6 +92,7 @@ async def test_basic_vertex_ai_pass_through_with_spendlog():
print("response", response) print("response", response)
await asyncio.sleep(3)
_spend_logs_response = await call_spend_logs_endpoint() _spend_logs_response = await call_spend_logs_endpoint()
print("spend logs response", _spend_logs_response) print("spend logs response", _spend_logs_response)