durable-actors-observer 0.19.0 → 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 +2 -0
- package/dist/client/events.d.ts +11 -2
- package/dist/client/observerClient.d.ts +4 -1
- package/dist/components/actorType/timingCard.d.ts +5 -5
- package/dist/components/overview/requestRateCard.d.ts +3 -3
- 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/index.js +1377 -1253
- package/dist/lib/requestStats.d.ts +11 -7
- package/dist/lib/views/histogram.d.ts +22 -0
- package/dist/lib/views/requests.d.ts +8 -1
- package/dist/standalone/app.css +1 -1
- package/dist/standalone/app.js +15 -15
- package/dist/theme.css +1 -1
- package/dist/types/Histogram.d.ts +6 -0
- package/dist/types/Requests.d.ts +14 -0
- package/package.json +1 -1
|
@@ -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,6 +1,8 @@
|
|
|
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];
|
|
5
7
|
export declare const resourcesKey: (baseUrl: string, actorName: string, actorId: string) => readonly ["resources", string, string, string];
|
|
6
8
|
export declare const eventHistoryKey: (baseUrl: string, types: string[], actorName?: string, actorId?: string) => readonly ["events/history", string, string, string | undefined, string | undefined];
|
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,7 +1,8 @@
|
|
|
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";
|
|
6
7
|
import type { ResourceUsage } from "../types/Resources.js";
|
|
7
8
|
import type { SocketSession } from "../types/Sockets.js";
|
|
@@ -10,6 +11,7 @@ export declare const defaultBaseUrl = "/api/observe";
|
|
|
10
11
|
export interface ObserverClient {
|
|
11
12
|
listActorTypes(): Promise<ActorInventory>;
|
|
12
13
|
listRequests(query: RequestHistoryQuery): Promise<RequestTracePage>;
|
|
14
|
+
getRequestHistogram(filter: RequestFilter, bounds: TimeBounds, bucketMs: number): Promise<RequestHistogram>;
|
|
13
15
|
listResidency(actorName: string, bounds: TimeBounds, actorId?: string): Promise<ResidencyHistory>;
|
|
14
16
|
getResources(actorName: string, actorId: string, bounds: TimeBounds, bucketMs: number): Promise<ResourceUsage>;
|
|
15
17
|
listEventHistory(types: RecordedEvent["type"][], bounds: TimeBounds, actorName?: string, actorId?: string): Promise<EventHistory>;
|
|
@@ -22,6 +24,7 @@ export declare class HttpObserverClient implements ObserverClient {
|
|
|
22
24
|
constructor(baseUrl?: string);
|
|
23
25
|
listActorTypes(): Promise<ActorInventory>;
|
|
24
26
|
listRequests({ fromMs, toMs, limit, cursor, actorName, actorId }: RequestHistoryQuery): Promise<RequestTracePage>;
|
|
27
|
+
getRequestHistogram({ actorName, actorId }: RequestFilter, { fromMs, toMs }: TimeBounds, bucketMs: number): Promise<RequestHistogram>;
|
|
25
28
|
listResidency(actorName: string, { fromMs, toMs }: TimeBounds, actorId?: string): Promise<ResidencyHistory>;
|
|
26
29
|
getResources(actorName: string, actorId: string, { fromMs, toMs }: TimeBounds, bucketMs: number): Promise<ResourceUsage>;
|
|
27
30
|
listEventHistory(types: RecordedEvent["type"][], { fromMs, toMs }: TimeBounds, actorName?: string, actorId?: string): Promise<EventHistory>;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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
|
};
|