(Feat) - Allow viewing Request/Response Logs stored in GCS Bucket (#8449)

* BaseRequestResponseFetchFromCustomLogger

* get_active_base_request_response_fetch_from_custom_logger

* get_request_response_payload

* ui_view_request_response_for_request_id

* fix uiSpendLogDetailsCall

* fix get_request_response_payload

* ui fix RequestViewer

* use 1 class AdditionalLoggingUtils

* ui_view_request_response_for_request_id

* cache the prefetch logs details

* refactor prefetch

* test view request/resp logs

* fix code quality

* fix get_request_response_payload

* uninstall posthog
prevent it from being added in ci/cd

* fix posthog

* fix traceloop test

* fix linting error
This commit is contained in:
Ishaan Jaff 2025-02-10 20:38:55 -08:00 committed by GitHub
parent 64a4229606
commit 00c596a852
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 706 additions and 201 deletions

View file

@ -3221,3 +3221,41 @@ export const getGuardrailsList = async (accessToken: String) => {
throw error;
}
};
export const uiSpendLogDetailsCall = async (
accessToken: string,
logId: string,
start_date: string
) => {
try {
// Construct base URL
let url = proxyBaseUrl
? `${proxyBaseUrl}/spend/logs/ui/${logId}?start_date=${encodeURIComponent(start_date)}`
: `/spend/logs/ui/${logId}?start_date=${encodeURIComponent(start_date)}`;
console.log("Fetching log details from:", url);
const response = await fetch(url, {
method: "GET",
headers: {
[globalLitellmHeaderName]: `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
});
if (!response.ok) {
const errorData = await response.text();
handleError(errorData);
throw new Error("Network response was not ok");
}
const data = await response.json();
console.log("Fetched log details:", data);
return data;
} catch (error) {
console.error("Failed to fetch log details:", error);
throw error;
}
};