durable-actors-observer 0.18.7 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@ import type { LogFilter } from "../types/Logs.js";
2
2
  export declare const actorsKey: (baseUrl: string) => readonly ["actors", string];
3
3
  export declare const requestsKey: (baseUrl: string) => readonly ["requests", string];
4
4
  export declare const residencyKey: (baseUrl: string, actorName: string, actorId?: string) => readonly ["residency", string, string, string | undefined];
5
+ export declare const resourcesKey: (baseUrl: string, actorName: string, actorId: string) => readonly ["resources", string, string, string];
5
6
  export declare const eventHistoryKey: (baseUrl: string, types: string[], actorName?: string, actorId?: string) => readonly ["events/history", string, string, string | undefined, string | undefined];
6
7
  export declare const webSocketsKey: (baseUrl: string) => readonly ["websockets", string];
7
8
  export declare const logsKey: (baseUrl: string, { actorName, actorId, requestId, level, search }: LogFilter) => readonly ["logs", string, string, string, string | null, import("../types/Logs.js").LogLevel | null, string];
@@ -3,6 +3,7 @@ import type { EventHistory, RecordedEvent } from "../types/Events.js";
3
3
  import type { ActorLogPage, LogFilter, LogHistogram } from "../types/Logs.js";
4
4
  import type { RequestHistoryQuery, RequestTrace, RequestTracePage } from "../types/Requests.js";
5
5
  import type { ResidencyHistory } from "../types/Residency.js";
6
+ import type { ResourceUsage } from "../types/Resources.js";
6
7
  import type { SocketSession } from "../types/Sockets.js";
7
8
  import type { TimeBounds } from "../types/TimeRange.js";
8
9
  export declare const defaultBaseUrl = "/api/observe";
@@ -10,6 +11,7 @@ export interface ObserverClient {
10
11
  listActorTypes(): Promise<ActorInventory>;
11
12
  listRequests(query: RequestHistoryQuery): Promise<RequestTracePage>;
12
13
  listResidency(actorName: string, bounds: TimeBounds, actorId?: string): Promise<ResidencyHistory>;
14
+ getResources(actorName: string, actorId: string, bounds: TimeBounds, bucketMs: number): Promise<ResourceUsage>;
13
15
  listEventHistory(types: RecordedEvent["type"][], bounds: TimeBounds, actorName?: string, actorId?: string): Promise<EventHistory>;
14
16
  listWebSockets(): Promise<SocketSession[]>;
15
17
  listLogs(filter: LogFilter, bounds: TimeBounds, cursor: string | null): Promise<ActorLogPage>;
@@ -21,6 +23,7 @@ export declare class HttpObserverClient implements ObserverClient {
21
23
  listActorTypes(): Promise<ActorInventory>;
22
24
  listRequests({ fromMs, toMs, limit, cursor, actorName, actorId }: RequestHistoryQuery): Promise<RequestTracePage>;
23
25
  listResidency(actorName: string, { fromMs, toMs }: TimeBounds, actorId?: string): Promise<ResidencyHistory>;
26
+ getResources(actorName: string, actorId: string, { fromMs, toMs }: TimeBounds, bucketMs: number): Promise<ResourceUsage>;
24
27
  listEventHistory(types: RecordedEvent["type"][], { fromMs, toMs }: TimeBounds, actorName?: string, actorId?: string): Promise<EventHistory>;
25
28
  listWebSockets(): Promise<SocketSession[]>;
26
29
  listLogs(filter: LogFilter, { fromMs, toMs }: TimeBounds, cursor: string | null): Promise<ActorLogPage>;
@@ -6,15 +6,15 @@ export type LogColumns = {
6
6
  };
7
7
  export type LogListProps = {
8
8
  lines: ActorLog[] | null;
9
- failed: boolean;
10
9
  search: string;
11
10
  filtered: boolean;
12
11
  onFilterRequest: (requestId: string) => void;
13
12
  onClearFilters: () => void;
14
13
  onReachEnd: (() => void) | undefined;
14
+ loadingOlder: boolean;
15
15
  columns: LogColumns;
16
16
  };
17
- export declare function LogList({ lines, failed, search, filtered, onFilterRequest, onClearFilters, onReachEnd, columns }: LogListProps): import("react").JSX.Element;
17
+ export declare function LogList({ lines, search, filtered, onFilterRequest, onClearFilters, onReachEnd, loadingOlder, columns }: LogListProps): import("react").JSX.Element;
18
18
  export declare function LevelBadge({ level, className, children }: {
19
19
  level: LogLevel;
20
20
  className?: string;
@@ -0,0 +1,13 @@
1
+ import type { ActorKill } from "../../types/Kills.js";
2
+ import type { ResourceUsage } from "../../types/Resources.js";
3
+ import type { TimeWindow } from "../../types/TimeRange.js";
4
+ export type ResourceCardProps = {
5
+ resources: ResourceUsage | null;
6
+ failed: boolean;
7
+ timeWindow: TimeWindow;
8
+ };
9
+ export declare function CpuCard({ resources, failed, timeWindow }: ResourceCardProps): import("react").JSX.Element;
10
+ export declare function MemoryCard({ resources, kills, failed, timeWindow }: ResourceCardProps & {
11
+ kills: ActorKill[];
12
+ }): import("react").JSX.Element;
13
+ export declare function StorageCard({ resources, failed, timeWindow }: ResourceCardProps): import("react").JSX.Element;
@@ -1,11 +1,18 @@
1
1
  export type PointDescription = {
2
2
  at: string;
3
3
  value: string;
4
+ details?: string[];
5
+ };
6
+ /** A grey line under the series, such as a reservation (solid) or a limit (dotted). Null leaves a gap. */
7
+ export type Reference = {
8
+ values: (number | null)[];
9
+ dotted?: boolean;
4
10
  };
5
11
  export type SparklineProps = {
6
12
  values: number[];
7
13
  color: string;
8
14
  label: string;
9
15
  describePoint?: (index: number) => PointDescription;
16
+ references?: Reference[];
10
17
  };
11
- export declare function Sparkline({ values, color, label, describePoint }: SparklineProps): import("react").JSX.Element;
18
+ export declare function Sparkline({ values, color, label, describePoint, references }: SparklineProps): import("react").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
- import { type PointDescription } from "./sparkline.js";
2
+ import { type PointDescription, type Reference } from "./sparkline.js";
3
3
  export type TrendCardProps = {
4
4
  label: string;
5
5
  value: ReactNode;
@@ -11,5 +11,8 @@ export type TrendCardProps = {
11
11
  color: string;
12
12
  chartLabel: string;
13
13
  describePoint: (index: number) => PointDescription;
14
+ references?: Reference[];
15
+ /** A row under the figure, such as the chart's legend. */
16
+ children?: ReactNode;
14
17
  };
15
- export declare function TrendCard({ label, value, unit, busy, failed, series, axis, color, chartLabel, describePoint }: TrendCardProps): import("react").JSX.Element;
18
+ export declare function TrendCard({ label, value, unit, busy, failed, series, axis, color, chartLabel, describePoint, references, children }: TrendCardProps): import("react").JSX.Element;
package/dist/format.d.ts CHANGED
@@ -10,7 +10,15 @@ export declare const formatDecimal: (value: number) => string;
10
10
  export declare const formatPercent: (ratio: number) => string;
11
11
  export declare const formatMs: (ms: number) => string;
12
12
  export declare const formatMegabytes: (bytes: number) => string;
13
+ export declare const formatCpu: (cores: number) => string;
14
+ export declare const formatMebibytes: (bytes: number) => string;
13
15
  export declare const formatPlural: (value: number, noun: string) => string;
14
16
  export declare function formatMsParts(ms: number): [value: string, unit: string];
15
17
  export declare function formatDuration(ms: number): string;
16
18
  export declare function formatAgo(ms: number, now: number): string;
19
+ /** Bytes in the largest unit that keeps the shown value under 1,000. */
20
+ export declare function scaleBytes(bytes: number): {
21
+ value: string;
22
+ unit: string;
23
+ };
24
+ export declare const formatBytes: (bytes: number) => string;
@@ -0,0 +1,6 @@
1
+ import type { TimeWindow } from "../types/TimeRange.js";
2
+ /** One instance's CPU, memory and database size, in the window's buckets. */
3
+ export declare function useResources(actorName: string, actorId: string, timeWindow: TimeWindow): {
4
+ resources: import("../types/Resources.js").ResourceUsage | null;
5
+ isError: boolean;
6
+ };