Skip to main content

GenAIDriftSqlLogic

Trait GenAIDriftSqlLogic 

Source
pub trait GenAIDriftSqlLogic {
Show 19 methods // Provided methods fn insert_genai_eval_record<'life0, 'life1, 'async_trait>( pool: &'life0 Pool<Postgres>, record: BoxedGenAIEvalRecord, entity_id: &'life1 i32, ) -> Pin<Box<dyn Future<Output = Result<PgQueryResult, SqlError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait { ... } fn insert_genai_eval_workflow_record<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, record: &'life1 GenAIEvalWorkflowResult, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<PgQueryResult, SqlError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn insert_eval_task_results_batch<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, records: &'life1 [GenAIEvalTaskResult], entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<PgQueryResult, SqlError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn get_genai_eval_records<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, limit_datetime: Option<&'life1 DateTime<Utc>>, status: Option<Status>, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<Vec<GenAIEvalRecord>, SqlError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn get_paginated_genai_eval_records<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, params: &'life1 GenAIEvalRecordPaginationRequest, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<GenAIEvalRecordPaginationResponse, SqlError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn get_genai_eval_task<'life0, 'life1, 'async_trait>( pool: &'life0 Pool<Postgres>, record_uid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<GenAIEvalTaskResult>, SqlError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait { ... } fn get_paginated_genai_eval_workflow_records<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, params: &'life1 GenAIEvalRecordPaginationRequest, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<GenAIEvalWorkflowPaginationResponse, SqlError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn get_genai_task_values<'life0, 'life1, 'life2, 'life3, 'async_trait>( pool: &'life0 Pool<Postgres>, limit_datetime: &'life1 DateTime<Utc>, metrics: &'life2 [String], entity_id: &'life3 i32, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, f64>, SqlError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait { ... } fn get_genai_workflow_value<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, limit_datetime: &'life1 DateTime<Utc>, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<Option<f64>, SqlError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn get_binned_workflow_records<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, params: &'life1 DriftRequest, start_dt: DateTime<Utc>, end_dt: DateTime<Utc>, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<BinnedMetrics, SqlError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn get_binned_task_records<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, params: &'life1 DriftRequest, start_dt: DateTime<Utc>, end_dt: DateTime<Utc>, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<BinnedMetrics, SqlError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn merge_feature_results( results: BinnedMetrics, map: &mut BinnedMetrics, ) -> Result<(), SqlError> { ... } fn get_archived_task_records<'life0, 'life1, 'life2, 'async_trait>( params: &'life0 DriftRequest, begin: DateTime<Utc>, end: DateTime<Utc>, minutes: i32, storage_settings: &'life1 ObjectStorageSettings, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<BinnedMetrics, SqlError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn get_archived_workflow_records<'life0, 'life1, 'life2, 'async_trait>( params: &'life0 DriftRequest, begin: DateTime<Utc>, end: DateTime<Utc>, minutes: i32, storage_settings: &'life1 ObjectStorageSettings, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<BinnedMetrics, SqlError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn get_binned_genai_task_values<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( pool: &'life0 Pool<Postgres>, params: &'life1 DriftRequest, retention_period: &'life2 i32, storage_settings: &'life3 ObjectStorageSettings, entity_id: &'life4 i32, ) -> Pin<Box<dyn Future<Output = Result<BinnedMetrics, SqlError>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait { ... } fn get_binned_genai_workflow_values<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( pool: &'life0 Pool<Postgres>, params: &'life1 DriftRequest, retention_period: &'life2 i32, storage_settings: &'life3 ObjectStorageSettings, entity_id: &'life4 i32, ) -> Pin<Box<dyn Future<Output = Result<BinnedMetrics, SqlError>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait { ... } fn get_pending_genai_eval_record<'life0, 'async_trait>( pool: &'life0 Pool<Postgres>, ) -> Pin<Box<dyn Future<Output = Result<Option<GenAIEvalRecord>, SqlError>> + Send + 'async_trait>> where 'life0: 'async_trait { ... } fn update_genai_eval_record_status<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, record: &'life1 GenAIEvalRecord, status: Status, workflow_duration: &'life2 i64, ) -> Pin<Box<dyn Future<Output = Result<(), SqlError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn reschedule_genai_eval_record<'life0, 'life1, 'async_trait>( pool: &'life0 Pool<Postgres>, uid: &'life1 str, delay: Duration, ) -> Pin<Box<dyn Future<Output = Result<(), SqlError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait { ... }
}

Provided Methods§

Source

fn insert_genai_eval_record<'life0, 'life1, 'async_trait>( pool: &'life0 Pool<Postgres>, record: BoxedGenAIEvalRecord, entity_id: &'life1 i32, ) -> Pin<Box<dyn Future<Output = Result<PgQueryResult, SqlError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait,

Inserts an GenAI drift record into the database.

§Arguments
  • pool - The database connection pool
  • record - The GenAI drift record to insert
§Returns
  • A result containing the query result or an error
Source

fn insert_genai_eval_workflow_record<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, record: &'life1 GenAIEvalWorkflowResult, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<PgQueryResult, SqlError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Insert a single eval workflow record

§Arguments
  • pool - The database connection pool
  • record - The GenAI eval workflow record to insert
  • entity_id - The entity ID associated with the record
§Returns
Source

fn insert_eval_task_results_batch<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, records: &'life1 [GenAIEvalTaskResult], entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<PgQueryResult, SqlError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Inserts a batch of GenAI metric values into the database. This is the output from processing/evaluating the GenAI drift records.

Source

fn get_genai_eval_records<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, limit_datetime: Option<&'life1 DateTime<Utc>>, status: Option<Status>, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<Vec<GenAIEvalRecord>, SqlError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn get_paginated_genai_eval_records<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, params: &'life1 GenAIEvalRecordPaginationRequest, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<GenAIEvalRecordPaginationResponse, SqlError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Retrieves a paginated list of GenAI drift records with bidirectional cursor support

§Arguments
  • pool - The database connection pool
  • params - The pagination request containing limit, cursor, and direction
  • entity_id - The entity ID to filter records
§Returns
  • Result with paginated response containing GenAI drift records
Source

fn get_genai_eval_task<'life0, 'life1, 'async_trait>( pool: &'life0 Pool<Postgres>, record_uid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<GenAIEvalTaskResult>, SqlError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait,

Attempts to retrieve trace spans for a given trace ID.

§Arguments
  • pool - The database connection pool
  • trace_id - The trace ID to retrieve spans for
§Returns
  • A vector of TraceSpan associated with the trace ID
Source

fn get_paginated_genai_eval_workflow_records<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, params: &'life1 GenAIEvalRecordPaginationRequest, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<GenAIEvalWorkflowPaginationResponse, SqlError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Retrieves a paginated list of GenAI workflow records with bidirectional cursor support

§Arguments
  • pool - The database connection pool
  • params - The pagination request containing limit, cursor, and direction
  • entity_id - The entity ID to filter records
§Returns
  • Result with paginated response containing GenAI workflow records
Source

fn get_genai_task_values<'life0, 'life1, 'life2, 'life3, 'async_trait>( pool: &'life0 Pool<Postgres>, limit_datetime: &'life1 DateTime<Utc>, metrics: &'life2 [String], entity_id: &'life3 i32, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, f64>, SqlError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Queries the database for GenAI task metric values based on a time window.

§Arguments
  • pool - The database connection pool
  • limit_datetime - The limit datetime to get metric values for
  • metrics - The list of metric names to retrieve
  • entity_id - The entity ID to filter records
§Returns
  • A hashmap of metric names to their corresponding values
Source

fn get_genai_workflow_value<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, limit_datetime: &'life1 DateTime<Utc>, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<Option<f64>, SqlError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Queries the database for GenAI workflow metric values based on a time window.

§Arguments
  • pool - The database connection pool
  • limit_datetime - The limit datetime to get metric values for
  • entity_id - The entity ID to filter records
§Returns
  • A hashmap of metric names to their corresponding values
Source

fn get_binned_workflow_records<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, params: &'life1 DriftRequest, start_dt: DateTime<Utc>, end_dt: DateTime<Utc>, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<BinnedMetrics, SqlError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

and aggregation.

§Arguments
  • pool - The database connection pool
  • params - The drift request parameters
  • start_dt - The start datetime of the time window
  • end_dt - The end datetime of the time window
  • entity_id - The entity ID to filter records
§Returns
  • BinnedMetrics
Source

fn get_binned_task_records<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, params: &'life1 DriftRequest, start_dt: DateTime<Utc>, end_dt: DateTime<Utc>, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<BinnedMetrics, SqlError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

and aggregation.

§Arguments
  • pool - The database connection pool
  • params - The drift request parameters
  • start_dt - The start datetime of the time window
  • end_dt - The end datetime of the time window
  • entity_id - The entity ID to filter records
§Returns
  • BinnedMetrics
Source

fn merge_feature_results( results: BinnedMetrics, map: &mut BinnedMetrics, ) -> Result<(), SqlError>

Helper for merging custom drift records

Source

fn get_archived_task_records<'life0, 'life1, 'life2, 'async_trait>( params: &'life0 DriftRequest, begin: DateTime<Utc>, end: DateTime<Utc>, minutes: i32, storage_settings: &'life1 ObjectStorageSettings, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<BinnedMetrics, SqlError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

DataFusion implementation for getting custom drift records from archived data. Queries for task records

§Arguments
  • params - The drift request parameters
  • begin - The start time of the time window
  • end - The end time of the time window
  • minutes - The number of minutes to bin the data
  • storage_settings - The object storage settings
  • entity_id - The entity ID to filter records
§Returns
  • A vector of drift records
Source

fn get_archived_workflow_records<'life0, 'life1, 'life2, 'async_trait>( params: &'life0 DriftRequest, begin: DateTime<Utc>, end: DateTime<Utc>, minutes: i32, storage_settings: &'life1 ObjectStorageSettings, entity_id: &'life2 i32, ) -> Pin<Box<dyn Future<Output = Result<BinnedMetrics, SqlError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

DataFusion implementation for getting custom drift records from archived data. Queries for task records

§Arguments
  • params - The drift request parameters
  • begin - The start time of the time window
  • end - The end time of the time window
  • minutes - The number of minutes to bin the data
  • storage_settings - The object storage settings
  • entity_id - The entity ID to filter records
§Returns
  • A vector of drift records
Source

fn get_binned_genai_task_values<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( pool: &'life0 Pool<Postgres>, params: &'life1 DriftRequest, retention_period: &'life2 i32, storage_settings: &'life3 ObjectStorageSettings, entity_id: &'life4 i32, ) -> Pin<Box<dyn Future<Output = Result<BinnedMetrics, SqlError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Source

fn get_binned_genai_workflow_values<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( pool: &'life0 Pool<Postgres>, params: &'life1 DriftRequest, retention_period: &'life2 i32, storage_settings: &'life3 ObjectStorageSettings, entity_id: &'life4 i32, ) -> Pin<Box<dyn Future<Output = Result<BinnedMetrics, SqlError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Source

fn get_pending_genai_eval_record<'life0, 'async_trait>( pool: &'life0 Pool<Postgres>, ) -> Pin<Box<dyn Future<Output = Result<Option<GenAIEvalRecord>, SqlError>> + Send + 'async_trait>>
where 'life0: 'async_trait,

Retrieves the next pending GenAI drift task from drift_records.

Source

fn update_genai_eval_record_status<'life0, 'life1, 'life2, 'async_trait>( pool: &'life0 Pool<Postgres>, record: &'life1 GenAIEvalRecord, status: Status, workflow_duration: &'life2 i64, ) -> Pin<Box<dyn Future<Output = Result<(), SqlError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn reschedule_genai_eval_record<'life0, 'life1, 'async_trait>( pool: &'life0 Pool<Postgres>, uid: &'life1 str, delay: Duration, ) -> Pin<Box<dyn Future<Output = Result<(), SqlError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§