Table of Contents

Class FoundryPerformanceStatistics

Namespace
WorkflowForge.Extensions.Observability.Performance
Assembly
WorkflowForge.Extensions.Observability.Performance.dll

Thread-safe aggregate of foundry performance statistics, collected across all operations executed while performance monitoring is enabled. Populated by PerformanceStatisticsMiddleware and retrieved via GetPerformanceStatistics(IWorkflowFoundry).

public sealed class FoundryPerformanceStatistics : IFoundryPerformanceStatistics
Inheritance
FoundryPerformanceStatistics
Implements
Inherited Members

Constructors

FoundryPerformanceStatistics(ISystemTimeProvider?)

Initializes a new instance of the FoundryPerformanceStatistics class.

public FoundryPerformanceStatistics(ISystemTimeProvider? timeProvider = null)

Parameters

timeProvider ISystemTimeProvider

Optional time provider (defaults to the system clock).

Properties

AverageDuration

Gets the average execution duration across all operations.

public TimeSpan AverageDuration { get; }

Property Value

TimeSpan

AverageMemoryPerOperation

Gets the average memory allocated per operation.

public long AverageMemoryPerOperation { get; }

Property Value

long

EndTime

Gets the timestamp when statistics collection ended or current time if still running.

public DateTimeOffset EndTime { get; }

Property Value

DateTimeOffset

FailedOperations

Gets the number of failed operations.

public int FailedOperations { get; }

Property Value

int

MaximumDuration

Gets the maximum execution duration recorded.

public TimeSpan MaximumDuration { get; }

Property Value

TimeSpan

MinimumDuration

Gets the minimum execution duration recorded.

public TimeSpan MinimumDuration { get; }

Property Value

TimeSpan

OperationsPerSecond

Gets the operations per second throughput.

public double OperationsPerSecond { get; }

Property Value

double

StartTime

Gets the timestamp when statistics collection started.

public DateTimeOffset StartTime { get; }

Property Value

DateTimeOffset

SuccessRate

Gets the overall success rate as a percentage (0.0 to 1.0).

public double SuccessRate { get; }

Property Value

double

SuccessfulOperations

Gets the number of successfully completed operations.

public int SuccessfulOperations { get; }

Property Value

int

TotalDuration

Gets the total duration of the foundry execution.

public TimeSpan TotalDuration { get; }

Property Value

TimeSpan

TotalMemoryAllocated

Gets the total memory allocated during foundry operations.

public long TotalMemoryAllocated { get; }

Property Value

long

TotalOperations

Gets the total number of operations executed in the foundry.

public int TotalOperations { get; }

Property Value

int

Methods

GetAllOperationStatistics()

Gets performance statistics for all operations.

public IReadOnlyList<IOperationStatistics> GetAllOperationStatistics()

Returns

IReadOnlyList<IOperationStatistics>

A collection of operation statistics.

GetOperationStatistics(string)

Gets detailed statistics for a specific operation by name.

public IOperationStatistics? GetOperationStatistics(string operationName)

Parameters

operationName string

The name of the operation.

Returns

IOperationStatistics

Operation-specific statistics or null if not found.

Record(string, string, TimeSpan, bool, long)

Records a single operation execution into the aggregate and per-operation statistics.

public void Record(string operationName, string operationId, TimeSpan duration, bool success, long memoryAllocated)

Parameters

operationName string

The operation name.

operationId string

The operation identifier.

duration TimeSpan

Execution duration.

success bool

Whether the execution succeeded.

memoryAllocated long

Approximate bytes allocated during the execution.