@adviser/cement - v0.0.0
    Preparing search index...

    Class Metrics

    Container for managing multiple metrics within a trace span.

    Metrics provides hierarchical metric management with path-based access. Metrics can be defined at absolute paths (starting with /) or relative to the current trace span. Supports JSON serialization of all metrics.

    const metrics = new Metrics(traceNode);

    // Absolute path
    const totalRequests = metrics.get<number>('/api/total_requests');
    totalRequests.set(100);

    // Relative path (uses trace node's root path)
    const spanRequests = metrics.get<number>('requests');
    spanRequests.add(1);

    // Export as JSON
    const data = metrics.toJSON();
    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    tracenode: TraceNode
    spanRefs: MetricMap = ...

    Methods

    • Returns Record<string, unknown>