Enrich external API failure audit metadata
This commit is contained in:
@@ -16,6 +16,7 @@ use crate::{
|
||||
record_external_api_failure,
|
||||
},
|
||||
http_error::AppError,
|
||||
request_context::RequestContext,
|
||||
state::AppState,
|
||||
tracking::record_external_generation_run_after_success,
|
||||
};
|
||||
@@ -258,7 +259,7 @@ pub(crate) fn build_openai_image_request_body(
|
||||
}
|
||||
|
||||
impl OpenAiImageSettings {
|
||||
pub(crate) fn with_external_api_audit_context(
|
||||
pub(crate) fn with_external_api_audit_actor(
|
||||
mut self,
|
||||
user_id: Option<String>,
|
||||
profile_id: Option<String>,
|
||||
@@ -268,8 +269,15 @@ impl OpenAiImageSettings {
|
||||
self
|
||||
}
|
||||
|
||||
pub(crate) fn with_external_api_audit_request_id(mut self, request_id: Option<String>) -> Self {
|
||||
self.external_api_audit_request_id = request_id;
|
||||
pub(crate) fn with_external_api_audit_context(
|
||||
mut self,
|
||||
request_context: &RequestContext,
|
||||
user_id: Option<String>,
|
||||
profile_id: Option<String>,
|
||||
) -> Self {
|
||||
self.external_api_audit_user_id = user_id;
|
||||
self.external_api_audit_profile_id = profile_id;
|
||||
self.external_api_audit_request_id = Some(request_context.request_id().to_string());
|
||||
self
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user