Skip to content

@codesoul-co/hypha-core / telemetry

Using this module

Use the Telemetry module for using the public contracts and operations for this capability boundary. It exports 1 class, 2 interfaces, 1 type.

Import from the package entrypoint

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

import type {
  TelemetryMetric,
  TelemetryRecorder,
  TelemetryMetricKind,
} from '@codesoul-co/hypha-core';

Usage patterns

  • Use the 3 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.

Public exports

SymbolKindSignatureDescription
InMemoryTelemetryRecorderclassnew InMemoryTelemetryRecorder(): InMemoryTelemetryRecorderIn Memory Telemetry Recorder class with 4 public constructor or member entries; its exact declarations are listed below.
TelemetryMetricinterfaceinterface TelemetryMetricTelemetry Metric interface with 5 public fields or methods.
TelemetryRecorderinterfaceinterface TelemetryRecorderTelemetry Recorder interface with 1 public fields or methods.
TelemetryMetricKindtypetype TelemetryMetricKind = 'counter' | 'histogram' | 'gauge'Public type alias for Telemetry Metric Kind; the declaration contains its complete type expression.

InMemoryTelemetryRecorder

In Memory Telemetry Recorder class with 4 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { InMemoryTelemetryRecorder } from '@codesoul-co/hypha-core';
  • Source module: telemetry

Declaration

text
export declare class InMemoryTelemetryRecorder implements TelemetryRecorder {
    recordMetric(metric: TelemetryMetric): void;
    list(name?: string): TelemetryMetric[];
    sum(name: string): number;
}

Public members

MemberKindSignatureDescription
constructorconstructor(): InMemoryTelemetryRecorderCreates an instance of this class.
listmethodlist(name?: string): TelemetryMetric[]Public method; parameters and return type are shown in the signature.
recordMetricmethodrecordMetric(metric: TelemetryMetric): voidPublic method; parameters and return type are shown in the signature.
summethodsum(name: string): numberPublic method; parameters and return type are shown in the signature.

TelemetryMetric

Telemetry Metric interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { TelemetryMetric } from '@codesoul-co/hypha-core';
  • Source module: telemetry

Declaration

text
export interface TelemetryMetric {
    name: string;
    kind: TelemetryMetricKind;
    value: number;
    recordedAt: string;
    attributes?: Record<string, string | number | boolean>;
}

Contract members

MemberKindSignatureDescription
attributespropertyattributes?: Record<string, string | number | boolean>Public property; its type, readonly modifier and optionality are shown in the signature.
kindpropertykind: TelemetryMetricKindPublic property; its type, readonly modifier and optionality are shown in the signature.
namepropertyname: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
recordedAtpropertyrecordedAt: stringPublic 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.

TelemetryRecorder

Telemetry Recorder interface with 1 public fields or methods.

  • Kind: interface
  • Import: import type { TelemetryRecorder } from '@codesoul-co/hypha-core';
  • Source module: telemetry

Declaration

text
export interface TelemetryRecorder {
    recordMetric(metric: TelemetryMetric): Promise<void> | void;
}

Contract members

MemberKindSignatureDescription
recordMetricmethodrecordMetric(metric: TelemetryMetric): Promise<void> | voidPublic method; parameters and return type are shown in the signature.

TelemetryMetricKind

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

  • Kind: type
  • Import: import type { TelemetryMetricKind } from '@codesoul-co/hypha-core';
  • Source module: telemetry

Declaration

text
export type TelemetryMetricKind = 'counter' | 'histogram' | 'gauge';