feat(etl): add result models for pipeline execution
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
namespace JdeScoping.DataSync.Etl.Results;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the result of writing data to a destination.
|
||||
/// </summary>
|
||||
/// <param name="RowsProcessed">The number of rows successfully written to the destination.</param>
|
||||
/// <param name="BatchCount">The number of batches used to write the data.</param>
|
||||
/// <param name="Elapsed">The total time taken to write all batches.</param>
|
||||
public record DestinationResult(
|
||||
long RowsProcessed,
|
||||
int BatchCount,
|
||||
TimeSpan Elapsed);
|
||||
@@ -0,0 +1,38 @@
|
||||
namespace JdeScoping.DataSync.Etl.Results;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the complete result of an ETL pipeline execution.
|
||||
/// </summary>
|
||||
/// <param name="Success">Indicates whether the pipeline completed successfully.</param>
|
||||
/// <param name="TotalRows">The total number of rows processed by the pipeline.</param>
|
||||
/// <param name="Elapsed">The total time taken to execute the pipeline.</param>
|
||||
/// <param name="Steps">The results of each step executed in the pipeline.</param>
|
||||
/// <param name="Error">The exception that caused the pipeline to fail, if any.</param>
|
||||
public record PipelineResult(
|
||||
bool Success,
|
||||
long TotalRows,
|
||||
TimeSpan Elapsed,
|
||||
IReadOnlyList<StepResult> Steps,
|
||||
Exception? Error = null)
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a successful pipeline result.
|
||||
/// </summary>
|
||||
/// <param name="totalRows">The total number of rows processed.</param>
|
||||
/// <param name="elapsed">The total execution time.</param>
|
||||
/// <param name="steps">The results of each step.</param>
|
||||
/// <returns>A PipelineResult indicating success.</returns>
|
||||
public static PipelineResult Succeeded(long totalRows, TimeSpan elapsed, IReadOnlyList<StepResult> steps)
|
||||
=> new(true, totalRows, elapsed, steps);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a failed pipeline result.
|
||||
/// </summary>
|
||||
/// <param name="totalRows">The number of rows processed before failure.</param>
|
||||
/// <param name="elapsed">The total execution time including failure.</param>
|
||||
/// <param name="steps">The results of steps executed before failure.</param>
|
||||
/// <param name="error">The exception that caused the failure.</param>
|
||||
/// <returns>A PipelineResult indicating failure with error details.</returns>
|
||||
public static PipelineResult Failed(long totalRows, TimeSpan elapsed, IReadOnlyList<StepResult> steps, Exception error)
|
||||
=> new(false, totalRows, elapsed, steps, error);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace JdeScoping.DataSync.Etl.Results;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the result of a single pipeline step execution.
|
||||
/// </summary>
|
||||
/// <param name="StepName">The name of the step that was executed.</param>
|
||||
/// <param name="StepType">The type of step (e.g., "Transform", "Load").</param>
|
||||
/// <param name="RowsAffected">The number of rows affected by this step.</param>
|
||||
/// <param name="Elapsed">The time taken to execute this step.</param>
|
||||
public record StepResult(
|
||||
string StepName,
|
||||
string StepType,
|
||||
long RowsAffected,
|
||||
TimeSpan Elapsed);
|
||||
Reference in New Issue
Block a user