feat(mcp): add tool-call telemetry, metrics, usage events and the stdio server
NW
2d ago+2156+2156+0123456789012345678901234567890123456789-88-88-01234567890123456789
Stack. Part of the series that adds a built-in MCP server to DataHub Core. Based on na--mcp-settings (#21587); review only its own commits.
Stack so far:
1–22. Merged to master as #21332.
23–34. #21435, the read tools.
35–46. #21501, the write tools (PRs 36–46 merged into it).
47–55. #21587, MCP settings: model, API and UI.
56–60. #21588, telemetry, metrics, usage events and the stdio server. ← this PR
61–64. #21589, docs, release notes and smoke tests.
65–68. #21590, settings enforcement and the tool catalog.
69–70. #21591, the home page module.
71–74. #21623, the ingestion tools.
What this does
Telemetry, metrics, usage events and the local stdio server. It combines what would have been stack PRs 56–60, one commit each.
- Anonymous tool-call telemetry: the standalone
mcp-server-datahub's Mixpanel events, sent through the SDK's telemetry. That's one event per tool call plus a start event.- Error messages are left out, since they can carry user data.
- Sends happen on a background thread behind a bounded queue, so they never hold up a call.
- Off when the SDK's telemetry is off.
- Prometheus metrics at
/metrics: tool calls and their duration by tool and outcome, auth failures, GMS request timings and errors, and dropped usage events.DATAHUB_AI_METRICS_ENABLED=falseturns it off. - Usage events: MCP tool calls are recorded as DataHub usage events.
- GMS tracking-event attribution: tracking events are now attributed to the authenticated actor.
datahub-mcp-stdio: a local stdio MCP server indatahub-core-mcp-tools, replacinguvx mcp-server-datahub.
Testing
- Python:
datahub-core-mcp-toolsanddatahub-ai-servicelint and testQuick: 904 and 102 tests. - Java:
TrackingControllerTestandDataHubUsageEventTypeTest.
Checklist
- The PR conforms to DataHub's Contributing Guideline (particularly PR Title Format)
- Tests for the changes have been added/updated (if applicable)
- Docs related to the changes have been added/updated (if applicable). The MCP docs come in #21589.
- For any breaking change/potential downtime/deprecation/big changes an entry has been made in Breaking Changes. Not applicable: off by default.
🤖 Generated with Claude Code