Hyperlinkv0.8.0-beta.28

ApiMetrics

ApiMetrics.Tagconstsrc/ApiMetrics.ts:265
<Self>(): {
  (clientId: string): ApiMetricsTag<Self>
  <HSelf>(
    clientId: string,
    options: {
      readonly node: NodeKey<HSelf>
      readonly description?: string
    }
  ): ApiMetricsNodeTag<Self, HSelf>
}

Class factory for an ApiMetrics instance tag — its own per-instance RPC group, so it serves on a node alongside queues/processes via ApiMetrics.serve and is reached with Hyperlink.client. Bind it to a node with { node }.

constructorsApiMetricsApiMetrics.serve
Source src/ApiMetrics.ts:26520 lines
const tag = <Self>() => {
  function build(clientId: string): ApiMetricsTag<Self>;
  function build<HSelf>(
    clientId: string,
    options: { readonly node: NodeKey<HSelf>; readonly description?: string },
  ): ApiMetricsNodeTag<Self, HSelf>;
  function build(
    clientId: string,
    options?: ApiMetricsConstructOptions<unknown>,
  ): ApiMetricsTag<Self> {
    const node = options?.node;
    const key = keyFor(clientId, node);
    const base =
      node === undefined
        ? resourceTag<Self>()(key, apiMetricsSpec, { kind, description: options?.description })
        : resourceTag<Self>()(key, apiMetricsSpec, { kind, description: options?.description, node });
    return Object.assign(base, { [clientIdSym]: clientId });
  }
  return build;
};