This repository was archived by the owner on Jan 29, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathmetrics.js
More file actions
67 lines (57 loc) · 2.02 KB
/
metrics.js
File metadata and controls
67 lines (57 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* Prometheus Metrics Configuration
*
* Defines and exports all metrics for the Gemini Flow backend.
* Metrics are collected and exposed for Prometheus scraping.
*/
import client from 'prom-client';
// Enable default metrics (CPU, memory, event loop lag)
client.collectDefaultMetrics({
prefix: 'gemini_flow_',
gcDurationBuckets: [0.001, 0.01, 0.1, 1, 2, 5]
});
// HTTP Request Duration Histogram
export const httpRequestDuration = new client.Histogram({
name: 'gemini_flow_http_request_duration_seconds',
help: 'Duration of HTTP requests in seconds',
labelNames: ['method', 'route', 'status_code'],
buckets: [0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1, 2, 5]
});
// HTTP Request Counter
export const httpRequestTotal = new client.Counter({
name: 'gemini_flow_http_requests_total',
help: 'Total number of HTTP requests',
labelNames: ['method', 'route', 'status_code']
});
// Error Counter
export const errorsTotal = new client.Counter({
name: 'gemini_flow_errors_total',
help: 'Total number of errors',
labelNames: ['type', 'path']
});
// Gemini API Request Duration (specific to our use case)
export const geminiApiDuration = new client.Histogram({
name: 'gemini_flow_gemini_api_duration_seconds',
help: 'Duration of Gemini API requests in seconds',
labelNames: ['status'],
buckets: [0.1, 0.5, 1, 2, 5, 10, 30]
});
// Gemini API Request Counter
export const geminiApiTotal = new client.Counter({
name: 'gemini_flow_gemini_api_requests_total',
help: 'Total number of Gemini API requests',
labelNames: ['status']
});
// Flow Execution Metrics
export const flowNodesProcessed = new client.Histogram({
name: 'gemini_flow_nodes_processed',
help: 'Distribution of node counts in executed flows',
buckets: [0, 5, 10, 25, 50, 100, 250, 500]
});
export const flowEdgesProcessed = new client.Histogram({
name: 'gemini_flow_edges_processed',
help: 'Distribution of edge counts in executed flows',
buckets: [0, 5, 10, 25, 50, 100, 250, 500]
});
// Registry for all metrics
export const register = client.register;