MCPcopy
hub / github.com/soketi/soketi / MetricsInterface

Interface MetricsInterface

src/metrics/metrics-interface.ts:4–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2import { WebSocket } from 'uWebSockets.js';
3
4export interface MetricsInterface {
5 /**
6 * The Metrics driver.
7 */
8 driver?: MetricsInterface;
9
10 /**
11 * Handle a new connection.
12 */
13 markNewConnection(ws: WebSocket): void;
14
15 /**
16 * Handle a disconnection.
17 */
18 markDisconnection(ws: WebSocket): void;
19
20 /**
21 * Handle a new API message event being received and sent out.
22 */
23 markApiMessage(appId: string, incomingMessage: any, sentMessage: any): void;
24
25 /**
26 * Handle a new WS client message event being sent.
27 */
28 markWsMessageSent(appId: string, sentMessage: any): void;
29
30 /**
31 * Handle a new WS client message being received.
32 */
33 markWsMessageReceived(appId: string, message: any): void;
34
35 /**
36 * Track the time in which horizontal adapter resolves requests from other nodes.
37 */
38 trackHorizontalAdapterResolveTime(appId: string, time: number): void;
39
40 /**
41 * Track the fulfillings in which horizontal adapter resolves requests from other nodes.
42 */
43 trackHorizontalAdapterResolvedPromises(appId: string, resolved?: boolean): void;
44
45 /**
46 * Handle a new horizontal adapter request sent.
47 */
48 markHorizontalAdapterRequestSent(appId: string): void;
49
50 /**
51 * Handle a new horizontal adapter request that was marked as received.
52 */
53 markHorizontalAdapterRequestReceived(appId: string): void;
54
55 /**
56 * Handle a new horizontal adapter response from other node.
57 */
58 markHorizontalAdapterResponseReceived(appId: string): void;
59
60 /**
61 * Get the stored metrics as plain text, if possible.

Callers 31

onOpenMethod · 0.65
markNewConnectionMethod · 0.65
evictSocketFromMemoryMethod · 0.65
markDisconnectionMethod · 0.65
channelsMethod · 0.65
channelMethod · 0.65
channelUsersMethod · 0.65
eventsMethod · 0.65
batchEventsMethod · 0.65
markApiMessageMethod · 0.65
onOpenMethod · 0.65
markWsMessageSentMethod · 0.65

Implementers 2

Metricssrc/metrics/metrics.ts
PrometheusMetricsDriversrc/metrics/prometheus-metrics-driver.

Calls

no outgoing calls

Tested by

no test coverage detected