@@ -12,6 +12,7 @@ namespace ModularityKit.Mutator.Abstractions.Metrics;
1212/// <para>
1313/// Key considerations:
1414/// <list type="bullet">
15+ /// <item><see cref="RecordedAt"/> timestamp of the mutation recording.</item>
1516/// <item><see cref="ExecutionTime"/> measures the total duration of the mutation.</item>
1617/// <item><see cref="ValidationTime"/> measures time spent validating the mutation.</item>
1718/// <item><see cref="PolicyEvaluationTime"/> measures time spent evaluating policies.</item>
@@ -25,6 +26,11 @@ namespace ModularityKit.Mutator.Abstractions.Metrics;
2526/// </remarks>
2627public sealed record MutationMetrics
2728{
29+ private static readonly IReadOnlyDictionary < string , object > _emptyAdditionalMetrics
30+ = new Dictionary < string , object > ( ) ;
31+
32+ internal static readonly MutationMetrics Empty = new ( ) ;
33+
2834 /// <summary>
2935 /// Timestamp when the mutation was recorded.
3036 /// </summary>
@@ -46,12 +52,12 @@ public sealed record MutationMetrics
4652 public TimeSpan PolicyEvaluationTime { get ; init ; }
4753
4854 /// <summary>
49- /// Number of rules validated during the mutation .
55+ /// Number of validated rules .
5056 /// </summary>
5157 public int ValidatedRules { get ; init ; }
5258
5359 /// <summary>
54- /// Number of policies evaluated during the mutation .
60+ /// Number of evaluated policies .
5561 /// </summary>
5662 public int EvaluatedPolicies { get ; init ; }
5763
@@ -61,23 +67,23 @@ public sealed record MutationMetrics
6167 public int ChangesCount { get ; init ; }
6268
6369 /// <summary>
64- /// Size of the state before the mutation ( in bytes, if applicable) .
70+ /// Size of the state object in bytes, if available .
6571 /// </summary>
6672 public long ? StateSize { get ; init ; }
6773
6874 /// <summary>
69- /// Memory used during mutation execution ( in bytes) .
75+ /// Memory used during mutation execution in bytes, if available .
7076 /// </summary>
7177 public long ? MemoryUsed { get ; init ; }
7278
7379 /// <summary>
74- /// Indicates whether a cache was used.
80+ /// Indicates whether caching was used during the mutation .
7581 /// </summary>
7682 public bool UsedCache { get ; init ; }
7783
7884 /// <summary>
79- /// Additional custom metrics.
85+ /// Additional metrics for extensibility .
8086 /// </summary>
8187 public IReadOnlyDictionary < string , object > AdditionalMetrics { get ; init ; }
82- = new Dictionary < string , object > ( ) ;
88+ = _emptyAdditionalMetrics ;
8389}
0 commit comments