Table of Contents

Interface IDebugPropertiesProvider

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

Implemented by resources that can provide detailed debug properties for diagnostic drill-down.

public interface IDebugPropertiesProvider

Examples

public class ComponentTable : IResource, IMetricSource, IDebugPropertiesProvider
{
    // IMetricSource reports aggregated totals
    public void ReadMetrics(IMetricWriter writer)
    {
        writer.WriteCapacity(
            totalAllocatedChunks,  // Sum of all segments
            totalCapacity);
    }

    // IDebugPropertiesProvider shows per-segment breakdown
    public IReadOnlyDictionary<string, object> GetDebugProperties()
    {
        return new Dictionary<string, object>
        {
            ["ComponentSegment.Allocated"] = _componentSegment.AllocatedChunkCount,
            ["ComponentSegment.Capacity"] = _componentSegment.ChunkCapacity,
            ["RevisionSegment.Allocated"] = _revisionSegment.AllocatedChunkCount,
            ["RevisionSegment.Capacity"] = _revisionSegment.ChunkCapacity,
        };
    }
}

Remarks

This interface complements IMetricSource by providing detailed breakdown information that would be too expensive or verbose for regular metric collection. While ReadMetrics(IMetricWriter) reports aggregated metrics suitable for dashboards, GetDebugProperties() provides the full breakdown for debugging specific issues.

Use cases:

  • Per-segment capacity breakdown when IMetricSource reports only totals
  • Individual latch contention when owner aggregates overall contention
  • Internal state that's useful for debugging but not for monitoring

Thread safety: Unlike ReadMetrics(IMetricWriter) which must be zero-allocation, GetDebugProperties() may allocate since it's called infrequently for debugging. Implementations should still avoid taking locks to prevent affecting production behavior.

Methods

GetDebugProperties()

Gets detailed debug properties for diagnostic drill-down.

IReadOnlyDictionary<string, object> GetDebugProperties()

Returns

IReadOnlyDictionary<string, object>

A dictionary of property names to values. Values should be primitives, strings, or types that have meaningful ToString() implementations.

Remarks

This method may allocate (returns new dictionary) since it's called infrequently. Callers should cache results if needed across multiple accesses.

Property naming convention: Use dot-notation for nested concepts (e.g., "ComponentSegment.Allocated", "Contention.MaxWaitUs").