durable-actors-observer 0.18.8 → 0.19.1
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.
- package/dist/client/DatatContext.d.ts +4 -2
- package/dist/client/cacheKeys.d.ts +3 -0
- package/dist/client/events.d.ts +11 -2
- package/dist/client/observerClient.d.ts +7 -1
- package/dist/components/actorType/timingCard.d.ts +5 -5
- package/dist/components/instance/logList.d.ts +2 -2
- package/dist/components/instance/resourceCards.d.ts +13 -0
- package/dist/components/overview/requestRateCard.d.ts +3 -3
- package/dist/components/ui/sparkline.d.ts +8 -1
- package/dist/components/ui/trendCard.d.ts +5 -2
- package/dist/format.d.ts +8 -0
- package/dist/hooks/useLiveHistogram.d.ts +16 -0
- package/dist/hooks/useNow.d.ts +2 -2
- package/dist/hooks/useRequests.d.ts +4 -4
- package/dist/hooks/useResources.d.ts +6 -0
- package/dist/index.js +1798 -1314
- package/dist/lib/requestStats.d.ts +11 -7
- package/dist/lib/resources.d.ts +12 -0
- package/dist/lib/views/histogram.d.ts +22 -0
- package/dist/lib/views/requests.d.ts +8 -1
- package/dist/lib/views/resources.d.ts +4 -0
- package/dist/standalone/app.css +1 -1
- package/dist/standalone/app.js +15 -15
- package/dist/theme.css +1 -1
- package/dist/types/Events.d.ts +13 -0
- package/dist/types/Histogram.d.ts +6 -0
- package/dist/types/Requests.d.ts +14 -0
- package/dist/types/Resources.d.ts +25 -10
- package/package.json +1 -1
- package/dist/components/instance/memoryCard.d.ts +0 -7
- package/dist/components/instance/storageCard.d.ts +0 -8
- package/dist/mocks/instanceResources.d.ts +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import type { ActorInventory } from "../types/Actors.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { RequestHistogram } from "../types/Requests.js";
|
|
4
4
|
import type { SocketSession } from "../types/Sockets.js";
|
|
5
5
|
import type { EventBus } from "./events.js";
|
|
6
6
|
type DataContextType = {
|
|
@@ -8,10 +8,12 @@ type DataContextType = {
|
|
|
8
8
|
events: EventBus | null;
|
|
9
9
|
actorTypes: ActorInventory | null;
|
|
10
10
|
isError: boolean;
|
|
11
|
-
|
|
11
|
+
requestHistogram: RequestHistogram | undefined;
|
|
12
12
|
isRequestsError: boolean;
|
|
13
13
|
sessions: SocketSession[] | null;
|
|
14
14
|
isSocketsError: boolean;
|
|
15
|
+
/** The time current statuses are worked out at: the clock while live, held while paused. */
|
|
16
|
+
nowMs: number;
|
|
15
17
|
};
|
|
16
18
|
export declare const DataProvider: ({ baseUrl, children }: {
|
|
17
19
|
baseUrl?: string;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import type { RequestFilter } from "../lib/views/requests.js";
|
|
1
2
|
import type { LogFilter } from "../types/Logs.js";
|
|
2
3
|
export declare const actorsKey: (baseUrl: string) => readonly ["actors", string];
|
|
3
4
|
export declare const requestsKey: (baseUrl: string) => readonly ["requests", string];
|
|
5
|
+
export declare const requestHistogramKey: (baseUrl: string, { actorName, actorId }: RequestFilter) => readonly ["requests/histogram", string, string | undefined, string | undefined];
|
|
4
6
|
export declare const residencyKey: (baseUrl: string, actorName: string, actorId?: string) => readonly ["residency", string, string, string | undefined];
|
|
7
|
+
export declare const resourcesKey: (baseUrl: string, actorName: string, actorId: string) => readonly ["resources", string, string, string];
|
|
5
8
|
export declare const eventHistoryKey: (baseUrl: string, types: string[], actorName?: string, actorId?: string) => readonly ["events/history", string, string, string | undefined, string | undefined];
|
|
6
9
|
export declare const webSocketsKey: (baseUrl: string) => readonly ["websockets", string];
|
|
7
10
|
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];
|
package/dist/client/events.d.ts
CHANGED
|
@@ -9,14 +9,23 @@ export declare class EventBus {
|
|
|
9
9
|
private readonly listeners;
|
|
10
10
|
private readonly reconnectListeners;
|
|
11
11
|
private recent;
|
|
12
|
+
private openedBefore;
|
|
13
|
+
private pending;
|
|
14
|
+
private flushTimer;
|
|
12
15
|
subscribe(listener: Listener): () => void;
|
|
13
|
-
/** Runs
|
|
16
|
+
/** Runs when the stream opens again, as after a pause or a dropped connection, when events may have been missed. */
|
|
14
17
|
onReconnect(listener: () => void): () => void;
|
|
15
18
|
/** Forgets the recent events when the stream starts over with a different query. */
|
|
16
19
|
reset(): void;
|
|
17
20
|
recentEvents(): ObserveEvent[];
|
|
18
21
|
publish(events: ObserveEvent[]): void;
|
|
19
|
-
|
|
22
|
+
/** `afterGap` marks a first open that came well after the views read the store. */
|
|
23
|
+
opened(afterGap?: boolean): void;
|
|
24
|
+
private flush;
|
|
20
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Streams while the page is visible. A hidden tab closes the stream; showing it again reopens it
|
|
28
|
+
* and the views read the store again, as after any reopen.
|
|
29
|
+
*/
|
|
21
30
|
export declare function openEventStream(baseUrl: string, query: URLSearchParams, bus: EventBus): () => void;
|
|
22
31
|
export {};
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import type { RequestFilter } from "../lib/views/requests.js";
|
|
1
2
|
import type { ActorInventory } from "../types/Actors.js";
|
|
2
3
|
import type { EventHistory, RecordedEvent } from "../types/Events.js";
|
|
3
4
|
import type { ActorLogPage, LogFilter, LogHistogram } from "../types/Logs.js";
|
|
4
|
-
import type { RequestHistoryQuery, RequestTrace, RequestTracePage } from "../types/Requests.js";
|
|
5
|
+
import type { RequestHistogram, RequestHistoryQuery, RequestTrace, RequestTracePage } from "../types/Requests.js";
|
|
5
6
|
import type { ResidencyHistory } from "../types/Residency.js";
|
|
7
|
+
import type { ResourceUsage } from "../types/Resources.js";
|
|
6
8
|
import type { SocketSession } from "../types/Sockets.js";
|
|
7
9
|
import type { TimeBounds } from "../types/TimeRange.js";
|
|
8
10
|
export declare const defaultBaseUrl = "/api/observe";
|
|
9
11
|
export interface ObserverClient {
|
|
10
12
|
listActorTypes(): Promise<ActorInventory>;
|
|
11
13
|
listRequests(query: RequestHistoryQuery): Promise<RequestTracePage>;
|
|
14
|
+
getRequestHistogram(filter: RequestFilter, bounds: TimeBounds, bucketMs: number): Promise<RequestHistogram>;
|
|
12
15
|
listResidency(actorName: string, bounds: TimeBounds, actorId?: string): Promise<ResidencyHistory>;
|
|
16
|
+
getResources(actorName: string, actorId: string, bounds: TimeBounds, bucketMs: number): Promise<ResourceUsage>;
|
|
13
17
|
listEventHistory(types: RecordedEvent["type"][], bounds: TimeBounds, actorName?: string, actorId?: string): Promise<EventHistory>;
|
|
14
18
|
listWebSockets(): Promise<SocketSession[]>;
|
|
15
19
|
listLogs(filter: LogFilter, bounds: TimeBounds, cursor: string | null): Promise<ActorLogPage>;
|
|
@@ -20,7 +24,9 @@ export declare class HttpObserverClient implements ObserverClient {
|
|
|
20
24
|
constructor(baseUrl?: string);
|
|
21
25
|
listActorTypes(): Promise<ActorInventory>;
|
|
22
26
|
listRequests({ fromMs, toMs, limit, cursor, actorName, actorId }: RequestHistoryQuery): Promise<RequestTracePage>;
|
|
27
|
+
getRequestHistogram({ actorName, actorId }: RequestFilter, { fromMs, toMs }: TimeBounds, bucketMs: number): Promise<RequestHistogram>;
|
|
23
28
|
listResidency(actorName: string, { fromMs, toMs }: TimeBounds, actorId?: string): Promise<ResidencyHistory>;
|
|
29
|
+
getResources(actorName: string, actorId: string, { fromMs, toMs }: TimeBounds, bucketMs: number): Promise<ResourceUsage>;
|
|
24
30
|
listEventHistory(types: RecordedEvent["type"][], { fromMs, toMs }: TimeBounds, actorName?: string, actorId?: string): Promise<EventHistory>;
|
|
25
31
|
listWebSockets(): Promise<SocketSession[]>;
|
|
26
32
|
listLogs(filter: LogFilter, { fromMs, toMs }: TimeBounds, cursor: string | null): Promise<ActorLogPage>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type {
|
|
1
|
+
import { type CountsAverage } from "../../lib/requestStats.js";
|
|
2
|
+
import type { RequestHistogram } from "../../types/Requests.js";
|
|
3
3
|
import type { TimeWindow } from "../../types/TimeRange.js";
|
|
4
4
|
export type TimingCardProps = {
|
|
5
5
|
label: string;
|
|
6
|
-
pick:
|
|
6
|
+
pick: CountsAverage;
|
|
7
7
|
color: string;
|
|
8
8
|
chartLabel: string;
|
|
9
|
-
|
|
9
|
+
histogram: RequestHistogram | undefined;
|
|
10
10
|
failed: boolean;
|
|
11
11
|
timeWindow: TimeWindow;
|
|
12
12
|
};
|
|
13
|
-
export declare function TimingCard({ label, pick, color, chartLabel,
|
|
13
|
+
export declare function TimingCard({ label, pick, color, chartLabel, histogram, failed, timeWindow }: TimingCardProps): import("react").JSX.Element;
|
|
@@ -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,
|
|
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,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RequestHistogram } from "../../types/Requests.js";
|
|
2
2
|
import type { TimeWindow } from "../../types/TimeRange.js";
|
|
3
3
|
export type RequestRateTrendProps = {
|
|
4
|
-
|
|
4
|
+
histogram: RequestHistogram | undefined;
|
|
5
5
|
failed: boolean;
|
|
6
6
|
timeWindow: TimeWindow;
|
|
7
7
|
color: string;
|
|
8
8
|
};
|
|
9
|
-
export declare function RequestRateTrend({
|
|
9
|
+
export declare function RequestRateTrend({ histogram, failed, timeWindow, color }: RequestRateTrendProps): 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,16 @@
|
|
|
1
|
+
import type { EventBus } from "../client/events.js";
|
|
2
|
+
import { type LiveHistogram } from "../lib/views/histogram.js";
|
|
3
|
+
import type { Histogram } from "../types/Histogram.js";
|
|
4
|
+
import type { TimeBounds, TimeWindow } from "../types/TimeRange.js";
|
|
5
|
+
import { type ApplyEvents } from "./useLiveView.js";
|
|
6
|
+
export type HistogramSource<T> = {
|
|
7
|
+
key: readonly unknown[];
|
|
8
|
+
read: (bounds: TimeBounds, bucketMs: number) => Promise<Histogram<T>>;
|
|
9
|
+
apply: ApplyEvents<LiveHistogram<T>>;
|
|
10
|
+
empty: () => T;
|
|
11
|
+
};
|
|
12
|
+
/** A histogram read from the store, with the stream's records counted in while the window is live. */
|
|
13
|
+
export declare function useLiveHistogram<T>({ key, read, apply, empty }: HistogramSource<T>, timeWindow: TimeWindow, bucketMs: number, events: EventBus | null): {
|
|
14
|
+
histogram: Histogram<T> | undefined;
|
|
15
|
+
isError: boolean;
|
|
16
|
+
};
|
package/dist/hooks/useNow.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** The current time, updated every `intervalMs
|
|
2
|
-
export declare function useNow(intervalMs: number): number;
|
|
1
|
+
/** The current time, updated every `intervalMs`; held while it is null. */
|
|
2
|
+
export declare function useNow(intervalMs: number | null): number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { EventBus } from "../client/events.js";
|
|
2
|
+
import { type RequestFilter } from "../lib/views/requests.js";
|
|
2
3
|
import type { TimeWindow } from "../types/TimeRange.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/** Request counts per window step, from one store query rather than every request in the window. */
|
|
5
|
+
export declare function useRequestHistogram(baseUrl: string, timeWindow: TimeWindow, filter: RequestFilter, events: EventBus | null): {
|
|
6
|
+
histogram: import("../types/Histogram.js").Histogram<import("../types/Requests.js").RequestCounts> | undefined;
|
|
6
7
|
isError: boolean;
|
|
7
|
-
error: any;
|
|
8
8
|
};
|
|
@@ -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
|
+
};
|