Skip to content

@codesoul-co/hypha-core / modules/runtime/runtime-operational-telemetry

模块用法

用于执行该边界的运行时行为。Runtime operational telemetry 模块公开 1 类、1 常量、1 接口、3 类型。

从包入口导入

ts
import {
  RuntimeOperationalTelemetry,
  RUNTIME_OPERATIONAL_METRIC_NAMES,
} from '@codesoul-co/hypha-core';

import type {
  RuntimeOperationalTelemetryOptions,
  RuntimeLeaseResource,
  RuntimeQuarantineReason,
  RuntimeQuarantineSource,
} from '@codesoul-co/hypha-core';

使用要点

  • 4 个类型/接口用于应用代码、Adapter 或测试中的静态契约;请使用 import type,运行时不应依赖它们。
  • 1 个类提供可实例化的运行时实现;构造参数与公开方法在各自条目中完整列出。
  • 1 个常量/枚举提供稳定值、Schema、Definition 或默认配置;应复用这些导出,避免在应用中复制内部值。

公共导出

Symbol种类签名说明
RuntimeOperationalTelemetrynew RuntimeOperationalTelemetry(options: RuntimeOperationalTelemetryOptions): RuntimeOperationalTelemetryStable, low-cardinality Runtime metrics. Run and fingerprint identities stay in durable Events and checkpoints instead of becoming metric attributes.
RUNTIME_OPERATIONAL_METRIC_NAMES常量const RUNTIME_OPERATIONAL_METRIC_NAMES: { readonly quarantineTotal: "hypha.runtime.quarantine.total"; readonly continuationLatencyMs: "hypha.runtime.continuation.latency_ms"; readonly leaseRenewalLatencyMs: "hypha.runtime.lease.renewal.latency_ms"; readonly leaseRenewalTotal: "hypha.runtime.lease.renewal.total"; readonly noProgressFingerprintTotal: "hypha.runtime.no_progress.fingerprint.total"; readonly noProgress...modules/runtime/runtime-operational-telemetry 模块导出的 RUNTIME OPERATIONAL METRIC NAMES 常量。
RuntimeOperationalTelemetryOptions接口interface RuntimeOperationalTelemetryOptionsRuntime Operational Telemetry Options 接口,共包含 2 个公开字段或方法。
RuntimeLeaseResource类型type RuntimeLeaseResource = 'session_command' | 'run' | 'state_claim'Runtime Lease Resource 公共类型别名;完整类型表达式见声明。
RuntimeQuarantineReason类型type RuntimeQuarantineReason = 'checkpoint_missing' | 'checkpoint_identity_mismatch' | 'checkpoint_hash_mismatch' | 'command_without_valid_checkpoint' | 'canonical_stream_corrupt'Runtime Quarantine Reason 公共类型别名;完整类型表达式见声明。
RuntimeQuarantineSource类型type RuntimeQuarantineSource = 'continuation_reconciler' | 'startup_integrity_audit'Runtime Quarantine Source 公共类型别名;完整类型表达式见声明。

RuntimeOperationalTelemetry

Stable, low-cardinality Runtime metrics. Run and fingerprint identities stay in durable Events and checkpoints instead of becoming metric attributes.

声明

text
export declare class RuntimeOperationalTelemetry {
    constructor(options: RuntimeOperationalTelemetryOptions);
    recordQuarantine(input: {
            source: RuntimeQuarantineSource;
            reason: RuntimeQuarantineReason;
        }): Promise<void>;
    recordContinuationLatency(input: {
            suspendedAt: string;
            resumedAt: string;
            outcome: 'resumed' | 'scheduled' | 'reused';
        }): Promise<void>;
    recordLeaseRenewal(input: {
            resource: RuntimeLeaseResource;
            durationMs: number;
            outcome: 'succeeded' | 'failed';
        }): Promise<void>;
    recordNoProgressFingerprint(input: {
            consecutiveNoProgress: number;
            source: 'react_checkpoint' | 'recovery';
        }): Promise<void>;
}

公开成员

成员种类签名说明
constructor构造函数(options: RuntimeOperationalTelemetryOptions): RuntimeOperationalTelemetry创建该类的实例。
recordContinuationLatency方法recordContinuationLatency(input: { suspendedAt: string; resumedAt: string; outcome: "resumed" | "scheduled" | "reused"; }): Promise<void>公开方法;参数与返回类型以签名列为准。
recordLeaseRenewal方法recordLeaseRenewal(input: { resource: RuntimeLeaseResource; durationMs: number; outcome: "succeeded" | "failed"; }): Promise<void>公开方法;参数与返回类型以签名列为准。
recordNoProgressFingerprint方法recordNoProgressFingerprint(input: { consecutiveNoProgress: number; source: "react_checkpoint" | "recovery"; }): Promise<void>公开方法;参数与返回类型以签名列为准。
recordQuarantine方法recordQuarantine(input: { source: RuntimeQuarantineSource; reason: RuntimeQuarantineReason; }): Promise<void>公开方法;参数与返回类型以签名列为准。

RUNTIME_OPERATIONAL_METRIC_NAMES

modules/runtime/runtime-operational-telemetry 模块导出的 RUNTIME OPERATIONAL METRIC NAMES 常量。

声明

text
export declare const RUNTIME_OPERATIONAL_METRIC_NAMES: { readonly quarantineTotal: "hypha.runtime.quarantine.total"; readonly continuationLatencyMs: "hypha.runtime.continuation.latency_ms"; readonly leaseRenewalLatencyMs: "hypha.runtime.lease.renewal.latency_ms"; readonly leaseRenewalTotal: "hypha.runtime.lease.renewal.total"; readonly noProgressFingerprintTotal: "hypha.runtime.no_progress.fingerprint.total"; readonly noProgressConsecutive: "hypha.runtime.no_progress.consecutive"; };

RuntimeOperationalTelemetryOptions

Runtime Operational Telemetry Options 接口,共包含 2 个公开字段或方法。

声明

text
export interface RuntimeOperationalTelemetryOptions {
    recorder: TelemetryRecorder;
    now?: () => string;
}

契约成员

成员种类签名说明
now方法now?(): string公开方法;参数与返回类型以签名列为准。
recorder属性recorder: TelemetryRecorder公开属性;类型、只读和可选状态以签名列为准。

RuntimeLeaseResource

Runtime Lease Resource 公共类型别名;完整类型表达式见声明。

声明

text
export type RuntimeLeaseResource = 'session_command' | 'run' | 'state_claim';

RuntimeQuarantineReason

Runtime Quarantine Reason 公共类型别名;完整类型表达式见声明。

声明

text
export type RuntimeQuarantineReason = 'checkpoint_missing' | 'checkpoint_identity_mismatch' | 'checkpoint_hash_mismatch' | 'command_without_valid_checkpoint' | 'canonical_stream_corrupt';

RuntimeQuarantineSource

Runtime Quarantine Source 公共类型别名;完整类型表达式见声明。

声明

text
export type RuntimeQuarantineSource = 'continuation_reconciler' | 'startup_integrity_audit';