@qualithm/arrow-flight-sql-js 0.0.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/LICENSE +18 -0
- package/README.md +433 -0
- package/dist/arrow.d.ts +65 -0
- package/dist/arrow.d.ts.map +1 -0
- package/dist/arrow.js +250 -0
- package/dist/arrow.js.map +1 -0
- package/dist/client.d.ts +416 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +1087 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +128 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +181 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/index.d.ts +4 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +33 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/metrics.d.ts +217 -0
- package/dist/metrics.d.ts.map +1 -0
- package/dist/metrics.js +304 -0
- package/dist/metrics.js.map +1 -0
- package/dist/pool.d.ts +161 -0
- package/dist/pool.d.ts.map +1 -0
- package/dist/pool.js +434 -0
- package/dist/pool.js.map +1 -0
- package/dist/proto.d.ts +168 -0
- package/dist/proto.d.ts.map +1 -0
- package/dist/proto.js +417 -0
- package/dist/proto.js.map +1 -0
- package/dist/query-builder.d.ts +1 -0
- package/dist/query-builder.d.ts.map +1 -0
- package/dist/query-builder.js +3 -0
- package/dist/query-builder.js.map +1 -0
- package/dist/retry.d.ts +92 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +212 -0
- package/dist/retry.js.map +1 -0
- package/dist/types.d.ts +325 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +18 -0
- package/dist/types.js.map +1 -0
- package/package.json +82 -0
- package/proto/Flight.proto +645 -0
- package/proto/FlightSql.proto +1925 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metrics and observability hooks for Arrow Flight SQL client.
|
|
3
|
+
*
|
|
4
|
+
* This module provides a flexible metrics interface that can be integrated
|
|
5
|
+
* with various observability backends (OpenTelemetry, Prometheus, StatsD, etc.).
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { FlightSqlClient, ConsoleMetricsHandler } from "@qualithm/arrow-flight-sql-js"
|
|
10
|
+
*
|
|
11
|
+
* const client = new FlightSqlClient({
|
|
12
|
+
* host: "localhost",
|
|
13
|
+
* port: 50051,
|
|
14
|
+
* metrics: new ConsoleMetricsHandler()
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Types of operations that can be measured
|
|
20
|
+
*/
|
|
21
|
+
export type OperationType = "connect" | "close" | "handshake" | "query" | "execute" | "executeUpdate" | "prepare" | "getFlightInfo" | "getSchema" | "doGet" | "doPut" | "doAction" | "getCatalogs" | "getSchemas" | "getTables" | "getTableTypes" | "getPrimaryKeys" | "getExportedKeys" | "getImportedKeys" | "poolAcquire" | "poolRelease" | "healthCheck" | "retry";
|
|
22
|
+
/**
|
|
23
|
+
* Status of an operation
|
|
24
|
+
*/
|
|
25
|
+
export type OperationStatus = "success" | "error" | "timeout" | "cancelled";
|
|
26
|
+
/**
|
|
27
|
+
* Metric event emitted when an operation completes
|
|
28
|
+
*/
|
|
29
|
+
export interface MetricEvent {
|
|
30
|
+
/** Type of operation */
|
|
31
|
+
operation: OperationType;
|
|
32
|
+
/** Final status of the operation */
|
|
33
|
+
status: OperationStatus;
|
|
34
|
+
/** Duration in milliseconds */
|
|
35
|
+
durationMs: number;
|
|
36
|
+
/** Start timestamp (ms since epoch) */
|
|
37
|
+
startTime: number;
|
|
38
|
+
/** End timestamp (ms since epoch) */
|
|
39
|
+
endTime: number;
|
|
40
|
+
/** Error if status is not 'success' */
|
|
41
|
+
error?: Error;
|
|
42
|
+
/** Additional metadata about the operation */
|
|
43
|
+
metadata?: Record<string, string | number | boolean>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Gauge metric for current values (like pool size)
|
|
47
|
+
*/
|
|
48
|
+
export interface GaugeEvent {
|
|
49
|
+
/** Name of the gauge */
|
|
50
|
+
name: string;
|
|
51
|
+
/** Current value */
|
|
52
|
+
value: number;
|
|
53
|
+
/** Optional labels */
|
|
54
|
+
labels?: Record<string, string>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Counter metric for incrementing values
|
|
58
|
+
*/
|
|
59
|
+
export interface CounterEvent {
|
|
60
|
+
/** Name of the counter */
|
|
61
|
+
name: string;
|
|
62
|
+
/** Increment amount (default: 1) */
|
|
63
|
+
increment: number;
|
|
64
|
+
/** Optional labels */
|
|
65
|
+
labels?: Record<string, string>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Interface for handling metrics events.
|
|
69
|
+
*
|
|
70
|
+
* Implement this interface to integrate with your observability backend.
|
|
71
|
+
*/
|
|
72
|
+
export interface MetricsHandler {
|
|
73
|
+
/**
|
|
74
|
+
* Record a timed operation metric
|
|
75
|
+
*/
|
|
76
|
+
recordOperation(event: MetricEvent): void;
|
|
77
|
+
/**
|
|
78
|
+
* Record a gauge value
|
|
79
|
+
*/
|
|
80
|
+
recordGauge(event: GaugeEvent): void;
|
|
81
|
+
/**
|
|
82
|
+
* Record a counter increment
|
|
83
|
+
*/
|
|
84
|
+
recordCounter(event: CounterEvent): void;
|
|
85
|
+
/**
|
|
86
|
+
* Called when the client is closed, allowing cleanup
|
|
87
|
+
*/
|
|
88
|
+
close?(): void | Promise<void>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* No-op metrics handler that discards all metrics.
|
|
92
|
+
* Used when no metrics handler is configured.
|
|
93
|
+
*/
|
|
94
|
+
export declare class NoopMetricsHandler implements MetricsHandler {
|
|
95
|
+
recordOperation(_event: MetricEvent): void;
|
|
96
|
+
recordGauge(_event: GaugeEvent): void;
|
|
97
|
+
recordCounter(_event: CounterEvent): void;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Console-based metrics handler for development and debugging.
|
|
101
|
+
* Logs all metrics to console with formatted output.
|
|
102
|
+
*/
|
|
103
|
+
export declare class ConsoleMetricsHandler implements MetricsHandler {
|
|
104
|
+
private readonly prefix;
|
|
105
|
+
constructor(prefix?: string);
|
|
106
|
+
recordOperation(event: MetricEvent): void;
|
|
107
|
+
recordGauge(event: GaugeEvent): void;
|
|
108
|
+
recordCounter(event: CounterEvent): void;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* In-memory metrics collector for testing and simple monitoring.
|
|
112
|
+
* Stores metrics in memory and provides query methods.
|
|
113
|
+
*/
|
|
114
|
+
export declare class InMemoryMetricsHandler implements MetricsHandler {
|
|
115
|
+
private readonly operations;
|
|
116
|
+
private readonly gauges;
|
|
117
|
+
private readonly counters;
|
|
118
|
+
private readonly maxOperations;
|
|
119
|
+
constructor(options?: {
|
|
120
|
+
maxOperations?: number;
|
|
121
|
+
});
|
|
122
|
+
recordOperation(event: MetricEvent): void;
|
|
123
|
+
recordGauge(event: GaugeEvent): void;
|
|
124
|
+
recordCounter(event: CounterEvent): void;
|
|
125
|
+
/**
|
|
126
|
+
* Get all recorded operations
|
|
127
|
+
*/
|
|
128
|
+
getOperations(): readonly MetricEvent[];
|
|
129
|
+
/**
|
|
130
|
+
* Get operations filtered by type
|
|
131
|
+
*/
|
|
132
|
+
getOperationsByType(operation: OperationType): MetricEvent[];
|
|
133
|
+
/**
|
|
134
|
+
* Get average duration for an operation type
|
|
135
|
+
*/
|
|
136
|
+
getAverageDuration(operation: OperationType): number;
|
|
137
|
+
/**
|
|
138
|
+
* Get error rate for an operation type
|
|
139
|
+
*/
|
|
140
|
+
getErrorRate(operation: OperationType): number;
|
|
141
|
+
/**
|
|
142
|
+
* Get current gauge value
|
|
143
|
+
*/
|
|
144
|
+
getGauge(name: string, labels?: Record<string, string>): number | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Get current counter value
|
|
147
|
+
*/
|
|
148
|
+
getCounter(name: string, labels?: Record<string, string>): number;
|
|
149
|
+
/**
|
|
150
|
+
* Get summary statistics
|
|
151
|
+
*/
|
|
152
|
+
getSummary(): {
|
|
153
|
+
totalOperations: number;
|
|
154
|
+
successCount: number;
|
|
155
|
+
errorCount: number;
|
|
156
|
+
operationCounts: Record<string, number>;
|
|
157
|
+
averageDurations: Record<string, number>;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Clear all stored metrics
|
|
161
|
+
*/
|
|
162
|
+
clear(): void;
|
|
163
|
+
private makeKey;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Helper class for timing operations and recording metrics
|
|
167
|
+
*/
|
|
168
|
+
export declare class MetricsTimer {
|
|
169
|
+
private readonly handler;
|
|
170
|
+
private readonly operation;
|
|
171
|
+
private readonly startTime;
|
|
172
|
+
private readonly metadata;
|
|
173
|
+
constructor(handler: MetricsHandler, operation: OperationType, metadata?: Record<string, string | number | boolean>);
|
|
174
|
+
/**
|
|
175
|
+
* Record success and return duration
|
|
176
|
+
*/
|
|
177
|
+
success(additionalMetadata?: Record<string, string | number | boolean>): number;
|
|
178
|
+
/**
|
|
179
|
+
* Record error and return duration
|
|
180
|
+
*/
|
|
181
|
+
error(err: Error, additionalMetadata?: Record<string, string | number | boolean>): number;
|
|
182
|
+
/**
|
|
183
|
+
* Record timeout and return duration
|
|
184
|
+
*/
|
|
185
|
+
timeout(err?: Error, additionalMetadata?: Record<string, string | number | boolean>): number;
|
|
186
|
+
/**
|
|
187
|
+
* Record cancellation and return duration
|
|
188
|
+
*/
|
|
189
|
+
cancelled(err?: Error, additionalMetadata?: Record<string, string | number | boolean>): number;
|
|
190
|
+
private record;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Create a metrics timer for an operation
|
|
194
|
+
*/
|
|
195
|
+
export declare function startTimer(handler: MetricsHandler, operation: OperationType, metadata?: Record<string, string | number | boolean>): MetricsTimer;
|
|
196
|
+
/**
|
|
197
|
+
* Wrap an async function with metrics timing
|
|
198
|
+
*/
|
|
199
|
+
export declare function withMetrics<T>(handler: MetricsHandler, operation: OperationType, fn: () => Promise<T>, metadata?: Record<string, string | number | boolean>): Promise<T>;
|
|
200
|
+
/**
|
|
201
|
+
* Standard metric names for consistency
|
|
202
|
+
*/
|
|
203
|
+
export declare const MetricNames: {
|
|
204
|
+
readonly poolTotalConnections: "flight_sql.pool.total_connections";
|
|
205
|
+
readonly poolActiveConnections: "flight_sql.pool.active_connections";
|
|
206
|
+
readonly poolIdleConnections: "flight_sql.pool.idle_connections";
|
|
207
|
+
readonly poolPendingRequests: "flight_sql.pool.pending_requests";
|
|
208
|
+
readonly queriesExecuted: "flight_sql.queries.executed";
|
|
209
|
+
readonly queriesSucceeded: "flight_sql.queries.succeeded";
|
|
210
|
+
readonly queriesFailed: "flight_sql.queries.failed";
|
|
211
|
+
readonly bytesReceived: "flight_sql.bytes.received";
|
|
212
|
+
readonly bytesSent: "flight_sql.bytes.sent";
|
|
213
|
+
readonly retriesAttempted: "flight_sql.retries.attempted";
|
|
214
|
+
readonly connectionsCreated: "flight_sql.connections.created";
|
|
215
|
+
readonly connectionsClosed: "flight_sql.connections.closed";
|
|
216
|
+
};
|
|
217
|
+
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,OAAO,GACP,WAAW,GACX,OAAO,GACP,SAAS,GACT,eAAe,GACf,SAAS,GACT,eAAe,GACf,WAAW,GACX,OAAO,GACP,OAAO,GACP,UAAU,GACV,aAAa,GACb,YAAY,GACZ,WAAW,GACX,eAAe,GACf,gBA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AAG,MAAM;IAIzF;;OAEG;IACH,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,MAAM;IAI5F;;OAEG;IACH,SAAS,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,MAAM;IAI9F,OAAO,CAAC,MAAM;CAoBf;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,aAAa,EACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACnD,YAAY,CAEd;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,CAAC,EACjC,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,aAAa,EACxB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACnD,OAAO,CAAC,CAAC,CAAC,CAqBZ;AAMD;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAgBd,CAAA"}
|
package/dist/metrics.js
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metrics and observability hooks for Arrow Flight SQL client.
|
|
3
|
+
*
|
|
4
|
+
* This module provides a flexible metrics interface that can be integrated
|
|
5
|
+
* with various observability backends (OpenTelemetry, Prometheus, StatsD, etc.).
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { FlightSqlClient, ConsoleMetricsHandler } from "@qualithm/arrow-flight-sql-js"
|
|
10
|
+
*
|
|
11
|
+
* const client = new FlightSqlClient({
|
|
12
|
+
* host: "localhost",
|
|
13
|
+
* port: 50051,
|
|
14
|
+
* metrics: new ConsoleMetricsHandler()
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
// ============================================================================
|
|
19
|
+
// Built-in Metrics Handlers
|
|
20
|
+
// ============================================================================
|
|
21
|
+
/**
|
|
22
|
+
* No-op metrics handler that discards all metrics.
|
|
23
|
+
* Used when no metrics handler is configured.
|
|
24
|
+
*/
|
|
25
|
+
export class NoopMetricsHandler {
|
|
26
|
+
recordOperation(_event) {
|
|
27
|
+
// Intentionally empty
|
|
28
|
+
}
|
|
29
|
+
recordGauge(_event) {
|
|
30
|
+
// Intentionally empty
|
|
31
|
+
}
|
|
32
|
+
recordCounter(_event) {
|
|
33
|
+
// Intentionally empty
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Console-based metrics handler for development and debugging.
|
|
38
|
+
* Logs all metrics to console with formatted output.
|
|
39
|
+
*/
|
|
40
|
+
export class ConsoleMetricsHandler {
|
|
41
|
+
prefix;
|
|
42
|
+
constructor(prefix = "[FlightSQL Metrics]") {
|
|
43
|
+
this.prefix = prefix;
|
|
44
|
+
}
|
|
45
|
+
recordOperation(event) {
|
|
46
|
+
const statusEmoji = event.status === "success" ? "✓" : "✗";
|
|
47
|
+
const message = `${this.prefix} ${statusEmoji} ${event.operation} ${event.status} (${String(event.durationMs)}ms)`;
|
|
48
|
+
if (event.status === "success") {
|
|
49
|
+
console.log(message);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
console.error(message, event.error?.message ?? "");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
recordGauge(event) {
|
|
56
|
+
const labels = event.labels ? ` ${JSON.stringify(event.labels)}` : "";
|
|
57
|
+
console.log(`${this.prefix} [gauge] ${event.name}=${String(event.value)}${labels}`);
|
|
58
|
+
}
|
|
59
|
+
recordCounter(event) {
|
|
60
|
+
const labels = event.labels ? ` ${JSON.stringify(event.labels)}` : "";
|
|
61
|
+
console.log(`${this.prefix} [counter] ${event.name}+=${String(event.increment)}${labels}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* In-memory metrics collector for testing and simple monitoring.
|
|
66
|
+
* Stores metrics in memory and provides query methods.
|
|
67
|
+
*/
|
|
68
|
+
export class InMemoryMetricsHandler {
|
|
69
|
+
operations = [];
|
|
70
|
+
gauges = new Map();
|
|
71
|
+
counters = new Map();
|
|
72
|
+
maxOperations;
|
|
73
|
+
constructor(options) {
|
|
74
|
+
this.maxOperations = options?.maxOperations ?? 1000;
|
|
75
|
+
}
|
|
76
|
+
recordOperation(event) {
|
|
77
|
+
this.operations.push(event);
|
|
78
|
+
// Keep memory bounded
|
|
79
|
+
if (this.operations.length > this.maxOperations) {
|
|
80
|
+
this.operations.shift();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
recordGauge(event) {
|
|
84
|
+
const key = this.makeKey(event.name, event.labels);
|
|
85
|
+
this.gauges.set(key, event);
|
|
86
|
+
}
|
|
87
|
+
recordCounter(event) {
|
|
88
|
+
const key = this.makeKey(event.name, event.labels);
|
|
89
|
+
const current = this.counters.get(key) ?? 0;
|
|
90
|
+
this.counters.set(key, current + event.increment);
|
|
91
|
+
}
|
|
92
|
+
// =========================================================================
|
|
93
|
+
// Query Methods
|
|
94
|
+
// =========================================================================
|
|
95
|
+
/**
|
|
96
|
+
* Get all recorded operations
|
|
97
|
+
*/
|
|
98
|
+
getOperations() {
|
|
99
|
+
return this.operations;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get operations filtered by type
|
|
103
|
+
*/
|
|
104
|
+
getOperationsByType(operation) {
|
|
105
|
+
return this.operations.filter((e) => e.operation === operation);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get average duration for an operation type
|
|
109
|
+
*/
|
|
110
|
+
getAverageDuration(operation) {
|
|
111
|
+
const ops = this.getOperationsByType(operation);
|
|
112
|
+
if (ops.length === 0) {
|
|
113
|
+
return 0;
|
|
114
|
+
}
|
|
115
|
+
return ops.reduce((sum, e) => sum + e.durationMs, 0) / ops.length;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Get error rate for an operation type
|
|
119
|
+
*/
|
|
120
|
+
getErrorRate(operation) {
|
|
121
|
+
const ops = this.getOperationsByType(operation);
|
|
122
|
+
if (ops.length === 0) {
|
|
123
|
+
return 0;
|
|
124
|
+
}
|
|
125
|
+
const errors = ops.filter((e) => e.status !== "success").length;
|
|
126
|
+
return errors / ops.length;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Get current gauge value
|
|
130
|
+
*/
|
|
131
|
+
getGauge(name, labels) {
|
|
132
|
+
const key = this.makeKey(name, labels);
|
|
133
|
+
return this.gauges.get(key)?.value;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Get current counter value
|
|
137
|
+
*/
|
|
138
|
+
getCounter(name, labels) {
|
|
139
|
+
const key = this.makeKey(name, labels);
|
|
140
|
+
return this.counters.get(key) ?? 0;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Get summary statistics
|
|
144
|
+
*/
|
|
145
|
+
getSummary() {
|
|
146
|
+
const operationCounts = {};
|
|
147
|
+
const operationDurations = {};
|
|
148
|
+
let successCount = 0;
|
|
149
|
+
let errorCount = 0;
|
|
150
|
+
for (const op of this.operations) {
|
|
151
|
+
operationCounts[op.operation] = (operationCounts[op.operation] ?? 0) + 1;
|
|
152
|
+
operationDurations[op.operation] ??= [];
|
|
153
|
+
operationDurations[op.operation].push(op.durationMs);
|
|
154
|
+
if (op.status === "success") {
|
|
155
|
+
successCount++;
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
errorCount++;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const averageDurations = {};
|
|
162
|
+
for (const [op, durations] of Object.entries(operationDurations)) {
|
|
163
|
+
averageDurations[op] = durations.reduce((a, b) => a + b, 0) / durations.length;
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
totalOperations: this.operations.length,
|
|
167
|
+
successCount,
|
|
168
|
+
errorCount,
|
|
169
|
+
operationCounts,
|
|
170
|
+
averageDurations
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Clear all stored metrics
|
|
175
|
+
*/
|
|
176
|
+
clear() {
|
|
177
|
+
this.operations.length = 0;
|
|
178
|
+
this.gauges.clear();
|
|
179
|
+
this.counters.clear();
|
|
180
|
+
}
|
|
181
|
+
makeKey(name, labels) {
|
|
182
|
+
if (!labels || Object.keys(labels).length === 0) {
|
|
183
|
+
return name;
|
|
184
|
+
}
|
|
185
|
+
const sortedLabels = Object.entries(labels)
|
|
186
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
187
|
+
.map(([k, v]) => `${k}=${v}`)
|
|
188
|
+
.join(",");
|
|
189
|
+
return `${name}{${sortedLabels}}`;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// ============================================================================
|
|
193
|
+
// Metrics Helper
|
|
194
|
+
// ============================================================================
|
|
195
|
+
/**
|
|
196
|
+
* Helper class for timing operations and recording metrics
|
|
197
|
+
*/
|
|
198
|
+
export class MetricsTimer {
|
|
199
|
+
handler;
|
|
200
|
+
operation;
|
|
201
|
+
startTime;
|
|
202
|
+
metadata;
|
|
203
|
+
constructor(handler, operation, metadata) {
|
|
204
|
+
this.handler = handler;
|
|
205
|
+
this.operation = operation;
|
|
206
|
+
this.startTime = Date.now();
|
|
207
|
+
this.metadata = metadata ?? {};
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Record success and return duration
|
|
211
|
+
*/
|
|
212
|
+
success(additionalMetadata) {
|
|
213
|
+
return this.record("success", undefined, additionalMetadata);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Record error and return duration
|
|
217
|
+
*/
|
|
218
|
+
error(err, additionalMetadata) {
|
|
219
|
+
return this.record("error", err, additionalMetadata);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Record timeout and return duration
|
|
223
|
+
*/
|
|
224
|
+
timeout(err, additionalMetadata) {
|
|
225
|
+
return this.record("timeout", err, additionalMetadata);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Record cancellation and return duration
|
|
229
|
+
*/
|
|
230
|
+
cancelled(err, additionalMetadata) {
|
|
231
|
+
return this.record("cancelled", err, additionalMetadata);
|
|
232
|
+
}
|
|
233
|
+
record(status, error, additionalMetadata) {
|
|
234
|
+
const endTime = Date.now();
|
|
235
|
+
const durationMs = endTime - this.startTime;
|
|
236
|
+
this.handler.recordOperation({
|
|
237
|
+
operation: this.operation,
|
|
238
|
+
status,
|
|
239
|
+
durationMs,
|
|
240
|
+
startTime: this.startTime,
|
|
241
|
+
endTime,
|
|
242
|
+
error,
|
|
243
|
+
metadata: { ...this.metadata, ...additionalMetadata }
|
|
244
|
+
});
|
|
245
|
+
return durationMs;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Create a metrics timer for an operation
|
|
250
|
+
*/
|
|
251
|
+
export function startTimer(handler, operation, metadata) {
|
|
252
|
+
return new MetricsTimer(handler, operation, metadata);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Wrap an async function with metrics timing
|
|
256
|
+
*/
|
|
257
|
+
export async function withMetrics(handler, operation, fn, metadata) {
|
|
258
|
+
const timer = startTimer(handler, operation, metadata);
|
|
259
|
+
try {
|
|
260
|
+
const result = await fn();
|
|
261
|
+
timer.success();
|
|
262
|
+
return result;
|
|
263
|
+
}
|
|
264
|
+
catch (error) {
|
|
265
|
+
if (error instanceof Error) {
|
|
266
|
+
if (error.name === "TimeoutError") {
|
|
267
|
+
timer.timeout(error);
|
|
268
|
+
}
|
|
269
|
+
else if (error.name === "CancelledError") {
|
|
270
|
+
timer.cancelled(error);
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
timer.error(error);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
timer.error(new Error(String(error)));
|
|
278
|
+
}
|
|
279
|
+
throw error;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
// ============================================================================
|
|
283
|
+
// Standard Metric Names
|
|
284
|
+
// ============================================================================
|
|
285
|
+
/**
|
|
286
|
+
* Standard metric names for consistency
|
|
287
|
+
*/
|
|
288
|
+
export const MetricNames = {
|
|
289
|
+
// Pool gauges
|
|
290
|
+
poolTotalConnections: "flight_sql.pool.total_connections",
|
|
291
|
+
poolActiveConnections: "flight_sql.pool.active_connections",
|
|
292
|
+
poolIdleConnections: "flight_sql.pool.idle_connections",
|
|
293
|
+
poolPendingRequests: "flight_sql.pool.pending_requests",
|
|
294
|
+
// Counters
|
|
295
|
+
queriesExecuted: "flight_sql.queries.executed",
|
|
296
|
+
queriesSucceeded: "flight_sql.queries.succeeded",
|
|
297
|
+
queriesFailed: "flight_sql.queries.failed",
|
|
298
|
+
bytesReceived: "flight_sql.bytes.received",
|
|
299
|
+
bytesSent: "flight_sql.bytes.sent",
|
|
300
|
+
retriesAttempted: "flight_sql.retries.attempted",
|
|
301
|
+
connectionsCreated: "flight_sql.connections.created",
|
|
302
|
+
connectionsClosed: "flight_sql.connections.closed"
|
|
303
|
+
};
|
|
304
|
+
//# sourceMappingURL=metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA4HH,+EAA+E;AAC/E,4BAA4B;AAC5B,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAC7B,eAAe,CAAC,MAAmB;QACjC,sBAAsB;IACxB,CAAC;IAED,WAAW,CAAC,MAAkB;QAC5B,sBAAsB;IACxB,CAAC;IAED,aAAa,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