| 2 | import { WebSocket } from 'uWebSockets.js'; |
| 3 | |
| 4 | export 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. |
no outgoing calls
no test coverage detected