Skip to content

@codesoul-co/hypha-memory / memory-operational-metrics

Using this module

Use the Memory operational metrics module for using the public contracts and operations for this capability boundary. It exports 1 class, 1 function, 4 interfaces, 1 type.

Import from the package entrypoint

ts
import {
  MemoryOperationalMetrics,
  sanitizeMemoryOperationalValue,
} from '@codesoul-co/hypha-memory';

import type {
  MemoryOperationalMetricLabels,
  MemoryOperationalMetricSample,
  MemoryOperationalMetricsSnapshot,
  MemoryOperationalRedactionPolicy,
  MemoryOperationalMetricKind,
} from '@codesoul-co/hypha-memory';

Usage patterns

  • Use the 5 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.
  • The module exposes 1 class as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
  • The module exposes 1 function as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.

Public exports

SymbolKindSignatureDescription
MemoryOperationalMetricsclassnew MemoryOperationalMetrics(maxSamples?: number): MemoryOperationalMetricsBounded operational metrics that deliberately exclude scope, Memory content, Provider payloads, credentials and host paths from metric labels.
sanitizeMemoryOperationalValuefunctionsanitizeMemoryOperationalValue(value: unknown, policy?: MemoryOperationalRedactionPolicy): unknownProduces log/evidence-safe data without mutating the supplied value.
MemoryOperationalMetricLabelsinterfaceinterface MemoryOperationalMetricLabelsMemory Operational Metric Labels interface with 5 public fields or methods.
MemoryOperationalMetricSampleinterfaceinterface MemoryOperationalMetricSampleMemory Operational Metric Sample interface with 3 public fields or methods.
MemoryOperationalMetricsSnapshotinterfaceinterface MemoryOperationalMetricsSnapshotMemory Operational Metrics Snapshot interface with 3 public fields or methods.
MemoryOperationalRedactionPolicyinterfaceinterface MemoryOperationalRedactionPolicyMemory Operational Redaction Policy interface with 3 public fields or methods.
MemoryOperationalMetricKindtypetype MemoryOperationalMetricKind = 'latency_ms' | 'retry' | 'reconcile' | 'lease_contention' | 'dlq' | 'cache_bypass' | 'scope_rejection'Public type alias for Memory Operational Metric Kind; the declaration contains its complete type expression.

MemoryOperationalMetrics

Bounded operational metrics that deliberately exclude scope, Memory content, Provider payloads, credentials and host paths from metric labels.

Declaration

text
export declare class MemoryOperationalMetrics {
    constructor(maxSamples?: number);
    record(kind: MemoryOperationalMetricKind, value?: number, labels?: MemoryOperationalMetricLabels): void;
    observeCacheEvent(event: MemorySearchCacheEvent): void;
    observeIndexEvent(event: IndexOutboxWorkerEvent): void;
    observeLifecycleEvent(event: MemoryLifecycleWorkerEvent): void;
    snapshot(): MemoryOperationalMetricsSnapshot;
}

Public members

MemberKindSignatureDescription
constructorconstructor(maxSamples?: number): MemoryOperationalMetricsCreates an instance of this class.
observeCacheEventmethodobserveCacheEvent(event: MemorySearchCacheEvent): voidPublic method; parameters and return type are shown in the signature.
observeIndexEventmethodobserveIndexEvent(event: IndexOutboxWorkerEvent): voidPublic method; parameters and return type are shown in the signature.
observeLifecycleEventmethodobserveLifecycleEvent(event: MemoryLifecycleWorkerEvent): voidPublic method; parameters and return type are shown in the signature.
recordmethodrecord(kind: MemoryOperationalMetricKind, value?: number, labels?: MemoryOperationalMetricLabels): voidPublic method; parameters and return type are shown in the signature.
snapshotmethodsnapshot(): MemoryOperationalMetricsSnapshotPublic method; parameters and return type are shown in the signature.

sanitizeMemoryOperationalValue

Produces log/evidence-safe data without mutating the supplied value.

  • Kind: function
  • Import: import { sanitizeMemoryOperationalValue } from '@codesoul-co/hypha-memory';
  • Source module: memory-operational-metrics

Declaration

text
export declare function sanitizeMemoryOperationalValue(value: unknown, policy?: MemoryOperationalRedactionPolicy): unknown;

Call signature

text
sanitizeMemoryOperationalValue(value: unknown, policy?: MemoryOperationalRedactionPolicy): unknown

Produces log/evidence-safe data without mutating the supplied value.

Parameters

ParameterTypeRequiredDescription
valueunknownYesRequired parameter; accepted values are defined by the type column.
policyMemoryOperationalRedactionPolicyNoOptional parameter; accepted values are defined by the type column.

Returns

  • Type: unknown
  • Description: The return contract is defined by the type shown above.

MemoryOperationalMetricLabels

Memory Operational Metric Labels interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryOperationalMetricLabels } from '@codesoul-co/hypha-memory';
  • Source module: memory-operational-metrics

Declaration

text
export interface MemoryOperationalMetricLabels {
    providerId?: string;
    operation?: string;
    workerType?: string;
    reason?: string;
    errorCode?: string;
}

Contract members

MemberKindSignatureDescription
errorCodepropertyerrorCode?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
operationpropertyoperation?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
providerIdpropertyproviderId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
workerTypepropertyworkerType?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryOperationalMetricSample

Memory Operational Metric Sample interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryOperationalMetricSample } from '@codesoul-co/hypha-memory';
  • Source module: memory-operational-metrics

Declaration

text
export interface MemoryOperationalMetricSample {
    kind: MemoryOperationalMetricKind;
    value: number;
    labels: MemoryOperationalMetricLabels;
}

Contract members

MemberKindSignatureDescription
kindpropertykind: MemoryOperationalMetricKindPublic property; its type, readonly modifier and optionality are shown in the signature.
labelspropertylabels: MemoryOperationalMetricLabelsPublic property; its type, readonly modifier and optionality are shown in the signature.
valuepropertyvalue: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryOperationalMetricsSnapshot

Memory Operational Metrics Snapshot interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryOperationalMetricsSnapshot } from '@codesoul-co/hypha-memory';
  • Source module: memory-operational-metrics

Declaration

text
export interface MemoryOperationalMetricsSnapshot {
    counters: Partial<Record<Exclude<MemoryOperationalMetricKind, 'latency_ms'>, number>>;
    latencyMs: {
        count: number;
        p50: number | null;
        p95: number | null;
        max: number | null;
    };
    samples: MemoryOperationalMetricSample[];
}

Contract members

MemberKindSignatureDescription
counterspropertycounters: Partial<Record<"retry" | "reconcile" | "dlq" | "lease_contention" | "cache_bypass" | "scope_rejection", number>>Public property; its type, readonly modifier and optionality are shown in the signature.
latencyMspropertylatencyMs: { count: number; p50: number | null; p95: number | null; max: number | null; }Public property; its type, readonly modifier and optionality are shown in the signature.
samplespropertysamples: MemoryOperationalMetricSample[]Public property; its type, readonly modifier and optionality are shown in the signature.

MemoryOperationalRedactionPolicy

Memory Operational Redaction Policy interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryOperationalRedactionPolicy } from '@codesoul-co/hypha-memory';
  • Source module: memory-operational-metrics

Declaration

text
export interface MemoryOperationalRedactionPolicy {
    contentMode?: 'redact' | 'hash';
    hostPathMode?: 'redact' | 'basename';
    maxDepth?: number;
}

Contract members

MemberKindSignatureDescription
contentModepropertycontentMode?: "hash" | "redact"Public property; its type, readonly modifier and optionality are shown in the signature.
hostPathModepropertyhostPathMode?: "redact" | "basename"Public property; its type, readonly modifier and optionality are shown in the signature.
maxDepthpropertymaxDepth?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryOperationalMetricKind

Public type alias for Memory Operational Metric Kind; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { MemoryOperationalMetricKind } from '@codesoul-co/hypha-memory';
  • Source module: memory-operational-metrics

Declaration

text
export type MemoryOperationalMetricKind = 'latency_ms' | 'retry' | 'reconcile' | 'lease_contention' | 'dlq' | 'cache_bypass' | 'scope_rejection';