feat(core-shared): MetricsProtocol + BindContext.metrics? field
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
import type { MetricsProtocol } from "../di/bind-protocols";
|
||||
|
||||
export type MetricAttributeValue = string | number | boolean;
|
||||
|
||||
/**
|
||||
* Vendor-neutral metrics signal interface. Mirrors the pattern of ITracer / ILogger.
|
||||
* Three impls: NoopMetrics (noop), OtelMetrics (OTel API), RecordingMetrics (core-testing).
|
||||
*
|
||||
* Extends MetricsProtocol from `core-shared/di/bind-protocols` so the type
|
||||
* system enforces structural compatibility — narrowing IMetrics below the
|
||||
* protocol surface causes a typecheck error.
|
||||
*
|
||||
* gauge() limitation: uses UpDownCounter under the hood, which accumulates deltas.
|
||||
* True "set to absolute value" semantics require ObservableGauge with a callback —
|
||||
* deferred to a v2 interface when the first true-gauge use case lands.
|
||||
*/
|
||||
export interface IMetrics {
|
||||
export interface IMetrics extends MetricsProtocol {
|
||||
/** Monotonic counter. Use for event counts (signups, errors, requests). */
|
||||
counter(
|
||||
name: string,
|
||||
|
||||
Reference in New Issue
Block a user