Metalama 1.0 / / Metalama Documentation / Aspect API Documentation / Metalama.​Framework.​Metrics

Namespace Metalama.Framework.Metrics

This namespace allows you to consume and implement metrics.

To consume a metric, start from a declaration, call the extension method MetricsExtensions.Metric, then call Get.

Class Diagram

classDiagram class IMeasurable { } class IDeclaration { } class IMetric~TMeasurable~ { } class YourCustomMetric { } class YourCustomMetricProvider { <<sdk>> } class IMetricProvider~TMetric~ { GetMetric(IMeasurable) } class Metrics~TMeasurable~ { Get() } class MetricsExtensions { <<extension class>> Metrics()$ } MetricsExtensions --> IMeasurable : extension methods MetricsExtensions --> Metrics : exposes Metrics --> IMetric~TMeasurable~ : exposes IDeclaration --|> IMeasurable : implements YourCustomMetric --<| IMetric~TMeasurable~ : implements YourCustomMetricProvider --<| IMetricProvider~TMetric~ : implements YourCustomMetricProvider --> YourCustomMetric : computes IMetricProvider~TMetric~ --> IMetric~TMeasurable~ : computes IMetric~TMeasurable~ --> IMeasurable : applies to

Namespace members

Classes

Metrics<TMeasurable>

Exposes a Get<TExtension>() method, which computes and returns a metric for an eligible object.

MetricsExtensions

Exposes metrics to eligible objects.

StatementNumberMetric

A metric that counts the number of statements in a declaration.

SyntaxNodeNumberMetric

A metric that counts the number of syntax nodes in a declaration.

Interfaces

IMeasurable

Base interface for objects that can be extended with metrics.

IMetric

A weakly-typed base interface for IMetric<T>. Never implement directly. Always implement IMetric<T>.

IMetric<T>

Base interface for all metrics. This interface exists only for strong typing. It does not have any members.

IMetricProvider<T>

Implements the computation or reading of a metric.