Skip to content

Commit decbe30

Browse files
committed
Add Prometheus metrics and Segment analytics integration
- Updated `aap-mcp.sample.yaml` to include configuration options for Prometheus metrics and Segment analytics. - Added new `MetricsService` class for collecting and exposing metrics. - Implemented `AnalyticsService` for tracking tool usage and service events with anonymized data. - Enhanced `ToolLogger` to record metrics and analytics during tool execution. - Introduced `/metrics` endpoint for Prometheus scraping. - Updated `index.ts` to initialize analytics and metrics services based on configuration.
1 parent b63a369 commit decbe30

File tree

7 files changed

+629
-33
lines changed

7 files changed

+629
-33
lines changed

aap-mcp.sample.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
# Configuration for Web UI (defaults to false if not specified)
99
# enable_ui: false
1010

11+
# Configuration for Prometheus metrics endpoint (defaults to true if not specified)
12+
# enable_metrics: true
13+
14+
# Configuration for Segment.com analytics (defaults to true if segment_write_key is provided)
15+
# enable_analytics: true
16+
# segment_write_key: "your_segment_write_key_here"
17+
1118
# Configuration for base URL (defaults to https://localhost if not specified)
1219
# Lower priority than BASE_URL environment variable
1320
# base_url: "https://localhost:8443"

package-lock.json

Lines changed: 197 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"license": "Apache-2.0",
2424
"dependencies": {
2525
"@modelcontextprotocol/sdk": "^1.18.1",
26+
"@segment/analytics-node": "^2.1.2",
2627
"@types/js-yaml": "^4.0.9",
2728
"@types/node": "^24.5.2",
2829
"cors": "^2.8.5",
@@ -31,6 +32,8 @@
3132
"oas-normalize": "^15.0.2",
3233
"openapi-mcp-generator": "^3.2.0",
3334
"openapi-types": "^12.1.3",
35+
"prom-client": "^15.1.3",
36+
"tsc": "^2.0.4",
3437
"typescript": "^5.9.2"
3538
},
3639
"devDependencies": {

0 commit comments

Comments
 (0)